#include <TMINLP2TNLP.hpp>
Inheritance diagram for Ipopt::TMINLP2TNLP:
Public Member Functions | |
void | copyUserModification (TMINLP2TNLP &other) |
Copies the modification made to TNLP by the user (modifications such as changing bound changing starting point,. | |
DECLARE_STD_EXCEPTION (TMINLP_INVALID_VARIABLE_BOUNDS) | |
void | outputDiffs (const std::string &probName, const std::string *varNames) |
Procedure to ouptut relevant informations to reproduce a sub-problem. | |
bool | checkZeroDimension (ApplicationReturnStatus &optimization_status) |
Method called to check wether a problem has still some variable not fixed. | |
Constructors/Destructors | |
TMINLP2TNLP (const SmartPtr< TMINLP > tminlp, const OptionsList &options) | |
virtual | ~TMINLP2TNLP () |
Default destructor. | |
Methods to modify the MINLP and form the NLP | |
Index | num_variables () |
Get the number of variables. | |
Index | num_constraints () |
Get the number of constraints. | |
Index | nnz_h_lag () |
Get the nomber of nz in hessian. | |
const TMINLP::VariableType * | var_types () |
Get the variable types. | |
void | printVarTypes () |
Get the number of variables. | |
const Number * | x_l () |
Get the current values for the lower bounds. | |
const Number * | x_u () |
Get the current values for the upper bounds. | |
const Number * | orig_x_l () const |
Get the original values for the lower bounds. | |
const Number * | orig_x_u () const |
Get the original values for the upper bounds. | |
const Number * | g_l () |
Get the current values for constraints lower bounds. | |
const Number * | g_u () |
Get the current values for constraints upper bounds. | |
const Number * | x_init () const |
get the starting primal point | |
const Number * | duals_init () const |
get the starting dual point | |
const Number * | x_sol () const |
get the solution values | |
const Number * | g_sol () const |
get the g solution (activities) | |
const Number * | duals_sol () const |
get the dual values | |
SolverReturn | optimization_status () |
Get Optimization status. | |
Number | obj_value () |
Get the objective value. | |
void | set_obj_value (Number value) |
Manually set objective value. | |
void | force_fractionnal_sol () |
force solution to be fractionnal. | |
void | SetVariableBounds (Index var_no, Number x_l, Number x_u) |
Change the bounds on the variable. | |
void | SetVariableLowerBound (Index var_no, Number x_l) |
Change the lower bound on the variable. | |
void | SetVariableUpperBound (Index var_no, Number x_u) |
Change the upper bound on the variable. | |
void | SetStartingPoint (Index n, const Number *x_init) |
Change the starting point. | |
void | resetStartingPoint () |
reset the starting point to original one. | |
void | setxInit (Index ind, const Number val) |
Set component ind of the starting point. | |
void | setxInit (Index n, const Number *x_init) |
set the starting point to x_init | |
void | setDualInit (Index ind, const Number val) |
Set component ind of the dual starting point. | |
void | setDualsInit (Index n, const Number *duals_init) |
set the dual starting point to duals_init | |
void | Set_x_sol (Index n, const Number *x_sol) |
Set the contiuous solution. | |
void | SetVariableType (Index n, TMINLP::VariableType type) |
Change the type of the variable. | |
methods to gather information about the NLP | |
virtual bool | get_nlp_info (Index &n, Index &m, Index &nnz_jac_g, Index &nnz_h_lag, TNLP::IndexStyleEnum &index_style) |
This call is just passed onto the TMINLP object. | |
virtual bool | get_bounds_info (Index n, Number *x_l, Number *x_u, Index m, Number *g_l, Number *g_u) |
The caller is allowed to modify the bounds, so this method returns the internal bounds information. | |
virtual bool | get_starting_point (Index n, bool init_x, Number *x, bool init_z, Number *z_L, Number *z_U, Index m, bool init_lambda, Number *lambda) |
Method called by Ipopt to get the starting point. | |
virtual bool | get_warm_start_iterate (IteratesVector &warm_start_iterate) |
Methat that returns an Ipopt IteratesVector that has the starting point for all internal varibles. | |
virtual bool | eval_f (Index n, const Number *x, bool new_x, Number &obj_value) |
Returns the value of the objective function in x. | |
virtual bool | eval_grad_f (Index n, const Number *x, bool new_x, Number *grad_f) |
Returns the vector of the gradient of the objective w.r.t. | |
virtual bool | eval_g (Index n, const Number *x, bool new_x, Index m, Number *g) |
Returns the vector of constraint values in x. | |
virtual bool | eval_jac_g (Index n, const Number *x, bool new_x, Index m, Index nele_jac, Index *iRow, Index *jCol, Number *values) |
Returns the jacobian of the constraints. | |
virtual bool | eval_h (Index n, const Number *x, bool new_x, Number obj_factor, Index m, const Number *lambda, bool new_lambda, Index nele_hess, Index *iRow, Index *jCol, Number *values) |
Return the hessian of the lagrangian. | |
Solution Methods | |
virtual void | finalize_solution (SolverReturn status, Index n, const Number *x, const Number *z_L, const Number *z_U, Index m, const Number *g, const Number *lambda, Number obj_value) |
This method is called when the algorithm is complete so the TNLP can store/write the solution. | |
virtual bool | intermediate_callback (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) |
Intermediate Callback method for the user. | |
Methods for setting and getting the warm starter | |
void | SetWarmStarter (SmartPtr< IpoptInteriorWarmStarter > warm_starter) |
SmartPtr< IpoptInteriorWarmStarter > | GetWarmStarter () |
Protected Member Functions | |
void | throw_exception_on_bad_variable_bound (Index i) |
Private method that throws an exception if the variable bounds are not consistent with the variable type. | |
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. | |
TMINLP2TNLP () | |
Default Constructor. | |
TMINLP2TNLP (const TMINLP2TNLP &) | |
Copy Constructor. | |
void | operator= (const TMINLP2TNLP &) |
Overloaded Equals Operator. | |
Protected Attributes | |
SmartPtr< TMINLP > | tminlp_ |
pointer to the tminlp that is being adapted | |
Internal copies of data allowing caller to modify the MINLP | |
Index | n_ |
Number of variables. | |
Index | m_ |
Number of constraints. | |
Index | nnz_h_lag_ |
Number of non-zeroes in the lagrangian. | |
TNLP::IndexStyleEnum | index_style_ |
index style (fortran or C) | |
TMINLP::VariableType * | var_types_ |
Types of the variable (TMINLP::CONTINUOUS, TMINLP::INTEGER, TMINLP::BINARY). | |
Number * | x_l_ |
Current lower bounds on variables. | |
Number * | x_u_ |
Current upper bounds on variables. | |
Number * | orig_x_l_ |
Original lower bounds on variables. | |
Number * | orig_x_u_ |
Original upper bounds on variables. | |
Number * | g_l_ |
Lower bounds on constraints values. | |
Number * | g_u_ |
Upper bounds on constraints values. | |
Number * | x_init_ |
Initial primal point. | |
Number * | duals_init_ |
Initial values for all dual multipliers (constraints then lower bounds then upper bounds). | |
Number * | x_init_user_ |
User-provideed initial prmal point. | |
Number * | x_sol_ |
Optimal solution. | |
Number * | g_sol_ |
Activities of constraint g( x_sol_). | |
Number * | duals_sol_ |
Dual multipliers of constraints and bounds. | |
SolverReturn | return_status_ |
Return status of the optimization process. | |
Number | obj_value_ |
Value of the optimal solution found by Ipopt. | |
Warmstart object and related data | |
SmartPtr< IpoptInteriorWarmStarter > | curr_warm_starter_ |
Pointer to object that holds warmstart information. | |
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. | |
bool | warm_start_entire_iterate_ |
Option from Ipopt - we currently use it to see if we want to use some clever warm start or just the last iterate from the previous run. | |
bool | need_new_warm_starter_ |
Do we need a new warm starter object. |
It allows an external caller to modify the bounds of variables, allowing the treatment of binary and integer variables as relaxed, or fixed
Definition at line 30 of file TMINLP2TNLP.hpp.
Ipopt::TMINLP2TNLP::TMINLP2TNLP | ( | const SmartPtr< TMINLP > | tminlp, | |
const OptionsList & | options | |||
) |
virtual Ipopt::TMINLP2TNLP::~TMINLP2TNLP | ( | ) | [virtual] |
Default destructor.
Ipopt::TMINLP2TNLP::TMINLP2TNLP | ( | ) | [protected] |
Default Constructor.
Ipopt::TMINLP2TNLP::TMINLP2TNLP | ( | const TMINLP2TNLP & | ) | [protected] |
Copy Constructor.
void Ipopt::TMINLP2TNLP::copyUserModification | ( | TMINLP2TNLP & | other | ) |
Copies the modification made to TNLP by the user (modifications such as changing bound changing starting point,.
..). this and other should be two instances of the same problem I am trying to mimic a copy construction for Cbc use with great care not safe.
Ipopt::TMINLP2TNLP::DECLARE_STD_EXCEPTION | ( | TMINLP_INVALID_VARIABLE_BOUNDS | ) |
Index Ipopt::TMINLP2TNLP::num_variables | ( | ) | [inline] |
Index Ipopt::TMINLP2TNLP::num_constraints | ( | ) | [inline] |
Index Ipopt::TMINLP2TNLP::nnz_h_lag | ( | ) | [inline] |
Get the nomber of nz in hessian.
Definition at line 68 of file TMINLP2TNLP.hpp.
References nnz_h_lag_.
const TMINLP::VariableType* Ipopt::TMINLP2TNLP::var_types | ( | ) | [inline] |
void Ipopt::TMINLP2TNLP::printVarTypes | ( | ) | [inline] |
const Number* Ipopt::TMINLP2TNLP::x_l | ( | ) | [inline] |
Get the current values for the lower bounds.
Definition at line 88 of file TMINLP2TNLP.hpp.
References x_l_.
const Number* Ipopt::TMINLP2TNLP::x_u | ( | ) | [inline] |
Get the current values for the upper bounds.
Definition at line 93 of file TMINLP2TNLP.hpp.
References x_u_.
const Number* Ipopt::TMINLP2TNLP::orig_x_l | ( | ) | const [inline] |
Get the original values for the lower bounds.
Definition at line 99 of file TMINLP2TNLP.hpp.
References orig_x_l_.
const Number* Ipopt::TMINLP2TNLP::orig_x_u | ( | ) | const [inline] |
Get the original values for the upper bounds.
Definition at line 104 of file TMINLP2TNLP.hpp.
References orig_x_u_.
const Number* Ipopt::TMINLP2TNLP::g_l | ( | ) | [inline] |
Get the current values for constraints lower bounds.
Definition at line 110 of file TMINLP2TNLP.hpp.
References g_l_.
const Number* Ipopt::TMINLP2TNLP::g_u | ( | ) | [inline] |
Get the current values for constraints upper bounds.
Definition at line 115 of file TMINLP2TNLP.hpp.
References g_u_.
const Number* Ipopt::TMINLP2TNLP::x_init | ( | ) | const [inline] |
const Number* Ipopt::TMINLP2TNLP::duals_init | ( | ) | const [inline] |
const Number* Ipopt::TMINLP2TNLP::x_sol | ( | ) | const [inline] |
const Number* Ipopt::TMINLP2TNLP::g_sol | ( | ) | const [inline] |
const Number* Ipopt::TMINLP2TNLP::duals_sol | ( | ) | const [inline] |
SolverReturn Ipopt::TMINLP2TNLP::optimization_status | ( | ) | [inline] |
Number Ipopt::TMINLP2TNLP::obj_value | ( | ) | [inline] |
void Ipopt::TMINLP2TNLP::set_obj_value | ( | Number | value | ) | [inline] |
Manually set objective value.
Definition at line 163 of file TMINLP2TNLP.hpp.
References obj_value_.
void Ipopt::TMINLP2TNLP::force_fractionnal_sol | ( | ) |
force solution to be fractionnal.
Change the bounds on the variable.
Change the lower bound on the variable.
Change the upper bound on the variable.
Change the starting point.
void Ipopt::TMINLP2TNLP::resetStartingPoint | ( | ) |
reset the starting point to original one.
Set component ind of the starting point.
set the starting point to x_init
Set component ind of the dual starting point.
set the dual starting point to duals_init
void Ipopt::TMINLP2TNLP::SetVariableType | ( | Index | n, | |
TMINLP::VariableType | type | |||
) |
Change the type of the variable.
void Ipopt::TMINLP2TNLP::outputDiffs | ( | const std::string & | probName, | |
const std::string * | varNames | |||
) |
Procedure to ouptut relevant informations to reproduce a sub-problem.
Compare the current problem to the problem to solve and writes files with bounds which have changed and current starting point.
virtual bool Ipopt::TMINLP2TNLP::get_nlp_info | ( | Index & | n, | |
Index & | m, | |||
Index & | nnz_jac_g, | |||
Index & | nnz_h_lag, | |||
TNLP::IndexStyleEnum & | index_style | |||
) | [virtual] |
virtual bool Ipopt::TMINLP2TNLP::get_bounds_info | ( | Index | n, | |
Number * | x_l, | |||
Number * | x_u, | |||
Index | m, | |||
Number * | g_l, | |||
Number * | g_u | |||
) | [virtual] |
The caller is allowed to modify the bounds, so this method returns the internal bounds information.
Implements Ipopt::TNLP.
virtual bool Ipopt::TMINLP2TNLP::get_starting_point | ( | Index | n, | |
bool | init_x, | |||
Number * | x, | |||
bool | init_z, | |||
Number * | z_L, | |||
Number * | z_U, | |||
Index | m, | |||
bool | init_lambda, | |||
Number * | lambda | |||
) | [virtual] |
Method called by Ipopt to get the starting point.
The bools init_x and init_lambda are both inputs and outputs. As inputs, they indicate whether or not the algorithm wants you to initialize x and lambda respectively. If, for some reason, the algorithm wants you to initialize these and you cannot, set the respective bool to false.
Implements Ipopt::TNLP.
virtual bool Ipopt::TMINLP2TNLP::get_warm_start_iterate | ( | IteratesVector & | warm_start_iterate | ) | [virtual] |
Methat that returns an Ipopt IteratesVector that has the starting point for all internal varibles.
Reimplemented from Ipopt::TNLP.
virtual bool Ipopt::TMINLP2TNLP::eval_jac_g | ( | Index | n, | |
const Number * | x, | |||
bool | new_x, | |||
Index | m, | |||
Index | nele_jac, | |||
Index * | iRow, | |||
Index * | jCol, | |||
Number * | values | |||
) | [virtual] |
Returns the jacobian of the constraints.
The vectors iRow and jCol only need to be set once. The first call is used to set the structure only (iRow and jCol will be non-NULL, and values will be NULL) For subsequent calls, iRow and jCol will be NULL.
Implements Ipopt::TNLP.
virtual bool Ipopt::TMINLP2TNLP::eval_h | ( | Index | n, | |
const Number * | x, | |||
bool | new_x, | |||
Number | obj_factor, | |||
Index | m, | |||
const Number * | lambda, | |||
bool | new_lambda, | |||
Index | nele_hess, | |||
Index * | iRow, | |||
Index * | jCol, | |||
Number * | values | |||
) | [virtual] |
Return the hessian of the lagrangian.
The vectors iRow and jCol only need to be set once (during the first call). The first call is used to set the structure only (iRow and jCol will be non-NULL, and values will be NULL) For subsequent calls, iRow and jCol will be NULL. This matrix is symmetric - specify the lower diagonal only
Reimplemented from Ipopt::TNLP.
virtual void Ipopt::TMINLP2TNLP::finalize_solution | ( | SolverReturn | status, | |
Index | n, | |||
const Number * | x, | |||
const Number * | z_L, | |||
const Number * | z_U, | |||
Index | m, | |||
const Number * | g, | |||
const Number * | lambda, | |||
Number | obj_value | |||
) | [virtual] |
This method is called when the algorithm is complete so the TNLP can store/write the solution.
Implements Ipopt::TNLP.
virtual bool Ipopt::TMINLP2TNLP::intermediate_callback | ( | 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] |
Intermediate Callback method for the user.
Providing dummy default implementation. For details see IntermediateCallBack in IpNLP.hpp.
Reimplemented from Ipopt::TNLP.
bool Ipopt::TMINLP2TNLP::checkZeroDimension | ( | ApplicationReturnStatus & | optimization_status | ) |
Method called to check wether a problem has still some variable not fixed.
If there are no more unfixed vars, checks wether the solution given by the bounds is feasible.
void Ipopt::TMINLP2TNLP::SetWarmStarter | ( | SmartPtr< IpoptInteriorWarmStarter > | warm_starter | ) | [inline] |
SmartPtr<IpoptInteriorWarmStarter> Ipopt::TMINLP2TNLP::GetWarmStarter | ( | ) | [inline] |
void Ipopt::TMINLP2TNLP::operator= | ( | const TMINLP2TNLP & | ) | [protected] |
Overloaded Equals Operator.
void Ipopt::TMINLP2TNLP::throw_exception_on_bad_variable_bound | ( | Index | i | ) | [protected] |
Private method that throws an exception if the variable bounds are not consistent with the variable type.
SmartPtr<TMINLP> Ipopt::TMINLP2TNLP::tminlp_ [protected] |
Index Ipopt::TMINLP2TNLP::n_ [protected] |
Index Ipopt::TMINLP2TNLP::m_ [protected] |
Number of constraints.
Definition at line 338 of file TMINLP2TNLP.hpp.
Referenced by num_constraints().
Index Ipopt::TMINLP2TNLP::nnz_h_lag_ [protected] |
Number of non-zeroes in the lagrangian.
Definition at line 340 of file TMINLP2TNLP.hpp.
Referenced by nnz_h_lag().
TNLP::IndexStyleEnum Ipopt::TMINLP2TNLP::index_style_ [protected] |
TMINLP::VariableType* Ipopt::TMINLP2TNLP::var_types_ [protected] |
Types of the variable (TMINLP::CONTINUOUS, TMINLP::INTEGER, TMINLP::BINARY).
Definition at line 344 of file TMINLP2TNLP.hpp.
Referenced by var_types().
Number* Ipopt::TMINLP2TNLP::x_l_ [protected] |
Current lower bounds on variables.
Definition at line 346 of file TMINLP2TNLP.hpp.
Referenced by x_l().
Number* Ipopt::TMINLP2TNLP::x_u_ [protected] |
Current upper bounds on variables.
Definition at line 348 of file TMINLP2TNLP.hpp.
Referenced by x_u().
Number* Ipopt::TMINLP2TNLP::orig_x_l_ [protected] |
Original lower bounds on variables.
Definition at line 350 of file TMINLP2TNLP.hpp.
Referenced by orig_x_l().
Number* Ipopt::TMINLP2TNLP::orig_x_u_ [protected] |
Original upper bounds on variables.
Definition at line 352 of file TMINLP2TNLP.hpp.
Referenced by orig_x_u().
Number* Ipopt::TMINLP2TNLP::g_l_ [protected] |
Lower bounds on constraints values.
Definition at line 354 of file TMINLP2TNLP.hpp.
Referenced by g_l().
Number* Ipopt::TMINLP2TNLP::g_u_ [protected] |
Upper bounds on constraints values.
Definition at line 356 of file TMINLP2TNLP.hpp.
Referenced by g_u().
Number* Ipopt::TMINLP2TNLP::x_init_ [protected] |
Number* Ipopt::TMINLP2TNLP::duals_init_ [protected] |
Initial values for all dual multipliers (constraints then lower bounds then upper bounds).
Definition at line 360 of file TMINLP2TNLP.hpp.
Referenced by duals_init().
Number* Ipopt::TMINLP2TNLP::x_init_user_ [protected] |
Number* Ipopt::TMINLP2TNLP::x_sol_ [protected] |
Number* Ipopt::TMINLP2TNLP::g_sol_ [protected] |
Activities of constraint g( x_sol_).
Definition at line 366 of file TMINLP2TNLP.hpp.
Referenced by g_sol().
Number* Ipopt::TMINLP2TNLP::duals_sol_ [protected] |
Dual multipliers of constraints and bounds.
Definition at line 368 of file TMINLP2TNLP.hpp.
Referenced by duals_sol().
SolverReturn Ipopt::TMINLP2TNLP::return_status_ [protected] |
Return status of the optimization process.
Definition at line 371 of file TMINLP2TNLP.hpp.
Referenced by optimization_status().
Number Ipopt::TMINLP2TNLP::obj_value_ [protected] |
Value of the optimal solution found by Ipopt.
Definition at line 373 of file TMINLP2TNLP.hpp.
Referenced by obj_value(), and set_obj_value().
Pointer to object that holds warmstart information.
Definition at line 379 of file TMINLP2TNLP.hpp.
Referenced by GetWarmStarter(), and SetWarmStarter().
Number Ipopt::TMINLP2TNLP::nlp_lower_bound_inf_ [protected] |
Number Ipopt::TMINLP2TNLP::nlp_upper_bound_inf_ [protected] |
bool Ipopt::TMINLP2TNLP::warm_start_entire_iterate_ [protected] |
Option from Ipopt - we currently use it to see if we want to use some clever warm start or just the last iterate from the previous run.
Definition at line 387 of file TMINLP2TNLP.hpp.
bool Ipopt::TMINLP2TNLP::need_new_warm_starter_ [protected] |