Ampl MINLP Interface. More...
#include <BonAmplTMINLP.hpp>
Public Member Functions | |
const ASL_pfgh * | AmplSolverObject () const |
Return the ampl solver object (ASL*) More... | |
virtual const BranchingInfo * | branchingInfo () const |
virtual const SosInfo * | sosConstraints () const |
virtual const PerturbInfo * | perturbInfo () const |
virtual void | getLinearPartOfObjective (double *obj) |
This methods gives the linear part of the objective function. More... | |
virtual bool | hasUpperBoundingObjective () |
Do we have an alternate objective for upper bounding? More... | |
virtual bool | eval_upper_bound_f (Ipopt::Index n, const Ipopt::Number *x, Ipopt::Number &obj_value) |
This method to returns the value of an alternative objective function for upper bounding (if one has been declared by using the prefix UBObj). More... | |
virtual bool | get_constraint_convexities (int m, TMINLP::Convexity *constraints_convexities) const |
Get accest to constraint convexities. More... | |
virtual bool | get_number_nonconvex (int &number_non_conv, int &number_concave) const |
Get dimension information on nonconvex constraints. More... | |
virtual bool | get_constraint_convexities (int number_non_conv, MarkedNonConvex *non_convexes) const |
Get array describing the constraints marked nonconvex in the model. More... | |
virtual bool | get_simple_concave_constraints (int number_concave, SimpleConcaveConstraint *simple_concave) const |
Fill array containing indices of simple concave constraints. More... | |
virtual bool | hasLinearObjective () |
Say if problem has a linear objective (for OA) More... | |
virtual const int * | get_const_xtra_id () const |
Access array describing onoff constraint. More... | |
Constructors/Destructors | |
AmplTMINLP (const Ipopt::SmartPtr< const Ipopt::Journalist > &jnlst, const Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions, const Ipopt::SmartPtr< Ipopt::OptionsList > options, char **&argv, Ipopt::AmplSuffixHandler *suffix_handler=NULL, const std::string &appName="bonmin", std::string *nl_file_content=NULL) | |
Constructor. More... | |
virtual void | Initialize (const Ipopt::SmartPtr< const Ipopt::Journalist > &jnlst, const Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions, const Ipopt::SmartPtr< Ipopt::OptionsList > options, char **&argv, Ipopt::AmplSuffixHandler *suffix_handler=NULL, const std::string &appName="bonmin", std::string *nl_file_content=NULL) |
Constructor. More... | |
void | read_priorities () |
read the branching priorities from ampl suffixes. More... | |
void | read_sos () |
read the sos constraints from ampl suffixes More... | |
void | read_convexities () |
Read suffixes which indicate which constraints are convex. More... | |
void | read_onoff () |
Read suffixes used to apply perspective in OA to some of the constraints. More... | |
void | read_obj_suffixes () |
Read suffixes on objective functions for upper bounding. More... | |
AmplTMINLP () | |
Default constructor. More... | |
virtual AmplTMINLP * | createEmpty () |
Constructor. More... | |
virtual | ~AmplTMINLP () |
destructor More... | |
methods to gather information about the NLP. These | |
virtual bool | get_nlp_info (Ipopt::Index &n, Ipopt::Index &m, Ipopt::Index &nnz_jac_g, Ipopt::Index &nnz_h_lag, Ipopt::TNLP::IndexStyleEnum &index_style) |
returns dimensions of the nlp. More... | |
virtual bool | get_variables_types (Ipopt::Index n, VariableType *var_types) |
returns the vector of variable types More... | |
virtual bool | get_variables_linearity (Ipopt::Index n, Ipopt::TNLP::LinearityType *var_types) |
return the variables linearity (linear or not) More... | |
virtual bool | get_constraints_linearity (Ipopt::Index m, Ipopt::TNLP::LinearityType *const_types) |
Returns the constraint linearity. More... | |
virtual bool | get_bounds_info (Ipopt::Index n, Ipopt::Number *x_l, Ipopt::Number *x_u, Ipopt::Index m, Ipopt::Number *g_l, Ipopt::Number *g_u) |
returns bounds of the nlp. More... | |
virtual bool | get_starting_point (Ipopt::Index n, bool init_x, Ipopt::Number *x, bool init_z, Ipopt::Number *z_L, Ipopt::Number *z_U, Ipopt::Index m, bool init_lambda, Ipopt::Number *lambda) |
provides a starting point for the nlp variables. More... | |
virtual bool | eval_f (Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Number &obj_value) |
evaluates the objective value for the nlp. More... | |
virtual bool | eval_grad_f (Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Number *grad_f) |
evaluates the gradient of the objective for the nlp. More... | |
virtual bool | eval_g (Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Index m, Ipopt::Number *g) |
evaluates the constraint residuals for the nlp. More... | |
virtual bool | eval_jac_g (Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Index m, Ipopt::Index nele_jac, Ipopt::Index *iRow, Ipopt::Index *jCol, Ipopt::Number *values) |
specifies the jacobian structure (if values is NULL) and evaluates the jacobian values (if values is not NULL) for the nlp. More... | |
virtual bool | eval_h (Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Number obj_factor, Ipopt::Index m, const Ipopt::Number *lambda, bool new_lambda, Ipopt::Index nele_hess, Ipopt::Index *iRow, Ipopt::Index *jCol, Ipopt::Number *values) |
specifies the structure of the hessian of the lagrangian (if values is NULL) and evaluates the values (if values is not NULL). More... | |
virtual bool | eval_gi (Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Index i, Ipopt::Number &gi) |
compute the value of a single constraint More... | |
virtual bool | eval_grad_gi (Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Index i, Ipopt::Index &nele_grad_gi, Ipopt::Index *jCol, Ipopt::Number *values) |
compute the structure or values of the gradient for one constraint More... | |
Solution Methods | |
virtual void | finalize_solution (TMINLP::SolverReturn status, Ipopt::Index n, const Ipopt::Number *x, Ipopt::Number obj_value) |
Called after optimizing to return results to ampl. More... | |
void | write_solution (const std::string &message, const Ipopt::Number *x_sol) |
Write the solution using ampl's write_sol (called by finalize_solution). More... | |
User callbacks | |
virtual void | fillApplicationOptions (Ipopt::AmplOptionsList *amplOptList) |
Additional application specific options. More... | |
![]() | |
bool | hasGeneralInteger () |
Say if problem has general integer variables. More... | |
TMINLP () | |
Default destructor. More... | |
virtual | ~TMINLP () |
Default destructor. More... | |
virtual bool | get_scaling_parameters (Ipopt::Number &obj_scaling, bool &use_x_scaling, Ipopt::Index n, Ipopt::Number *x_scaling, bool &use_g_scaling, Ipopt::Index m, Ipopt::Number *g_scaling) |
overload this method to return scaling parameters. More... | |
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. | |
AmplTMINLP (const AmplTMINLP &) | |
Copy Constructor. More... | |
void | operator= (const AmplTMINLP &) |
Overloaded Equals Operator. More... | |
Private Attributes | |
std::string | appName_ |
Name of application. More... | |
int | upperBoundingObj_ |
Index of the objective to use for upper bounding. More... | |
Ipopt::AmplTNLP * | ampl_tnlp_ |
pointer to the internal AmplTNLP More... | |
Ipopt::SmartPtr< const Ipopt::Journalist > | jnlst_ |
Journalist. More... | |
BranchingInfo | branch_ |
Storage of branching priorities information. More... | |
SosInfo | sos_ |
Storage of sos constraints. More... | |
PerturbInfo | perturb_info_ |
Storage for perturbation radii. More... | |
Ipopt::SmartPtr < Ipopt::AmplSuffixHandler > | suffix_handler_ |
Store a suffix handler. More... | |
TMINLP::Convexity * | constraintsConvexities_ |
Store constraints types. More... | |
vector< int > | c_extra_id_ |
Store onoff information. More... | |
int | numberNonConvex_ |
Ipopt::Number of nonConvex constraints. More... | |
MarkedNonConvex * | nonConvexConstraintsAndRelaxations_ |
Store marked non-convex constraints and their relaxations. More... | |
int | numberSimpleConcave_ |
Ipopt::Number of simpleConcave constraints. More... | |
SimpleConcaveConstraint * | simpleConcaves_ |
Store simple concave constraints descriptions. More... | |
bool | hasLinearObjective_ |
Flag to indicate if objective function is linear. More... | |
int | writeAmplSolFile_ |
Flag to say if AMPL solution file should be written. More... | |
Additional Inherited Members | |
![]() | |
enum | SolverReturn { SUCCESS, INFEASIBLE, CONTINUOUS_UNBOUNDED, LIMIT_EXCEEDED, USER_INTERRUPT, MINLP_ERROR } |
Return statuses of algorithm. More... | |
enum | VariableType { CONTINUOUS, BINARY, INTEGER } |
Type of the variables. More... | |
enum | Convexity { Convex, NonConvex, SimpleConcave } |
Used to mark constraints of the problem. More... | |
![]() | |
TMINLP (const TMINLP &) | |
Copy constructor. More... | |
void | operator= (const TMINLP &) |
Overloaded Equals Operator. More... | |
Ampl MINLP Interface.
Ampl MINLP Interface, implemented as a TMINLP. This interface creates a AmplTNLP and also retrieves the information about the binary and integer variables
Definition at line 46 of file BonAmplTMINLP.hpp.
Bonmin::AmplTMINLP::AmplTMINLP | ( | const Ipopt::SmartPtr< const Ipopt::Journalist > & | jnlst, |
const Ipopt::SmartPtr< Bonmin::RegisteredOptions > | roptions, | ||
const Ipopt::SmartPtr< Ipopt::OptionsList > | options, | ||
char **& | argv, | ||
Ipopt::AmplSuffixHandler * | suffix_handler = NULL , |
||
const std::string & | appName = "bonmin" , |
||
std::string * | nl_file_content = NULL |
||
) |
Constructor.
Bonmin::AmplTMINLP::AmplTMINLP | ( | ) |
Default constructor.
Definition at line 66 of file BonAmplTMINLP.cpp.
|
virtual |
destructor
Definition at line 207 of file BonAmplTMINLP.cpp.
|
private |
Copy Constructor.
|
virtual |
Constructor.
Definition at line 111 of file BonAmplTMINLP.cpp.
void Bonmin::AmplTMINLP::read_priorities | ( | ) |
read the branching priorities from ampl suffixes.
Definition at line 216 of file BonAmplTMINLP.cpp.
void Bonmin::AmplTMINLP::read_sos | ( | ) |
read the sos constraints from ampl suffixes
Definition at line 257 of file BonAmplTMINLP.cpp.
void Bonmin::AmplTMINLP::read_convexities | ( | ) |
Read suffixes which indicate which constraints are convex.
Definition at line 352 of file BonAmplTMINLP.cpp.
void Bonmin::AmplTMINLP::read_onoff | ( | ) |
Read suffixes used to apply perspective in OA to some of the constraints.
Definition at line 429 of file BonAmplTMINLP.cpp.
void Bonmin::AmplTMINLP::read_obj_suffixes | ( | ) |
Read suffixes on objective functions for upper bounding.
Definition at line 300 of file BonAmplTMINLP.cpp.
|
inlinevirtual |
Constructor.
Definition at line 86 of file BonAmplTMINLP.hpp.
const ASL_pfgh * Bonmin::AmplTMINLP::AmplSolverObject | ( | ) | const |
Return the ampl solver object (ASL*)
Definition at line 860 of file BonAmplTMINLP.cpp.
|
virtual |
returns dimensions of the nlp.
Overloaded from TMINLP
Implements Bonmin::TMINLP.
Definition at line 469 of file BonAmplTMINLP.cpp.
|
virtual |
returns the vector of variable types
Implements Bonmin::TMINLP.
Definition at line 474 of file BonAmplTMINLP.cpp.
|
virtual |
return the variables linearity (linear or not)
Implements Bonmin::TMINLP.
Definition at line 567 of file BonAmplTMINLP.cpp.
|
virtual |
Returns the constraint linearity.
array should be alocated with length at least n.
Implements Bonmin::TMINLP.
Definition at line 609 of file BonAmplTMINLP.cpp.
|
virtual |
returns bounds of the nlp.
Overloaded from TMINLP
Implements Bonmin::TMINLP.
Definition at line 615 of file BonAmplTMINLP.cpp.
|
virtual |
provides a starting point for the nlp variables.
Overloaded from TMINLP
Implements Bonmin::TMINLP.
Definition at line 621 of file BonAmplTMINLP.cpp.
|
virtual |
evaluates the objective value for the nlp.
Overloaded from TMINLP
Implements Bonmin::TMINLP.
Definition at line 630 of file BonAmplTMINLP.cpp.
|
virtual |
evaluates the gradient of the objective for the
nlp.
Overloaded from TMINLP
Implements Bonmin::TMINLP.
Definition at line 635 of file BonAmplTMINLP.cpp.
|
virtual |
evaluates the constraint residuals for the nlp.
Overloaded from TMINLP
Implements Bonmin::TMINLP.
Definition at line 640 of file BonAmplTMINLP.cpp.
|
virtual |
specifies the jacobian structure (if values is NULL) and evaluates the jacobian values (if values is not NULL) for the nlp.
Overloaded from TMINLP
Implements Bonmin::TMINLP.
Definition at line 645 of file BonAmplTMINLP.cpp.
|
virtual |
specifies the structure of the hessian of the lagrangian (if values is NULL) and evaluates the values (if values is not NULL).
Overloaded from TMINLP
Implements Bonmin::TMINLP.
Definition at line 654 of file BonAmplTMINLP.cpp.
|
virtual |
compute the value of a single constraint
Reimplemented from Bonmin::TMINLP.
Definition at line 664 of file BonAmplTMINLP.cpp.
|
virtual |
compute the structure or values of the gradient for one
constraint
Reimplemented from Bonmin::TMINLP.
Definition at line 682 of file BonAmplTMINLP.cpp.
|
virtual |
Called after optimizing to return results to ampl.
Status code is put into solve_result_num according to the table below.
| |
3 | Integer optimal |
220 | problem is proven infeasible. |
421 | limit reached or user interrupt with integer feasible solution found. |
410 | limit reached or user interrupt without any integer feasible solution. |
500 | error. Status codes for optimization. |
Implements Bonmin::TMINLP.
Definition at line 713 of file BonAmplTMINLP.cpp.
void Bonmin::AmplTMINLP::write_solution | ( | const std::string & | message, |
const Ipopt::Number * | x_sol | ||
) |
Write the solution using ampl's write_sol (called by finalize_solution).
Definition at line 770 of file BonAmplTMINLP.cpp.
|
inlinevirtual |
Implements Bonmin::TMINLP.
Definition at line 192 of file BonAmplTMINLP.hpp.
|
inlinevirtual |
Implements Bonmin::TMINLP.
Definition at line 197 of file BonAmplTMINLP.hpp.
|
inlinevirtual |
Reimplemented from Bonmin::TMINLP.
Definition at line 202 of file BonAmplTMINLP.hpp.
|
inlinevirtual |
Additional application specific options.
Definition at line 210 of file BonAmplTMINLP.hpp.
|
virtual |
This methods gives the linear part of the objective function.
Definition at line 799 of file BonAmplTMINLP.cpp.
|
inlinevirtual |
Do we have an alternate objective for upper bounding?
Reimplemented from Bonmin::TMINLP.
Definition at line 220 of file BonAmplTMINLP.hpp.
|
virtual |
This method to returns the value of an alternative objective function for upper bounding (if one has been declared by using the prefix UBObj).
This method to returns the value of an alternative objective function for
upper bounding (if one has been declared by using the prefix UBObj).
Reimplemented from Bonmin::TMINLP.
Definition at line 843 of file BonAmplTMINLP.cpp.
|
inlinevirtual |
Get accest to constraint convexities.
Reimplemented from Bonmin::TMINLP.
Definition at line 231 of file BonAmplTMINLP.hpp.
|
inlinevirtual |
Get dimension information on nonconvex constraints.
Reimplemented from Bonmin::TMINLP.
Definition at line 242 of file BonAmplTMINLP.hpp.
|
inlinevirtual |
Get array describing the constraints marked nonconvex in the model.
Reimplemented from Bonmin::TMINLP.
Definition at line 249 of file BonAmplTMINLP.hpp.
|
inlinevirtual |
Fill array containing indices of simple concave constraints.
Reimplemented from Bonmin::TMINLP.
Definition at line 256 of file BonAmplTMINLP.hpp.
|
inlinevirtual |
Say if problem has a linear objective (for OA)
Reimplemented from Bonmin::TMINLP.
Definition at line 264 of file BonAmplTMINLP.hpp.
|
inlinevirtual |
Access array describing onoff constraint.
Reimplemented from Bonmin::TMINLP.
Definition at line 270 of file BonAmplTMINLP.hpp.
|
private |
Overloaded Equals Operator.
|
private |
Name of application.
Definition at line 290 of file BonAmplTMINLP.hpp.
|
private |
Index of the objective to use for upper bounding.
Definition at line 293 of file BonAmplTMINLP.hpp.
|
private |
pointer to the internal AmplTNLP
Definition at line 295 of file BonAmplTMINLP.hpp.
|
private |
Journalist.
Definition at line 297 of file BonAmplTMINLP.hpp.
|
private |
Storage of branching priorities information.
Definition at line 300 of file BonAmplTMINLP.hpp.
|
private |
Storage of sos constraints.
Definition at line 302 of file BonAmplTMINLP.hpp.
|
private |
Storage for perturbation radii.
Definition at line 304 of file BonAmplTMINLP.hpp.
|
private |
Store a suffix handler.
Definition at line 306 of file BonAmplTMINLP.hpp.
|
private |
Store constraints types.
Definition at line 309 of file BonAmplTMINLP.hpp.
Store onoff information.
Definition at line 312 of file BonAmplTMINLP.hpp.
|
private |
Ipopt::Number of nonConvex constraints.
Definition at line 315 of file BonAmplTMINLP.hpp.
|
private |
Store marked non-convex constraints and their relaxations.
Definition at line 317 of file BonAmplTMINLP.hpp.
|
private |
Ipopt::Number of simpleConcave constraints.
Definition at line 319 of file BonAmplTMINLP.hpp.
|
private |
Store simple concave constraints descriptions.
Definition at line 321 of file BonAmplTMINLP.hpp.
|
private |
Flag to indicate if objective function is linear.
Definition at line 324 of file BonAmplTMINLP.hpp.
|
private |
Flag to say if AMPL solution file should be written.
Definition at line 327 of file BonAmplTMINLP.hpp.