Bonmin 1.4trunk
|
Ampl MINLP Interface. More...
#include <BonAmplTMINLP.hpp>
Public Member Functions | |
const ASL_pfgh * | AmplSolverObject () const |
Return the ampl solver object (ASL*) | |
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. | |
virtual bool | hasUpperBoundingObjective () |
Do we have an alternate objective for upper bounding? | |
virtual bool | eval_upper_bound_f (Index n, const Number *x, 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). | |
virtual bool | get_constraint_convexities (int m, TMINLP::Convexity *constraints_convexities) const |
Get accest to constraint convexities. | |
virtual bool | get_number_nonconvex (int &number_non_conv, int &number_concave) const |
Get dimension information on nonconvex constraints. | |
virtual bool | get_constraint_convexities (int number_non_conv, MarkedNonConvex *non_convexes) const |
Get array describing the constraints marked nonconvex in the model. | |
virtual bool | get_simple_concave_constraints (int number_concave, SimpleConcaveConstraint *simple_concave) const |
Fill array containing indices of simple concave constraints. | |
virtual bool | hasLinearObjective () |
Say if problem has a linear objective (for OA) | |
Constructors/Destructors | |
AmplTMINLP (const SmartPtr< const Journalist > &jnlst, const SmartPtr< Bonmin::RegisteredOptions > roptions, const SmartPtr< OptionsList > options, char **&argv, AmplSuffixHandler *suffix_handler=NULL, const std::string &appName="bonmin", std::string *nl_file_content=NULL) | |
Constructor. | |
virtual void | Initialize (const SmartPtr< const Journalist > &jnlst, const SmartPtr< Bonmin::RegisteredOptions > roptions, const SmartPtr< OptionsList > options, char **&argv, AmplSuffixHandler *suffix_handler=NULL, const std::string &appName="bonmin", std::string *nl_file_content=NULL) |
Constructor. | |
void | read_priorities () |
read the branching priorities from ampl suffixes. | |
void | read_sos () |
read the sos constraints from ampl suffixes | |
void | read_convexities () |
Read suffixes which indicate which constraints are convex. | |
void | read_obj_suffixes () |
Read suffixes on objective functions for upper bounding. | |
AmplTMINLP () | |
Default constructor. | |
virtual AmplTMINLP * | createEmpty () |
Constructor. | |
virtual | ~AmplTMINLP () |
destructor | |
methods to gather information about the NLP. These | |
virtual bool | get_nlp_info (Index &n, Index &m, Index &nnz_jac_g, Index &nnz_h_lag, TNLP::IndexStyleEnum &index_style) |
returns dimensions of the nlp. | |
virtual bool | get_variables_types (Index n, VariableType *var_types) |
returns the vector of variable types | |
virtual bool | get_variables_linearity (Index n, Ipopt::TNLP::LinearityType *var_types) |
return the variables linearity (linear or not) | |
virtual bool | get_constraints_linearity (Index m, Ipopt::TNLP::LinearityType *const_types) |
Returns the constraint linearity. | |
virtual bool | get_bounds_info (Index n, Number *x_l, Number *x_u, Index m, Number *g_l, Number *g_u) |
returns bounds of the nlp. | |
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) |
provides a starting point for the nlp variables. | |
virtual bool | eval_f (Index n, const Number *x, bool new_x, Number &obj_value) |
evaluates the objective value for the nlp. | |
virtual bool | eval_grad_f (Index n, const Number *x, bool new_x, Number *grad_f) |
evaluates the gradient of the objective for the nlp. | |
virtual bool | eval_g (Index n, const Number *x, bool new_x, Index m, Number *g) |
evaluates the constraint residuals for the nlp. | |
virtual bool | eval_jac_g (Index n, const Number *x, bool new_x, Index m, Index nele_jac, Index *iRow, Index *jCol, Number *values) |
specifies the jacobian structure (if values is NULL) and evaluates the jacobian values (if values is not NULL) for the nlp. | |
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) |
specifies the structure of the hessian of the lagrangian (if values is NULL) and evaluates the values (if values is not NULL). | |
virtual bool | eval_gi (Index n, const Number *x, bool new_x, Index i, Number &gi) |
compute the value of a single constraint | |
virtual bool | eval_grad_gi (Index n, const Number *x, bool new_x, Index i, Index &nele_grad_gi, Index *jCol, Number *values) |
compute the structure or values of the gradient for one constraint | |
Solution Methods | |
virtual void | finalize_solution (TMINLP::SolverReturn status, Index n, const Number *x, Number obj_value) |
Called after optimizing to return results to ampl. | |
void | write_solution (const std::string &message, const Number *x_sol) |
Write the solution using ampl's write_sol (called by finalize_solution). | |
User callbacks | |
virtual void | fillApplicationOptions (AmplOptionsList *amplOptList) |
Additional application specific options. | |
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. | |
void | operator= (const AmplTMINLP &) |
Overloaded Equals Operator. | |
Private Attributes | |
std::string | appName_ |
Name of application. | |
int | upperBoundingObj_ |
Index of the objective to use for upper bounding. | |
AmplTNLP * | ampl_tnlp_ |
pointer to the internal AmplTNLP | |
SmartPtr< const Journalist > | jnlst_ |
Journalist. | |
BranchingInfo | branch_ |
Storage of branching priorities information. | |
SosInfo | sos_ |
Storage of sos constraints. | |
PerturbInfo | perturb_info_ |
Storage for perturbation radii. | |
SmartPtr< AmplSuffixHandler > | suffix_handler_ |
Store a suffix handler. | |
TMINLP::Convexity * | constraintsConvexities_ |
Store constraints types. | |
int | numberNonConvex_ |
Number of nonConvex constraints. | |
MarkedNonConvex * | nonConvexConstraintsAndRelaxations_ |
Store marked non-convex constraints and their relaxations. | |
int | numberSimpleConcave_ |
Number of simpleConcave constraints. | |
SimpleConcaveConstraint * | simpleConcaves_ |
Store simple concave constraints descriptions. | |
bool | hasLinearObjective_ |
Flag to indicate if objective function is linear. | |
int | writeAmplSolFile_ |
Flag to say if AMPL solution file should be written. |
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 45 of file BonAmplTMINLP.hpp.
Bonmin::AmplTMINLP::AmplTMINLP | ( | const SmartPtr< const Journalist > & | jnlst, |
const SmartPtr< Bonmin::RegisteredOptions > | roptions, | ||
const SmartPtr< OptionsList > | options, | ||
char **& | argv, | ||
AmplSuffixHandler * | suffix_handler = NULL , |
||
const std::string & | appName = "bonmin" , |
||
std::string * | nl_file_content = NULL |
||
) |
Constructor.
Bonmin::AmplTMINLP::AmplTMINLP | ( | ) |
Default constructor.
Referenced by createEmpty().
virtual Bonmin::AmplTMINLP::~AmplTMINLP | ( | ) | [virtual] |
destructor
Bonmin::AmplTMINLP::AmplTMINLP | ( | const AmplTMINLP & | ) | [private] |
Copy Constructor.
virtual void Bonmin::AmplTMINLP::Initialize | ( | const SmartPtr< const Journalist > & | jnlst, |
const SmartPtr< Bonmin::RegisteredOptions > | roptions, | ||
const SmartPtr< OptionsList > | options, | ||
char **& | argv, | ||
AmplSuffixHandler * | suffix_handler = NULL , |
||
const std::string & | appName = "bonmin" , |
||
std::string * | nl_file_content = NULL |
||
) | [virtual] |
Constructor.
void Bonmin::AmplTMINLP::read_priorities | ( | ) |
read the branching priorities from ampl suffixes.
void Bonmin::AmplTMINLP::read_sos | ( | ) |
read the sos constraints from ampl suffixes
void Bonmin::AmplTMINLP::read_convexities | ( | ) |
Read suffixes which indicate which constraints are convex.
void Bonmin::AmplTMINLP::read_obj_suffixes | ( | ) |
Read suffixes on objective functions for upper bounding.
virtual AmplTMINLP* Bonmin::AmplTMINLP::createEmpty | ( | ) | [inline, virtual] |
const ASL_pfgh* Bonmin::AmplTMINLP::AmplSolverObject | ( | ) | const |
Return the ampl solver object (ASL*)
virtual bool Bonmin::AmplTMINLP::get_nlp_info | ( | Index & | n, |
Index & | m, | ||
Index & | nnz_jac_g, | ||
Index & | nnz_h_lag, | ||
TNLP::IndexStyleEnum & | index_style | ||
) | [virtual] |
virtual bool Bonmin::AmplTMINLP::get_variables_types | ( | Index | n, |
VariableType * | var_types | ||
) | [virtual] |
returns the vector of variable types
Implements Bonmin::TMINLP.
virtual bool Bonmin::AmplTMINLP::get_variables_linearity | ( | Index | n, |
Ipopt::TNLP::LinearityType * | var_types | ||
) | [virtual] |
return the variables linearity (linear or not)
Implements Bonmin::TMINLP.
virtual bool Bonmin::AmplTMINLP::get_constraints_linearity | ( | Index | m, |
Ipopt::TNLP::LinearityType * | const_types | ||
) | [virtual] |
Returns the constraint linearity.
array should be alocated with length at least n.
Implements Bonmin::TMINLP.
virtual bool Bonmin::AmplTMINLP::get_bounds_info | ( | Index | n, |
Number * | x_l, | ||
Number * | x_u, | ||
Index | m, | ||
Number * | g_l, | ||
Number * | g_u | ||
) | [virtual] |
virtual bool Bonmin::AmplTMINLP::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] |
virtual bool Bonmin::AmplTMINLP::eval_f | ( | Index | n, |
const Number * | x, | ||
bool | new_x, | ||
Number & | obj_value | ||
) | [virtual] |
virtual bool Bonmin::AmplTMINLP::eval_grad_f | ( | Index | n, |
const Number * | x, | ||
bool | new_x, | ||
Number * | grad_f | ||
) | [virtual] |
evaluates the gradient of the objective for the nlp.
Overloaded from TMINLP
Implements Bonmin::TMINLP.
virtual bool Bonmin::AmplTMINLP::eval_g | ( | Index | n, |
const Number * | x, | ||
bool | new_x, | ||
Index | m, | ||
Number * | g | ||
) | [virtual] |
virtual bool Bonmin::AmplTMINLP::eval_jac_g | ( | Index | n, |
const Number * | x, | ||
bool | new_x, | ||
Index | m, | ||
Index | nele_jac, | ||
Index * | iRow, | ||
Index * | jCol, | ||
Number * | values | ||
) | [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.
virtual bool Bonmin::AmplTMINLP::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] |
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.
virtual bool Bonmin::AmplTMINLP::eval_gi | ( | Index | n, |
const Number * | x, | ||
bool | new_x, | ||
Index | i, | ||
Number & | gi | ||
) | [virtual] |
compute the value of a single constraint
Reimplemented from Bonmin::TMINLP.
virtual bool Bonmin::AmplTMINLP::eval_grad_gi | ( | Index | n, |
const Number * | x, | ||
bool | new_x, | ||
Index | i, | ||
Index & | nele_grad_gi, | ||
Index * | jCol, | ||
Number * | values | ||
) | [virtual] |
compute the structure or values of the gradient for one constraint
Reimplemented from Bonmin::TMINLP.
virtual void Bonmin::AmplTMINLP::finalize_solution | ( | TMINLP::SolverReturn | status, |
Index | n, | ||
const Number * | x, | ||
Number | obj_value | ||
) | [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 with integer feasible solution found. |
410 | limit reached without any integer feasible solution. |
500 | error. Status codes for optimization. |
Implements Bonmin::TMINLP.
void Bonmin::AmplTMINLP::write_solution | ( | const std::string & | message, |
const Number * | x_sol | ||
) |
Write the solution using ampl's write_sol (called by finalize_solution).
virtual const BranchingInfo* Bonmin::AmplTMINLP::branchingInfo | ( | ) | const [inline, virtual] |
virtual const SosInfo* Bonmin::AmplTMINLP::sosConstraints | ( | ) | const [inline, virtual] |
virtual const PerturbInfo* Bonmin::AmplTMINLP::perturbInfo | ( | ) | const [inline, virtual] |
Reimplemented from Bonmin::TMINLP.
Definition at line 198 of file BonAmplTMINLP.hpp.
References perturb_info_.
virtual void Bonmin::AmplTMINLP::fillApplicationOptions | ( | AmplOptionsList * | amplOptList | ) | [inline, virtual] |
Additional application specific options.
Definition at line 206 of file BonAmplTMINLP.hpp.
virtual void Bonmin::AmplTMINLP::getLinearPartOfObjective | ( | double * | obj | ) | [virtual] |
This methods gives the linear part of the objective function.
virtual bool Bonmin::AmplTMINLP::hasUpperBoundingObjective | ( | ) | [inline, virtual] |
Do we have an alternate objective for upper bounding?
Reimplemented from Bonmin::TMINLP.
Definition at line 216 of file BonAmplTMINLP.hpp.
References upperBoundingObj_.
virtual bool Bonmin::AmplTMINLP::eval_upper_bound_f | ( | Index | n, |
const Number * | x, | ||
Number & | obj_value | ||
) | [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).
Reimplemented from Bonmin::TMINLP.
virtual bool Bonmin::AmplTMINLP::get_constraint_convexities | ( | int | m, |
TMINLP::Convexity * | constraints_convexities | ||
) | const [inline, virtual] |
Get accest to constraint convexities.
Reimplemented from Bonmin::TMINLP.
Definition at line 227 of file BonAmplTMINLP.hpp.
References constraintsConvexities_, and Bonmin::TMINLP::Convex.
virtual bool Bonmin::AmplTMINLP::get_number_nonconvex | ( | int & | number_non_conv, |
int & | number_concave | ||
) | const [inline, virtual] |
Get dimension information on nonconvex constraints.
Reimplemented from Bonmin::TMINLP.
Definition at line 238 of file BonAmplTMINLP.hpp.
References numberNonConvex_, and numberSimpleConcave_.
virtual bool Bonmin::AmplTMINLP::get_constraint_convexities | ( | int | number_non_conv, |
MarkedNonConvex * | non_convexes | ||
) | const [inline, virtual] |
Get array describing the constraints marked nonconvex in the model.
Definition at line 245 of file BonAmplTMINLP.hpp.
References nonConvexConstraintsAndRelaxations_, and numberNonConvex_.
virtual bool Bonmin::AmplTMINLP::get_simple_concave_constraints | ( | int | number_concave, |
SimpleConcaveConstraint * | simple_concave | ||
) | const [inline, virtual] |
Fill array containing indices of simple concave constraints.
Definition at line 252 of file BonAmplTMINLP.hpp.
References numberSimpleConcave_, and simpleConcaves_.
virtual bool Bonmin::AmplTMINLP::hasLinearObjective | ( | ) | [inline, virtual] |
Say if problem has a linear objective (for OA)
Reimplemented from Bonmin::TMINLP.
Definition at line 260 of file BonAmplTMINLP.hpp.
References hasLinearObjective_.
void Bonmin::AmplTMINLP::operator= | ( | const AmplTMINLP & | ) | [private] |
Overloaded Equals Operator.
std::string Bonmin::AmplTMINLP::appName_ [private] |
Name of application.
Definition at line 281 of file BonAmplTMINLP.hpp.
int Bonmin::AmplTMINLP::upperBoundingObj_ [private] |
Index of the objective to use for upper bounding.
Definition at line 284 of file BonAmplTMINLP.hpp.
Referenced by hasUpperBoundingObjective().
AmplTNLP* Bonmin::AmplTMINLP::ampl_tnlp_ [private] |
pointer to the internal AmplTNLP
Definition at line 286 of file BonAmplTMINLP.hpp.
SmartPtr<const Journalist> Bonmin::AmplTMINLP::jnlst_ [private] |
Journalist.
Definition at line 288 of file BonAmplTMINLP.hpp.
BranchingInfo Bonmin::AmplTMINLP::branch_ [private] |
Storage of branching priorities information.
Definition at line 291 of file BonAmplTMINLP.hpp.
Referenced by branchingInfo().
SosInfo Bonmin::AmplTMINLP::sos_ [private] |
Storage of sos constraints.
Definition at line 293 of file BonAmplTMINLP.hpp.
Referenced by sosConstraints().
PerturbInfo Bonmin::AmplTMINLP::perturb_info_ [private] |
Storage for perturbation radii.
Definition at line 295 of file BonAmplTMINLP.hpp.
Referenced by perturbInfo().
SmartPtr<AmplSuffixHandler> Bonmin::AmplTMINLP::suffix_handler_ [private] |
Store a suffix handler.
Definition at line 297 of file BonAmplTMINLP.hpp.
Store constraints types.
Definition at line 300 of file BonAmplTMINLP.hpp.
Referenced by get_constraint_convexities().
int Bonmin::AmplTMINLP::numberNonConvex_ [private] |
Number of nonConvex constraints.
Definition at line 303 of file BonAmplTMINLP.hpp.
Referenced by get_constraint_convexities(), and get_number_nonconvex().
MarkedNonConvex* Bonmin::AmplTMINLP::nonConvexConstraintsAndRelaxations_ [private] |
Store marked non-convex constraints and their relaxations.
Definition at line 305 of file BonAmplTMINLP.hpp.
Referenced by get_constraint_convexities().
int Bonmin::AmplTMINLP::numberSimpleConcave_ [private] |
Number of simpleConcave constraints.
Definition at line 307 of file BonAmplTMINLP.hpp.
Referenced by get_number_nonconvex(), and get_simple_concave_constraints().
SimpleConcaveConstraint* Bonmin::AmplTMINLP::simpleConcaves_ [private] |
Store simple concave constraints descriptions.
Definition at line 309 of file BonAmplTMINLP.hpp.
Referenced by get_simple_concave_constraints().
bool Bonmin::AmplTMINLP::hasLinearObjective_ [private] |
Flag to indicate if objective function is linear.
Definition at line 312 of file BonAmplTMINLP.hpp.
Referenced by hasLinearObjective().
int Bonmin::AmplTMINLP::writeAmplSolFile_ [private] |
Flag to say if AMPL solution file should be written.
Definition at line 315 of file BonAmplTMINLP.hpp.