MOOCHO  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | List of all members
NLPInterfacePack::ExampleNLPDirect Class Reference

Simple example NLP subclass to illustrate how to implement the NLPDirect interface for a specialized NLP. More...

#include <NLPInterfacePack_ExampleNLPDirect.hpp>

Inheritance diagram for NLPInterfacePack::ExampleNLPDirect:
Inheritance graph
[legend]

Public Member Functions

 ExampleNLPDirect (const VectorSpace::space_ptr_t &vec_space, value_type xo, bool has_bounds, bool dep_bounded)
 Constructor. More...
 
- Public Member Functions inherited from NLPInterfacePack::ExampleNLPObjGrad
 ExampleNLPObjGrad (const VectorSpace::space_ptr_t &vec_space, value_type xo, bool has_bounds, bool dep_bounded)
 Constructor. More...
 
void initialize (bool test_setup)
 
bool is_initialized () const
 
size_type n () const
 
size_type m () const
 
vec_space_ptr_t space_x () const
 
vec_space_ptr_t space_c () const
 
size_type num_bounded_x () const
 
void force_xinit_in_bounds (bool force_xinit_in_bounds)
 
bool force_xinit_in_bounds () const
 
const Vector & xinit () const
 
const Vector & xl () const
 
const Vector & xu () const
 
value_type max_var_bounds_viol () const
 
void scale_f (value_type scale_f)
 
value_type scale_f () const
 
void report_final_solution (const Vector &x, const Vector *lambda, const Vector *nu, bool optimal)
 

Overridden public members from NLP

void initialize (bool test_setup)
 
bool is_initialized () const
 

Overridden public members from NLPDirect

Range1D var_dep () const
 
Range1D var_indep () const
 
const mat_fcty_ptr_t factory_D () const
 
void calc_point (const Vector &x, value_type *f, VectorMutable *c, bool recalc_c, VectorMutable *Gf, VectorMutable *py, VectorMutable *rGf, MatrixOp *GcU, MatrixOp *D, MatrixOp *Uz) const
 
void calc_semi_newton_step (const Vector &x, VectorMutable *c, bool recalc_c, VectorMutable *py) const
 

Detailed Description

Simple example NLP subclass to illustrate how to implement the NLPDirect interface for a specialized NLP.

For the NLP formulation see ExampleNLPObjGrad.

In this NLP we will select the first n/2 variables as the dependent or basis variables. Note that the variable bounds are on the dependent or independent variables variables if has_bounds = true. Otherwise there are no variable bounds. Also the starting point can be varied.

The implementation of this NLP subclass is actually independent from the vector space for the dependent and independent variables (same vector space). This implementation is defined entirely based on an arbitrary VectorSpace object that is passed to the constructor ExampleNLPDirect(). This NLP subclass uses a VectorSpaceBlocked object to represent the space for [ x_dep; x_indep ]

The quantities computed by this subclass include:

 py = -inv(C)*c
  
 D = -inv(C)*N
 
 where:
 
   Gc' = [ C , N ]
 
     [ x(m+1) - 1                 ]
     [        x(m+2) - 1            ]
   C = [              .         ]
     [                .       ]
     [                  x(m+m) - 1  ]
 
 
     [ x(1) - 10                    ]
     [        x(2) - 10           ]
   N = [              .         ]
     [                .       ]
     [                  x(m) - 10 ]

Here Gc is never computed explicitly.

To make this possible this subclass relies on some specialized RTOp operators which are implemented in C (for portability). These operator classes are declared in the header file NLPInterfacePack_ExampleNLPDirect.hpp and are documented here.

Definition at line 103 of file NLPInterfacePack_ExampleNLPDirect.hpp.

Constructor & Destructor Documentation

NLPInterfacePack::ExampleNLPDirect::ExampleNLPDirect ( const VectorSpace::space_ptr_t &  vec_space,
value_type  xo,
bool  has_bounds,
bool  dep_bounded 
)

Constructor.

Parameters
vec_space[in] Smart pointer to a vector space object that will be used to define the spaces of dependent and independent variables.
xo[in] The initial starting guess for x.
has_bounds[in] If true, then the NLP will have bounds. If false then it will not have bounds.
dep_bouned[in] If true, then the bounds will be on the dependent variables. If false, then the bounds will be on the independent variable. This argument is ignored if has_bounds == false.

Definition at line 75 of file NLPInterfacePack_ExampleNLPDirect.cpp.

Member Function Documentation

void NLPInterfacePack::ExampleNLPDirect::initialize ( bool  test_setup)
virtual

Reimplemented from NLPInterfacePack::NLPDirect.

Definition at line 97 of file NLPInterfacePack_ExampleNLPDirect.cpp.

bool NLPInterfacePack::ExampleNLPDirect::is_initialized ( ) const
virtual

Implements NLPInterfacePack::NLP.

Definition at line 112 of file NLPInterfacePack_ExampleNLPDirect.cpp.

Range1D NLPInterfacePack::ExampleNLPDirect::var_dep ( ) const
virtual

Reimplemented from NLPInterfacePack::NLPDirect.

Definition at line 119 of file NLPInterfacePack_ExampleNLPDirect.cpp.

Range1D NLPInterfacePack::ExampleNLPDirect::var_indep ( ) const
virtual

Reimplemented from NLPInterfacePack::NLPDirect.

Definition at line 124 of file NLPInterfacePack_ExampleNLPDirect.cpp.

const NLPDirect::mat_fcty_ptr_t NLPInterfacePack::ExampleNLPDirect::factory_D ( ) const
virtual
void NLPInterfacePack::ExampleNLPDirect::calc_point ( const Vector &  x,
value_type *  f,
VectorMutable *  c,
bool  recalc_c,
VectorMutable *  Gf,
VectorMutable *  py,
VectorMutable *  rGf,
MatrixOp *  GcU,
MatrixOp *  D,
MatrixOp *  Uz 
) const
virtual
void NLPInterfacePack::ExampleNLPDirect::calc_semi_newton_step ( const Vector &  x,
VectorMutable *  c,
bool  recalc_c,
VectorMutable *  py 
) const
virtual

The documentation for this class was generated from the following files: