#include <IpTNLPAdapter.hpp>
Inheritance diagram for Ipopt::TNLPAdapter:
Public Types | |
MAKE_PARAMETER = 0 | |
MAKE_CONSTRAINT | |
NO_TEST = 0 | |
FIRST_ORDER_TEST | |
SECOND_ORDER_TEST | |
enum | FixedVariableTreatmentEnum { MAKE_PARAMETER = 0, MAKE_CONSTRAINT } |
Enum for treatment of fixed variables option. More... | |
enum | DerivativeTestEnum { NO_TEST = 0, FIRST_ORDER_TEST, SECOND_ORDER_TEST } |
Enum for specifying which derivative test is to be performed. More... | |
Public Member Functions | |
virtual void | GetQuasiNewtonApproximationSpaces (SmartPtr< VectorSpace > &approx_space, SmartPtr< Matrix > &P_approx) |
Method returning information on quasi-Newton approximation. | |
bool | CheckDerivatives (DerivativeTestEnum deriv_test) |
Method for performing the derivative test. | |
SmartPtr< TNLP > | tnlp () const |
Accessor method for the underlying TNLP. | |
Constructors/Destructors | |
TNLPAdapter (const SmartPtr< TNLP > tnlp, const SmartPtr< const Journalist > jnlst=NULL) | |
Default constructor. | |
virtual | ~TNLPAdapter () |
Default destructor. | |
Exceptions | |
DECLARE_STD_EXCEPTION (INVALID_TNLP) | |
DECLARE_STD_EXCEPTION (ERROR_IN_TNLP_DERIVATIVE_TEST) | |
TNLPAdapter Initialization. | |
virtual bool | ProcessOptions (const OptionsList &options, const std::string &prefix) |
Overload if you want the chance to process options or parameters that may be specific to the NLP. | |
virtual bool | GetSpaces (SmartPtr< const VectorSpace > &x_space, SmartPtr< const VectorSpace > &c_space, SmartPtr< const VectorSpace > &d_space, SmartPtr< const VectorSpace > &x_l_space, SmartPtr< const MatrixSpace > &px_l_space, SmartPtr< const VectorSpace > &x_u_space, SmartPtr< const MatrixSpace > &px_u_space, SmartPtr< const VectorSpace > &d_l_space, SmartPtr< const MatrixSpace > &pd_l_space, SmartPtr< const VectorSpace > &d_u_space, SmartPtr< const MatrixSpace > &pd_u_space, SmartPtr< const MatrixSpace > &Jac_c_space, SmartPtr< const MatrixSpace > &Jac_d_space, SmartPtr< const SymMatrixSpace > &Hess_lagrangian_space) |
Method for creating the derived vector / matrix types (Do not delete these, the ). | |
virtual bool | GetBoundsInformation (const Matrix &Px_L, Vector &x_L, const Matrix &Px_U, Vector &x_U, const Matrix &Pd_L, Vector &d_L, const Matrix &Pd_U, Vector &d_U) |
Method for obtaining the bounds information. | |
virtual bool | GetStartingPoint (SmartPtr< Vector > x, bool need_x, SmartPtr< Vector > y_c, bool need_y_c, SmartPtr< Vector > y_d, bool need_y_d, SmartPtr< Vector > z_L, bool need_z_L, SmartPtr< Vector > z_U, bool need_z_U) |
Method for obtaining the starting point for all the iterates. | |
virtual bool | GetWarmStartIterate (IteratesVector &warm_start_iterate) |
Method for obtaining an entire iterate as a warmstart point. | |
TNLPAdapter evaluation routines. | |
virtual bool | Eval_f (const Vector &x, Number &f) |
virtual bool | Eval_grad_f (const Vector &x, Vector &g_f) |
virtual bool | Eval_c (const Vector &x, Vector &c) |
virtual bool | Eval_jac_c (const Vector &x, Matrix &jac_c) |
virtual bool | Eval_d (const Vector &x, Vector &d) |
virtual bool | Eval_jac_d (const Vector &x, Matrix &jac_d) |
virtual bool | Eval_h (const Vector &x, Number obj_factor, const Vector &yc, const Vector &yd, SymMatrix &h) |
virtual void | GetScalingParameters (const SmartPtr< const VectorSpace > x_space, const SmartPtr< const VectorSpace > c_space, const SmartPtr< const VectorSpace > d_space, Number &obj_scaling, SmartPtr< Vector > &x_scaling, SmartPtr< Vector > &c_scaling, SmartPtr< Vector > &d_scaling) const |
Routines to get the scaling parameters. | |
Solution Reporting Methods | |
virtual void | FinalizeSolution (SolverReturn status, const Vector &x, const Vector &z_L, const Vector &z_U, const Vector &c, const Vector &d, const Vector &y_c, const Vector &y_d, Number obj_value) |
This method is called at the very end of the optimization. | |
virtual bool | IntermediateCallBack (AlgorithmMode mode, Index iter, Number obj_value, Number inf_pr, Number inf_du, Number mu, Number d_norm, Number regularization_size, Number alpha_du, Number alpha_pr, Index ls_trials, const IpoptData *ip_data, IpoptCalculatedQuantities *ip_cq) |
This method is called once per iteration, after the iteration summary output has been printed. | |
Static Public Member Functions | |
Methods for IpoptType | |
static void | RegisterOptions (SmartPtr< RegisteredOptions > roptions) |
Private Member Functions | |
Default Compiler Generated Methods | |
(Hidden to avoid implicit creation/calling). These methods are not implemented and we do not want the compiler to implement them for us, so we declare them private and do not define them. This ensures that they will not be implicitly created/called. | |
TNLPAdapter (const TNLPAdapter &) | |
Copy Constructor. | |
void | operator= (const TNLPAdapter &) |
Overloaded Equals Operator. | |
Methods for translating data for IpoptNLP into the TNLP | |
data. These methods are used to obtain the current (or final) data for the TNLP formulation from the IpoptNLP structure. | |
void | ResortX (const Vector &x, Number *x_orig) |
Sort the primal variables, and add the fixed values in x. | |
void | ResortG (const Vector &c, const Vector &d, Number *g_orig) |
Sort the primal variables, and add the fixed values in x. | |
void | ResortBnds (const Vector &x_L, Number *x_L_orig, const Vector &x_U, Number *x_U_orig) |
Sort the primal variables, and add the fixed values in x. | |
Methods to update the values in the local copies of vectors | |
bool | update_local_x (const Vector &x) |
bool | update_local_lambda (const Vector &y_c, const Vector &y_d) |
Internal routines for evaluating g and jac_g (values stored since | |
they are used in both c and d routins | |
bool | internal_eval_g (bool new_x) |
bool | internal_eval_jac_g (bool new_x) |
Private Attributes | |
SmartPtr< TNLP > | tnlp_ |
Pointer to the TNLP class (class specific to Number* vectors and harwell triplet matrices). | |
SmartPtr< const Journalist > | jnlst_ |
Journalist. | |
TNLP::IndexStyleEnum | index_style_ |
Numbering style of variables and constraints. | |
Algorithmic parameters | |
Number | nlp_lower_bound_inf_ |
Value for a lower bound that denotes -infinity. | |
Number | nlp_upper_bound_inf_ |
Value for a upper bound that denotes infinity. | |
FixedVariableTreatmentEnum | fixed_variable_treatment_ |
Flag indicating how fixed variables should be handled. | |
DerivativeTestEnum | derivative_test_ |
Enum indicating whether and which derivative test should be performed at starting point. | |
Number | derivative_test_perturbation_ |
Size of the perturbation for the derivative test. | |
Number | derivative_test_tol_ |
Relative threshold for marking deviation from finite difference test. | |
bool | derivative_test_print_all_ |
Flag indicating if all test values should be printed, or only those violating the threshold. | |
bool | warm_start_same_structure_ |
Flag indicating whether the TNLP with identical structure has already been solved before. | |
HessianApproximationType | hessian_approximation_ |
Flag indicating what Hessian information is to be used. | |
Problem Size Data | |
Index | n_full_x_ |
full dimension of x (fixed + non-fixed) | |
Index | n_full_g_ |
full dimension of g (c + d) | |
Index | nz_jac_c_ |
non-zeros of the jacobian of c | |
Index | nz_jac_c_no_fixed_ |
non-zeros of the jacobian of c without added constraints for fixed variables. | |
Index | nz_jac_d_ |
non-zeros of the jacobian of d | |
Index | nz_full_jac_g_ |
number of non-zeros in full-size Jacobian of g | |
Index | nz_full_h_ |
number of non-zeros in full-size Hessian | |
Index | nz_h_ |
number of non-zeros in the non-fixed-size Hessian | |
Index | n_x_fixed_ |
Number of fixed variables. | |
Local copy of spaces (for warm start) | |
SmartPtr< const VectorSpace > | x_space_ |
SmartPtr< const VectorSpace > | c_space_ |
SmartPtr< const VectorSpace > | d_space_ |
SmartPtr< const VectorSpace > | x_l_space_ |
SmartPtr< const MatrixSpace > | px_l_space_ |
SmartPtr< const VectorSpace > | x_u_space_ |
SmartPtr< const MatrixSpace > | px_u_space_ |
SmartPtr< const VectorSpace > | d_l_space_ |
SmartPtr< const MatrixSpace > | pd_l_space_ |
SmartPtr< const VectorSpace > | d_u_space_ |
SmartPtr< const MatrixSpace > | pd_u_space_ |
SmartPtr< const MatrixSpace > | Jac_c_space_ |
SmartPtr< const MatrixSpace > | Jac_d_space_ |
SmartPtr< const SymMatrixSpace > | Hess_lagrangian_space_ |
Local Copy of the Data | |
Number * | full_x_ |
Number * | full_lambda_ |
copy of the full x vector (fixed & non-fixed) | |
Number * | full_g_ |
copy of lambda (yc & yd) | |
Number * | jac_g_ |
copy of g (c & d) | |
Number * | c_rhs_ |
the values for the full jacobian of g | |
Tags for deciding when to update internal copies of vectors | |
TaggedObject::Tag | x_tag_for_iterates_ |
TaggedObject::Tag | y_c_tag_for_iterates_ |
TaggedObject::Tag | y_d_tag_for_iterates_ |
TaggedObject::Tag | x_tag_for_g_ |
TaggedObject::Tag | x_tag_for_jac_g_ |
Internal Permutation Spaces and matrices | |
SmartPtr< ExpansionMatrix > | P_x_full_x_ |
Expansion from fixed x (ipopt) to full x. | |
SmartPtr< ExpansionMatrixSpace > | P_x_full_x_space_ |
Expansion from fixed x (ipopt) to full x. | |
SmartPtr< ExpansionMatrix > | P_x_x_L_ |
Expansion from fixed x_L (ipopt) to full x. | |
SmartPtr< ExpansionMatrixSpace > | P_x_x_L_space_ |
Expansion from fixed x (ipopt) to full x. | |
SmartPtr< ExpansionMatrix > | P_x_x_U_ |
Expansion from fixed x_U (ipopt) to full x. | |
SmartPtr< ExpansionMatrixSpace > | P_x_x_U_space_ |
Expansion from fixed x (ipopt) to full x. | |
SmartPtr< ExpansionMatrixSpace > | P_c_g_space_ |
Expansion from c only (ipopt) to full ampl c. | |
SmartPtr< ExpansionMatrix > | P_c_g_ |
Expansion from fixed x (ipopt) to full x. | |
SmartPtr< ExpansionMatrixSpace > | P_d_g_space_ |
Expansion from d only (ipopt) to full ampl d. | |
SmartPtr< ExpansionMatrix > | P_d_g_ |
Expansion from fixed x (ipopt) to full x. | |
Index * | jac_idx_map_ |
Expansion from fixed x (ipopt) to full x. | |
Index * | h_idx_map_ |
Expansion from fixed x (ipopt) to full x. | |
Index * | x_fixed_map_ |
Position of fixed variables. |
This is an Adapter class (Design Patterns) that converts a TNLP to an NLP. This allows users to write to the "more convenient" TNLP interface.
Definition at line 28 of file IpTNLPAdapter.hpp.
Enum for specifying which derivative test is to be performed.
Definition at line 159 of file IpTNLPAdapter.hpp.
Ipopt::TNLPAdapter::TNLPAdapter | ( | const SmartPtr< TNLP > | tnlp, | |
const SmartPtr< const Journalist > | jnlst = NULL | |||
) |
Default constructor.
virtual Ipopt::TNLPAdapter::~TNLPAdapter | ( | ) | [virtual] |
Default destructor.
Ipopt::TNLPAdapter::TNLPAdapter | ( | const TNLPAdapter & | ) | [private] |
Copy Constructor.
Ipopt::TNLPAdapter::DECLARE_STD_EXCEPTION | ( | INVALID_TNLP | ) |
Ipopt::TNLPAdapter::DECLARE_STD_EXCEPTION | ( | ERROR_IN_TNLP_DERIVATIVE_TEST | ) |
virtual bool Ipopt::TNLPAdapter::ProcessOptions | ( | const OptionsList & | options, | |
const std::string & | prefix | |||
) | [virtual] |
Overload if you want the chance to process options or parameters that may be specific to the NLP.
Reimplemented from Ipopt::NLP.
virtual bool Ipopt::TNLPAdapter::GetSpaces | ( | SmartPtr< const VectorSpace > & | x_space, | |
SmartPtr< const VectorSpace > & | c_space, | |||
SmartPtr< const VectorSpace > & | d_space, | |||
SmartPtr< const VectorSpace > & | x_l_space, | |||
SmartPtr< const MatrixSpace > & | px_l_space, | |||
SmartPtr< const VectorSpace > & | x_u_space, | |||
SmartPtr< const MatrixSpace > & | px_u_space, | |||
SmartPtr< const VectorSpace > & | d_l_space, | |||
SmartPtr< const MatrixSpace > & | pd_l_space, | |||
SmartPtr< const VectorSpace > & | d_u_space, | |||
SmartPtr< const MatrixSpace > & | pd_u_space, | |||
SmartPtr< const MatrixSpace > & | Jac_c_space, | |||
SmartPtr< const MatrixSpace > & | Jac_d_space, | |||
SmartPtr< const SymMatrixSpace > & | Hess_lagrangian_space | |||
) | [virtual] |
Method for creating the derived vector / matrix types (Do not delete these, the ).
Implements Ipopt::NLP.
virtual bool Ipopt::TNLPAdapter::GetWarmStartIterate | ( | IteratesVector & | warm_start_iterate | ) | [virtual] |
Method for obtaining an entire iterate as a warmstart point.
The incoming IteratesVector has to be filled.
Reimplemented from Ipopt::NLP.
Implements Ipopt::NLP.
Implements Ipopt::NLP.
Implements Ipopt::NLP.
Implements Ipopt::NLP.
Implements Ipopt::NLP.
Implements Ipopt::NLP.
virtual bool Ipopt::TNLPAdapter::Eval_h | ( | const Vector & | x, | |
Number | obj_factor, | |||
const Vector & | yc, | |||
const Vector & | yd, | |||
SymMatrix & | h | |||
) | [virtual] |
Implements Ipopt::NLP.
virtual void Ipopt::TNLPAdapter::GetScalingParameters | ( | const SmartPtr< const VectorSpace > | x_space, | |
const SmartPtr< const VectorSpace > | c_space, | |||
const SmartPtr< const VectorSpace > | d_space, | |||
Number & | obj_scaling, | |||
SmartPtr< Vector > & | x_scaling, | |||
SmartPtr< Vector > & | c_scaling, | |||
SmartPtr< Vector > & | d_scaling | |||
) | const [virtual] |
Routines to get the scaling parameters.
These do not need to be overloaded unless the options are set for User scaling
Reimplemented from Ipopt::NLP.
virtual void Ipopt::TNLPAdapter::FinalizeSolution | ( | SolverReturn | status, | |
const Vector & | x, | |||
const Vector & | z_L, | |||
const Vector & | z_U, | |||
const Vector & | c, | |||
const Vector & | d, | |||
const Vector & | y_c, | |||
const Vector & | y_d, | |||
Number | obj_value | |||
) | [virtual] |
This method is called at the very end of the optimization.
It provides the final iterate to the user, so that it can be stored as the solution. The status flag indicates the outcome of the optimization, where SolverReturn is defined in IpAlgTypes.hpp.
Reimplemented from Ipopt::NLP.
virtual bool Ipopt::TNLPAdapter::IntermediateCallBack | ( | AlgorithmMode | mode, | |
Index | iter, | |||
Number | obj_value, | |||
Number | inf_pr, | |||
Number | inf_du, | |||
Number | mu, | |||
Number | d_norm, | |||
Number | regularization_size, | |||
Number | alpha_du, | |||
Number | alpha_pr, | |||
Index | ls_trials, | |||
const IpoptData * | ip_data, | |||
IpoptCalculatedQuantities * | ip_cq | |||
) | [virtual] |
This method is called once per iteration, after the iteration summary output has been printed.
It provides the current information to the user to do with it anything she wants. It also allows the user to ask for a premature termination of the optimization by returning false, in which case Ipopt will terminate with a corresponding return status. The basic information provided in the argument list has the quantities values printed in the iteration summary line. If more information is required, a user can obtain it from the IpData and IpCalculatedQuantities objects. However, note that the provided quantities are all for the problem that Ipopt sees, i.e., the quantities might be scaled, fixed variables might be sorted out, etc. The status indicates things like whether the algorithm is in the restoration phase... In the restoration phase, the dual variables are probably not not changing.
Reimplemented from Ipopt::NLP.
virtual void Ipopt::TNLPAdapter::GetQuasiNewtonApproximationSpaces | ( | SmartPtr< VectorSpace > & | approx_space, | |
SmartPtr< Matrix > & | P_approx | |||
) | [virtual] |
bool Ipopt::TNLPAdapter::CheckDerivatives | ( | DerivativeTestEnum | deriv_test | ) |
Method for performing the derivative test.
static void Ipopt::TNLPAdapter::RegisterOptions | ( | SmartPtr< RegisteredOptions > | roptions | ) | [static] |
Accessor method for the underlying TNLP.
Definition at line 174 of file IpTNLPAdapter.hpp.
References tnlp_.
void Ipopt::TNLPAdapter::operator= | ( | const TNLPAdapter & | ) | [private] |
Overloaded Equals Operator.
Sort the primal variables, and add the fixed values in x.
Sort the primal variables, and add the fixed values in x.
void Ipopt::TNLPAdapter::ResortBnds | ( | const Vector & | x_L, | |
Number * | x_L_orig, | |||
const Vector & | x_U, | |||
Number * | x_U_orig | |||
) | [private] |
Sort the primal variables, and add the fixed values in x.
bool Ipopt::TNLPAdapter::update_local_x | ( | const Vector & | x | ) | [private] |
bool Ipopt::TNLPAdapter::internal_eval_g | ( | bool | new_x | ) | [private] |
bool Ipopt::TNLPAdapter::internal_eval_jac_g | ( | bool | new_x | ) | [private] |
SmartPtr<TNLP> Ipopt::TNLPAdapter::tnlp_ [private] |
Pointer to the TNLP class (class specific to Number* vectors and harwell triplet matrices).
Definition at line 209 of file IpTNLPAdapter.hpp.
Referenced by tnlp().
SmartPtr<const Journalist> Ipopt::TNLPAdapter::jnlst_ [private] |
Flag indicating how fixed variables should be handled.
Definition at line 221 of file IpTNLPAdapter.hpp.
Enum indicating whether and which derivative test should be performed at starting point.
Definition at line 229 of file IpTNLPAdapter.hpp.
Relative threshold for marking deviation from finite difference test.
Definition at line 234 of file IpTNLPAdapter.hpp.
bool Ipopt::TNLPAdapter::derivative_test_print_all_ [private] |
Flag indicating if all test values should be printed, or only those violating the threshold.
Definition at line 237 of file IpTNLPAdapter.hpp.
bool Ipopt::TNLPAdapter::warm_start_same_structure_ [private] |
Flag indicating whether the TNLP with identical structure has already been solved before.
Definition at line 240 of file IpTNLPAdapter.hpp.
Flag indicating what Hessian information is to be used.
Definition at line 242 of file IpTNLPAdapter.hpp.
Index Ipopt::TNLPAdapter::n_full_x_ [private] |
Index Ipopt::TNLPAdapter::n_full_g_ [private] |
Index Ipopt::TNLPAdapter::nz_jac_c_ [private] |
Index Ipopt::TNLPAdapter::nz_jac_c_no_fixed_ [private] |
non-zeros of the jacobian of c without added constraints for fixed variables.
Definition at line 255 of file IpTNLPAdapter.hpp.
Index Ipopt::TNLPAdapter::nz_jac_d_ [private] |
Index Ipopt::TNLPAdapter::nz_full_jac_g_ [private] |
Index Ipopt::TNLPAdapter::nz_full_h_ [private] |
Index Ipopt::TNLPAdapter::nz_h_ [private] |
Index Ipopt::TNLPAdapter::n_x_fixed_ [private] |
SmartPtr<const VectorSpace> Ipopt::TNLPAdapter::x_space_ [private] |
Definition at line 273 of file IpTNLPAdapter.hpp.
SmartPtr<const VectorSpace> Ipopt::TNLPAdapter::c_space_ [private] |
Definition at line 274 of file IpTNLPAdapter.hpp.
SmartPtr<const VectorSpace> Ipopt::TNLPAdapter::d_space_ [private] |
Definition at line 275 of file IpTNLPAdapter.hpp.
SmartPtr<const VectorSpace> Ipopt::TNLPAdapter::x_l_space_ [private] |
Definition at line 276 of file IpTNLPAdapter.hpp.
SmartPtr<const MatrixSpace> Ipopt::TNLPAdapter::px_l_space_ [private] |
Definition at line 277 of file IpTNLPAdapter.hpp.
SmartPtr<const VectorSpace> Ipopt::TNLPAdapter::x_u_space_ [private] |
Definition at line 278 of file IpTNLPAdapter.hpp.
SmartPtr<const MatrixSpace> Ipopt::TNLPAdapter::px_u_space_ [private] |
Definition at line 279 of file IpTNLPAdapter.hpp.
SmartPtr<const VectorSpace> Ipopt::TNLPAdapter::d_l_space_ [private] |
Definition at line 280 of file IpTNLPAdapter.hpp.
SmartPtr<const MatrixSpace> Ipopt::TNLPAdapter::pd_l_space_ [private] |
Definition at line 281 of file IpTNLPAdapter.hpp.
SmartPtr<const VectorSpace> Ipopt::TNLPAdapter::d_u_space_ [private] |
Definition at line 282 of file IpTNLPAdapter.hpp.
SmartPtr<const MatrixSpace> Ipopt::TNLPAdapter::pd_u_space_ [private] |
Definition at line 283 of file IpTNLPAdapter.hpp.
SmartPtr<const MatrixSpace> Ipopt::TNLPAdapter::Jac_c_space_ [private] |
Definition at line 284 of file IpTNLPAdapter.hpp.
SmartPtr<const MatrixSpace> Ipopt::TNLPAdapter::Jac_d_space_ [private] |
Definition at line 285 of file IpTNLPAdapter.hpp.
SmartPtr<const SymMatrixSpace> Ipopt::TNLPAdapter::Hess_lagrangian_space_ [private] |
Definition at line 286 of file IpTNLPAdapter.hpp.
Number* Ipopt::TNLPAdapter::full_x_ [private] |
Definition at line 291 of file IpTNLPAdapter.hpp.
Number* Ipopt::TNLPAdapter::full_lambda_ [private] |
Number* Ipopt::TNLPAdapter::full_g_ [private] |
Number* Ipopt::TNLPAdapter::jac_g_ [private] |
Number* Ipopt::TNLPAdapter::c_rhs_ [private] |
Definition at line 300 of file IpTNLPAdapter.hpp.
Definition at line 301 of file IpTNLPAdapter.hpp.
Definition at line 302 of file IpTNLPAdapter.hpp.
Definition at line 303 of file IpTNLPAdapter.hpp.
Definition at line 304 of file IpTNLPAdapter.hpp.
SmartPtr<ExpansionMatrix> Ipopt::TNLPAdapter::P_x_x_L_ [private] |
SmartPtr<ExpansionMatrix> Ipopt::TNLPAdapter::P_x_x_U_ [private] |
SmartPtr<ExpansionMatrix> Ipopt::TNLPAdapter::P_c_g_ [private] |
SmartPtr<ExpansionMatrix> Ipopt::TNLPAdapter::P_d_g_ [private] |
Index* Ipopt::TNLPAdapter::jac_idx_map_ [private] |
Index* Ipopt::TNLPAdapter::h_idx_map_ [private] |
Index* Ipopt::TNLPAdapter::x_fixed_map_ [private] |
Position of fixed variables.
This is required for a warm start
Definition at line 347 of file IpTNLPAdapter.hpp.