ifopt_snopt
include
ifopt
snopt_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_SNOPT_ADAPTER_H_
28
#define IFOPT_INCLUDE_OPT_SNOPT_ADAPTER_H_
29
30
#include <snoptProblem.hpp>
31
32
#include <
ifopt/problem.h
>
33
34
namespace
ifopt
{
35
48
class
SnoptAdapter :
public
snoptProblemA {
49
public
:
50
using
NLPPtr
= Problem*;
51
using
VectorXd
=
Problem::VectorXd
;
52
using
Jacobian
=
Problem::Jacobian
;
53
58
SnoptAdapter
(Problem& nlp);
59
virtual
~SnoptAdapter
() =
default
;
60
61
void
Init
();
62
void
SetVariables
();
63
64
static
void
ObjectiveAndConstraintFct
(
int
* Status,
int
* n,
double
x[],
65
int
* needF,
int
* neF,
double
F[],
66
int
* needG,
int
* neG,
double
G[],
67
char
* cu,
int
* lencu,
int
iu[],
68
int
* leniu,
double
ru[],
int
* lenru);
69
70
private
:
71
static
NLPPtr
nlp_
;
// use raw pointer as SnoptAdapter doesn't own the nlp.
72
73
// additional variables as Snopt76 base class doesn't have them, not really
74
// necessary but to keep the same structure of the original SnoptAdapter
75
#ifdef SNOPT76
76
77
public
:
78
int
jacComputed = 0;
79
int
n = 0;
80
int
neF = 0;
81
int
ObjRow;
82
double
ObjAdd;
83
84
double
*x, *xlow, *xupp, *xmul;
85
double
*F, *Flow, *Fupp, *Fmul;
86
87
int
*xstate, *Fstate;
88
89
int
lenA, lenG, neA, neG;
90
int
*iAfun, *jAvar, *iGfun, *jGvar;
91
double
* A;
92
#endif
93
};
94
95
}
// namespace ifopt
96
97
#endif
/* IFOPT_INCLUDE_OPT_SNOPT_ADAPTER_H_ */
ifopt::SnoptAdapter::VectorXd
Problem::VectorXd VectorXd
Definition:
snopt_adapter.h:99
ifopt::Problem::VectorXd
Component::VectorXd VectorXd
Definition:
problem.h:127
ifopt::SnoptAdapter::SetVariables
void SetVariables()
Definition:
snopt_adapter.cc:189
ifopt::Problem::Jacobian
Component::Jacobian Jacobian
Definition:
problem.h:126
problem.h
ifopt::SnoptAdapter::nlp_
static NLPPtr nlp_
Definition:
snopt_adapter.h:119
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:
snopt_adapter.cc:154
ifopt::SnoptAdapter::Init
void Init()
Definition:
snopt_adapter.cc:62
ifopt::SnoptAdapter::~SnoptAdapter
virtual ~SnoptAdapter()=default
ifopt::SnoptAdapter::Jacobian
Problem::Jacobian Jacobian
Definition:
snopt_adapter.h:100
ifopt::SnoptAdapter::NLPPtr
Problem * NLPPtr
Definition:
snopt_adapter.h:98
ifopt
common namespace for all elements in this library.
Definition:
bounds.h:33
ifopt::SnoptAdapter::SnoptAdapter
SnoptAdapter(Problem &nlp)
Creates an Adapter Object around the problem to conform to the Snopt interface.
Definition:
snopt_adapter.cc:57
ifopt
Author(s): Alexander W. Winkler
autogenerated on Mon Sep 18 2023 02:14:38