G+Smo  25.01.0
Geometry + Simulation Modules
 
Loading...
Searching...
No Matches
gsIpOpt.h
Go to the documentation of this file.
1
17
18#pragma once
19
20namespace gismo
21{
22
23template <typename T> class gsIpOptTNLP;
24template <typename T> class gsIpOptPrivate;
29template <typename T>
30class gsIpOpt : public gsOptimizer<T>
31{
32public:
33 using Base = gsOptimizer<T>;
34
35 friend class gsIpOptTNLP<T>;
36
37public:
38
40 gsIpOpt(gsOptProblem<T> * problem);
41
43 virtual ~gsIpOpt();
44
45 // // Currently not used
46 // void defaultOptions()
47 // {
48 // using Base::defaultOptions;
49 // }
50
51 void getOptions()
52 {
53 gsWarn<<"gsIpOpt.h has its options stored in filedata/options/ipopt.opt\n";
54 }
55
56public:
57
58 const gsMatrix<T> & lambda() const { return m_lambda; }
59
60public:
61
62 void solve (const gsMatrix<T> & initialGuess);
63
64 std::ostream &print(std::ostream &os) const
65 {
66 os << "Design variables:" << m_op->numDesignVars()
67 << "\nNumber of constraints: " << m_op->numConstraints()
68 //<< "\ndesign lower:" << m_op->desLowerBounds().transpose()
69 //<< "\ndesign upper:" << m_op->desUpperBounds().transpose()
70 //<< "\nconstr lower:" << m_op->conLowerBounds().transpose()
71 //<< "\nconstr upper:" << m_op->conUpperBounds().transpose()
72 << "\nNumber of active sensitivities: " << m_op->numConJacNonZero()
73 << "\nSparsity of sensitivities: " <<std::fixed<<std::setprecision(2)
74 << (100.0*m_op->numConJacNonZero())/(m_op->numDesignVars()*m_op->numConstraints()) << " %"
75 //<< "\nm_op->conJacRows():" << m_op->conJacRows().transpose()
76 //<< "\nm_op->conJacCols():" << m_op->conJacCols().transpose()
77 //<< "\nm_op->curDesign():" << m_op->curDesign().transpose()
78 ;
79 return os;
80 }
81
82
83protected:
84
87
88protected:
89
90// Members taken from Base
91protected:
92 using Base::m_op;
93 using Base::m_numIterations;
94 using Base::m_finalObjective;
96 using Base::m_options;
97 using Base::m_verbose;
98 using Base::m_maxIterations;
99
100 using Base::defaultOptions;
101 using Base::getOptions;
102
103 // Statistics
104
105 gsIpOptPrivate<T> * m_data;
106
107private:
108
120 gsIpOpt(const gsIpOpt & );
121 gsIpOpt& operator=(const gsIpOpt & );
123};
124
125
126} // end namespace gismo
127
128// note: statically compiled in header-only mode
129#ifndef GISMO_BUILD_LIB
130#include GISMO_HPP_HEADER(gsIpOpt.hpp)
131#endif
Class defining an optimization problem.
Definition gsIpOpt.h:31
gsMatrix< T > m_lambda
Lagrange multipliers (set in the finalize_solution method)
Definition gsIpOpt.h:86
virtual ~gsIpOpt()
Definition gsIpOpt.hpp:268
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
Class defining an optimization problem.
Definition gsOptProblem.h:25
Class defining an optimizer.
Definition gsOptimizer.h:28
gsOptionList m_options
Options.
Definition gsOptimizer.h:108
gsMatrix< T > m_curDesign
Current design variables (and starting point )
Definition gsOptimizer.h:105
#define gsWarn
Definition gsDebug.h:50
This is the main header file that collects wrappers of Eigen for linear algebra.
Provides declaration of an optimization problem.
This file is part of the G+Smo library.
The G+Smo namespace, containing all definitions for the library.