Main Page
Namespaces
Classes
Files
File List
File Members
include
ifopt_snopt
snopt76_adapter.h
Go to the documentation of this file.
1
/******************************************************************************
2
Copyright (c) 2017, Alexander W. Winkler, ETH Zurich. All rights reserved.
3
4
Redistribution and use in source and binary forms, with or without modification,
5
are permitted provided that the following conditions are met:
6
* Redistributions of source code must retain the above copyright notice,
7
this list of conditions and the following disclaimer.
8
* Redistributions in binary form must reproduce the above copyright notice,
9
this list of conditions and the following disclaimer in the documentation
10
and/or other materials provided with the distribution.
11
* Neither the name of ETH ZURICH nor the names of its contributors may be
12
used to endorse or promote products derived from this software without
13
specific prior written permission.
14
15
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
DISCLAIMED. IN NO EVENT SHALL ETH ZURICH BE LIABLE FOR ANY DIRECT, INDIRECT,
19
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
20
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
22
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
23
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
24
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
******************************************************************************/
26
27
#ifndef IFOPT_INCLUDE_OPT_SNOPT76_ADAPTER_H_
28
#define IFOPT_INCLUDE_OPT_SNOPT76_ADAPTER_H_
29
30
#include <snoptProblem.hpp>
31
32
#include <
ifopt/problem.h
>
33
34
namespace
ifopt
{
35
50
class
SnoptAdapter
:
public
snoptProblemA {
51
public
:
52
using
NLPPtr
=
Problem
*;
53
using
VectorXd
=
Problem::VectorXd
;
54
using
Jacobian
=
Problem::Jacobian
;
55
60
SnoptAdapter
(
Problem
& nlp);
61
virtual
~SnoptAdapter
() =
default
;
62
67
static
void
Solve
(
Problem
& nlp);
68
69
private
:
80
static
void
SetOptions
(
SnoptAdapter
&);
81
82
private
:
83
void
Init
();
84
static
void
ObjectiveAndConstraintFct
(
int
*Status,
int
*
n
,
double
x
[],
85
int
*needF,
int
*
neF
,
double
F
[],
86
int
*needG,
int
*
neG
,
double
G[],
87
char
*cu,
int
*lencu,
88
int
iu[],
int
*leniu,
89
double
ru[],
int
*lenru);
90
91
void
SetVariables
();
92
93
static
NLPPtr
nlp_
;
// use raw pointer as SnoptAdapter doesn't own the nlp.
94
95
96
// additional variables as Snopt76 base class doesn't have them, not really
97
// necessary but to keep the same structure of the original SnoptAdapter
98
protected
:
99
100
int
jacComputed
= 0;
101
int
n
= 0;
102
int
neF
= 0;
103
int
ObjRow
;
104
double
ObjAdd
;
105
106
double
*
x
, *
xlow
, *
xupp
, *
xmul
;
107
double
*
F
, *
Flow
, *
Fupp
, *
Fmul
;
108
109
int
*
xstate
, *
Fstate
;
110
111
int
lenA
,
lenG
,
neA
,
neG
;
112
int
*
iAfun
, *
jAvar
, *
iGfun
, *
jGvar
;
113
double
*
A
;
114
115
};
116
117
}
/* namespace opt */
118
119
#endif
/* IFOPT_INCLUDE_OPT_SNOPT76_ADAPTER_H_ */
ifopt::SnoptAdapter::xstate
int * xstate
Definition:
snopt76_adapter.h:109
ifopt::SnoptAdapter::Flow
double * Flow
Definition:
snopt76_adapter.h:107
ifopt::SnoptAdapter::jacComputed
int jacComputed
Definition:
snopt76_adapter.h:100
ifopt::SnoptAdapter::VectorXd
Problem::VectorXd VectorXd
Definition:
snopt76_adapter.h:53
ifopt::Problem
ifopt::SnoptAdapter::neF
int neF
Definition:
snopt76_adapter.h:102
ifopt::Problem::Jacobian
Component::Jacobian Jacobian
ifopt::SnoptAdapter::neA
int neA
Definition:
snopt76_adapter.h:111
ifopt::SnoptAdapter::A
double * A
Definition:
snopt76_adapter.h:113
ifopt::SnoptAdapter::Fstate
int * Fstate
Definition:
snopt76_adapter.h:109
ifopt::SnoptAdapter::ObjectiveAndConstraintFct
static void ObjectiveAndConstraintFct(int *Status, int *n, double x[], int *needF, int *neF, double F[], int *needG, int *neG, double G[], char *cu, int *lencu, int iu[], int *leniu, double ru[], int *lenru)
Definition:
snopt76_adapter.cc:181
ifopt::SnoptAdapter::lenG
int lenG
Definition:
snopt76_adapter.h:111
ifopt::SnoptAdapter::iAfun
int * iAfun
Definition:
snopt76_adapter.h:112
ifopt::SnoptAdapter::iGfun
int * iGfun
Definition:
snopt76_adapter.h:112
ifopt::SnoptAdapter::F
double * F
Definition:
snopt76_adapter.h:107
ifopt::Problem::VectorXd
Component::VectorXd VectorXd
ifopt::SnoptAdapter::ObjAdd
double ObjAdd
Definition:
snopt76_adapter.h:104
ifopt::SnoptAdapter::nlp_
static NLPPtr nlp_
Definition:
snopt76_adapter.h:93
ifopt::SnoptAdapter::jAvar
int * jAvar
Definition:
snopt76_adapter.h:112
ifopt::SnoptAdapter::xupp
double * xupp
Definition:
snopt76_adapter.h:106
ifopt::SnoptAdapter::Init
void Init()
Definition:
snopt76_adapter.cc:90
ifopt::SnoptAdapter::Solve
static void Solve(Problem &nlp)
Creates a snoptProblemA from nlp and solves it.
Definition:
snopt76_adapter.cc:34
ifopt::SnoptAdapter::n
int n
Definition:
snopt76_adapter.h:101
ifopt::SnoptAdapter::xmul
double * xmul
Definition:
snopt76_adapter.h:106
ifopt::SnoptAdapter::Fupp
double * Fupp
Definition:
snopt76_adapter.h:107
ifopt::SnoptAdapter::x
double * x
Definition:
snopt76_adapter.h:106
ifopt
ifopt::SnoptAdapter::neG
int neG
Definition:
snopt76_adapter.h:111
ifopt::SnoptAdapter::jGvar
int * jGvar
Definition:
snopt76_adapter.h:112
ifopt::SnoptAdapter::ObjRow
int ObjRow
Definition:
snopt76_adapter.h:103
ifopt::SnoptAdapter::SnoptAdapter
SnoptAdapter(Problem &nlp)
Creates an Adapter Object around the problem to conform to the Snopt interface.
Definition:
snopt76_adapter.cc:84
ifopt::SnoptAdapter::SetOptions
static void SetOptions(SnoptAdapter &)
Sets solver settings for Snopt.
Definition:
snopt76_adapter.cc:67
ifopt::SnoptAdapter::xlow
double * xlow
Definition:
snopt76_adapter.h:106
ifopt::SnoptAdapter::Fmul
double * Fmul
Definition:
snopt76_adapter.h:107
ifopt::SnoptAdapter::SetVariables
void SetVariables()
Definition:
snopt76_adapter.cc:217
ifopt::SnoptAdapter::lenA
int lenA
Definition:
snopt76_adapter.h:111
ifopt::SnoptAdapter::~SnoptAdapter
virtual ~SnoptAdapter()=default
problem.h
ifopt::SnoptAdapter::Jacobian
Problem::Jacobian Jacobian
Definition:
snopt76_adapter.h:54
ifopt::SnoptAdapter
Solves the optimization problem with the new SNOPT 7.6 version.
Definition:
snopt76_adapter.h:50
ifopt_snopt
Author(s): Alexander W. Winkler
autogenerated on Fri Apr 20 2018 02:27:35