G+Smo  23.12.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsFunctionAdaptor< T > Class Template Reference

Detailed Description

template<typename T>
class gismo::gsFunctionAdaptor< T >

Adaptor to see a given gsFunction as (the objective of) an unconstrained optimization problem.

+ Inheritance diagram for gsFunctionAdaptor< T >:
+ Collaboration diagram for gsFunctionAdaptor< T >:

Public Member Functions

virtual void computeJacStructure ()
 Computes the sparsity pattern of the constraint Jacobian matrix. More...
 
void evalCon_into (const gsAsConstVector< T > &u, gsAsVector< T > &result) const
 Returns values of the constraints at design value u.
 
evalObj (const gsAsConstVector< T > &u) const
 Returns the gradient value of the objective function at design value u. More...
 
void gradObj_into (const gsAsConstVector< T > &u, gsAsVector< T > &result) const
 Returns the gradient of the objective function at design value u By default it uses finite differences, overriding it should provide exact gradient.
 
 gsFunctionAdaptor (const gsFunction< T > &obj)
 
virtual void hessLagr_into (const gsAsConstVector< T > &, gsAsVector< T > &) const
 Returns Hessian Lagrangian of the constraints at design value.
 
void jacobCon_into (const gsAsConstVector< T > &u, gsAsVector< T > &result) const
 Returns Jacobian of the constraints at design value u. Format of result is sparse, complying to m_conJacRows and m_conJacCols.
 
int numDesignVars () const
 Callback function is executed after every iteration. Returning false causes premature termination of the optimization.
 

Protected Attributes

std::vector< index_tm_conJacCols
 Constraint Jacobian non-zero entries columns.
 
std::vector< index_tm_conJacRows
 Constraint Jacobian non-zero entries rows.
 
gsVector< T > m_conLowerBounds
 Lower bounds for the constraints.
 
gsVector< T > m_conUpperBounds
 Upper bounds for the constraints.
 
gsMatrix< T > m_curDesign
 Current design variables (and starting point )
 
gsVector< T > m_desLowerBounds
 Lower bounds for the design variables.
 
gsVector< T > m_desUpperBounds
 Upper bounds for the design variables.
 
gsMatrix< T > m_lambda
 Lagrange multipliers (set in the finalize_solution method)
 
int m_numConJacNonZero
 Number of nonzero entries in the Constraint Jacobian.
 
int m_numConstraints
 Number of constraints.
 
int m_numDesignVars
 Number of design variables.
 

Constructor & Destructor Documentation

gsFunctionAdaptor ( const gsFunction< T > &  obj)
inline

bound_relax_factor

Member Function Documentation

virtual void computeJacStructure ( )
inlinevirtualinherited

Computes the sparsity pattern of the constraint Jacobian matrix.

Number of constraints and design variables need to be set before calling this. By default the constraint Jacobian is set to full. Override this function to provide sparsity.

T evalObj ( const gsAsConstVector< T > &  u) const
inlinevirtual

Returns the gradient value of the objective function at design value u.

default constructor default destructor

Reimplemented from gsOptProblem< T >.