00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef EXAMPLE_NLP_FIRST_ORDER_DIRECT_H
00030 #define EXAMPLE_NLP_FIRST_ORDER_DIRECT_H
00031
00032 #include "NLPInterfacePack_ExampleNLPObjGrad.hpp"
00033 #include "NLPInterfacePack_NLPDirect.hpp"
00034 #include "AbstractLinAlgPack_VectorMutable.hpp"
00035 #include "AbstractLinAlgPack_VectorSpace.hpp"
00036 #include "AbstractLinAlgPack_VectorSpaceBlocked.hpp"
00037
00038 namespace NLPInterfacePack {
00039
00090 class ExampleNLPDirect
00091 : virtual public NLPDirect
00092 , virtual public ExampleNLPObjGrad
00093 {
00094 public:
00095
00109 ExampleNLPDirect(
00110 const VectorSpace::space_ptr_t& vec_space
00111 ,value_type xo
00112 ,bool has_bounds
00113 ,bool dep_bounded
00114 );
00115
00118
00120 void initialize(bool test_setup);
00122 bool is_initialized() const;
00123
00125
00128
00130 Range1D var_dep() const;
00132 Range1D var_indep() const;
00134 const mat_fcty_ptr_t factory_D() const;
00136 void calc_point(
00137 const Vector &x
00138 ,value_type *f
00139 ,VectorMutable *c
00140 ,bool recalc_c
00141 ,VectorMutable *Gf
00142 ,VectorMutable *py
00143 ,VectorMutable *rGf
00144 ,MatrixOp *GcU
00145 ,MatrixOp *D
00146 ,MatrixOp *Uz
00147 ) const;
00149 void calc_semi_newton_step(
00150 const Vector &x
00151 ,VectorMutable *c
00152 ,bool recalc_c
00153 ,VectorMutable *py
00154 ) const;
00155
00157
00158 private:
00159
00160
00161
00162
00163 mat_fcty_ptr_t factory_D_;
00164
00165 bool initialized_;
00166
00167
00168
00169
00171 void assert_is_initialized() const;
00172
00173 };
00174
00175
00176
00177
00178 inline
00179 void ExampleNLPDirect::assert_is_initialized() const
00180 {
00181 using NLPInterfacePack::NLP;
00182 if( !is_initialized() )
00183 throw NLP::UnInitialized("ExampleNLPDirect::assert_is_initialized() : Error, "
00184 "ExampleNLPDirect::initialize() has not been called yet." );
00185 }
00186
00187 }
00188
00189 #endif // EXAMPLE_NLP_FIRST_ORDER_DIRECT_H