Bonmin
1.7
|
Base class for all MINLPs that use a standard triplet matrix form and dense vectors. More...
#include <BonTMINLP.hpp>
Classes | |
struct | BranchingInfo |
Stores branching priorities information. More... | |
struct | MarkedNonConvex |
Structure for marked non-convex constraints. More... | |
class | PerturbInfo |
Class to store perturbation radii for variables in the model. More... | |
struct | SimpleConcaveConstraint |
Structure which describes a constraints of the form $f[ y F(x) ] with a concave function. More... | |
struct | SosInfo |
Class to store sos constraints for model. More... | |
Public Types | |
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... | |
Public Member Functions | |
virtual const BranchingInfo * | branchingInfo () const =0 |
virtual const SosInfo * | sosConstraints () const =0 |
virtual const PerturbInfo * | perturbInfo () const |
virtual bool | hasUpperBoundingObjective () |
Say if has a specific function to compute upper bounds. | |
virtual bool | eval_upper_bound_f (Ipopt::Index n, const Ipopt::Number *x, Ipopt::Number &obj_value) |
overload this method to return the value of an alternative objective function for upper bounding (to use it hasUpperBoundingObjective should return true). | |
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_convs) 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) | |
bool | hasGeneralInteger () |
Say if problem has general integer variables. | |
virtual const int * | get_const_xtra_id () const |
Access array describing constraint to which perspectives should be applied. | |
Constructors/Destructors | |
TMINLP () | |
Default destructor. | |
virtual | ~TMINLP () |
Default destructor. | |
methods to gather information about the MINLP | |
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)=0 |
overload this method to return the number of variables and constraints, and the number of non-zeros in the jacobian and the hessian. | |
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. | |
virtual bool | get_variables_types (Ipopt::Index n, VariableType *var_types)=0 |
overload this method to provide the variables types. | |
virtual bool | get_variables_linearity (Ipopt::Index n, Ipopt::TNLP::LinearityType *var_types)=0 |
overload this method to provide the variables linearity. | |
virtual bool | get_constraints_linearity (Ipopt::Index m, Ipopt::TNLP::LinearityType *const_types)=0 |
overload this method to provide the constraint linearity. | |
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)=0 |
overload this method to return the information about the bound on the variables and constraints. | |
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)=0 |
overload this method to return the starting point. | |
virtual bool | eval_f (Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Number &obj_value)=0 |
overload this method to return the value of the objective function | |
virtual bool | eval_grad_f (Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Number *grad_f)=0 |
overload this method to return the vector of the gradient of the objective w.r.t. | |
virtual bool | eval_g (Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Index m, Ipopt::Number *g)=0 |
overload this method to return the vector of constraint values | |
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)=0 |
overload this method to return the jacobian of the constraints. | |
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)=0 |
overload this method to return the hessian of the lagrangian. | |
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. | |
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. | |
Solution Methods | |
virtual void | finalize_solution (TMINLP::SolverReturn status, Ipopt::Index n, const Ipopt::Number *x, Ipopt::Number obj_value)=0 |
This method is called when the algorithm is complete so the TNLP can store/write the solution. | |
Protected Member Functions | |
TMINLP (const TMINLP &) | |
Copy constructor. | |
void | operator= (const TMINLP &) |
Overloaded Equals Operator. | |
Friends | |
class | TMINLP2TNLP |
Base class for all MINLPs that use a standard triplet matrix form and dense vectors.
The class TMINLP2TNLP allows the caller to produce a viable TNLP from the MINLP (by relaxing binary and/or integers, or by fixing them), which can then be solved by Ipopt.
This interface presents the problem form:
Where each x_i is either a continuous, binary, or integer variable. If x_i is binary, the bounds [xL,xU] are assumed to be [0,1]. In order to specify an equality constraint, set gL_i = gU_i = rhs. The value that indicates "infinity" for the bounds (i.e. the variable or constraint has no lower bound (-infinity) or upper bound (+infinity)) is set through the option nlp_lower_bound_inf and nlp_upper_bound_inf. To indicate that a variable has no upper or lower bound, set the bound to -ipopt_inf or +ipopt_inf respectively
Definition at line 59 of file BonTMINLP.hpp.
Return statuses of algorithm.
Definition at line 64 of file BonTMINLP.hpp.
Type of the variables.
Definition at line 192 of file BonTMINLP.hpp.
Used to mark constraints of the problem.
Convex |
Constraint is convex. |
NonConvex |
Constraint is non-convex. |
SimpleConcave |
Constraint is concave of the simple form y >= F(x). |
Definition at line 348 of file BonTMINLP.hpp.
Bonmin::TMINLP::TMINLP | ( | ) |
Default destructor.
virtual Bonmin::TMINLP::~TMINLP | ( | ) | [virtual] |
Default destructor.
Bonmin::TMINLP::TMINLP | ( | const TMINLP & | ) | [protected] |
Copy constructor.
Copy Constructor
virtual bool Bonmin::TMINLP::get_nlp_info | ( | Ipopt::Index & | n, |
Ipopt::Index & | m, | ||
Ipopt::Index & | nnz_jac_g, | ||
Ipopt::Index & | nnz_h_lag, | ||
Ipopt::TNLP::IndexStyleEnum & | index_style | ||
) | [pure virtual] |
overload this method to return the number of variables and constraints, and the number of non-zeros in the jacobian and the hessian.
Implemented in Bonmin::AmplTMINLP, and Bonmin::TMINLPLinObj.
virtual bool Bonmin::TMINLP::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 | ||
) | [inline, virtual] |
overload this method to return scaling parameters.
This is only called if the options are set to retrieve user scaling. There, use_x_scaling (or use_g_scaling) should get set to true only if the variables (or constraints) are to be scaled. This method should return true only if the scaling parameters could be provided.
Reimplemented in Bonmin::TMINLPLinObj.
Definition at line 222 of file BonTMINLP.hpp.
virtual bool Bonmin::TMINLP::get_variables_types | ( | Ipopt::Index | n, |
VariableType * | var_types | ||
) | [pure virtual] |
overload this method to provide the variables types.
The var_types array will be allocated with length n.
Implemented in Bonmin::AmplTMINLP, and Bonmin::TMINLPLinObj.
virtual bool Bonmin::TMINLP::get_variables_linearity | ( | Ipopt::Index | n, |
Ipopt::TNLP::LinearityType * | var_types | ||
) | [pure virtual] |
overload this method to provide the variables linearity.
array should be allocated with length at least n.
Implemented in Bonmin::TMINLPLinObj, and Bonmin::AmplTMINLP.
virtual bool Bonmin::TMINLP::get_constraints_linearity | ( | Ipopt::Index | m, |
Ipopt::TNLP::LinearityType * | const_types | ||
) | [pure virtual] |
overload this method to provide the constraint linearity.
array should be allocated with length at least m.
Implemented in Bonmin::AmplTMINLP, and Bonmin::TMINLPLinObj.
virtual bool Bonmin::TMINLP::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 | ||
) | [pure virtual] |
overload this method to return the information about the bound on the variables and constraints.
The value that indicates that a bound does not exist is specified in the parameters nlp_lower_bound_inf and nlp_upper_bound_inf. By default, nlp_lower_bound_inf is -1e19 and nlp_upper_bound_inf is 1e19. An exception will be thrown if x_l and x_u are not 0,1 for binary variables
Implemented in Bonmin::AmplTMINLP, and Bonmin::TMINLPLinObj.
virtual bool Bonmin::TMINLP::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 | ||
) | [pure virtual] |
overload this method to return 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.
Implemented in Bonmin::AmplTMINLP, and Bonmin::TMINLPLinObj.
virtual bool Bonmin::TMINLP::eval_f | ( | Ipopt::Index | n, |
const Ipopt::Number * | x, | ||
bool | new_x, | ||
Ipopt::Number & | obj_value | ||
) | [pure virtual] |
overload this method to return the value of the objective function
Implemented in Bonmin::AmplTMINLP, and Bonmin::TMINLPLinObj.
virtual bool Bonmin::TMINLP::eval_grad_f | ( | Ipopt::Index | n, |
const Ipopt::Number * | x, | ||
bool | new_x, | ||
Ipopt::Number * | grad_f | ||
) | [pure virtual] |
overload this method to return the vector of the gradient of the objective w.r.t.
x
Implemented in Bonmin::AmplTMINLP, and Bonmin::TMINLPLinObj.
virtual bool Bonmin::TMINLP::eval_g | ( | Ipopt::Index | n, |
const Ipopt::Number * | x, | ||
bool | new_x, | ||
Ipopt::Index | m, | ||
Ipopt::Number * | g | ||
) | [pure virtual] |
overload this method to return the vector of constraint values
Implemented in Bonmin::AmplTMINLP, and Bonmin::TMINLPLinObj.
virtual bool Bonmin::TMINLP::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 | ||
) | [pure virtual] |
overload this method to return 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.
Implemented in Bonmin::AmplTMINLP, and Bonmin::TMINLPLinObj.
virtual bool Bonmin::TMINLP::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 | ||
) | [pure virtual] |
overload this method to 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
Implemented in Bonmin::AmplTMINLP, and Bonmin::TMINLPLinObj.
virtual bool Bonmin::TMINLP::eval_gi | ( | Ipopt::Index | n, |
const Ipopt::Number * | x, | ||
bool | new_x, | ||
Ipopt::Index | i, | ||
Ipopt::Number & | gi | ||
) | [inline, virtual] |
Compute the value of a single constraint.
The constraint number is i (starting counting from 0.
Reimplemented in Bonmin::AmplTMINLP, and Bonmin::TMINLPLinObj.
Definition at line 304 of file BonTMINLP.hpp.
virtual bool Bonmin::TMINLP::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 | ||
) | [inline, virtual] |
Compute the structure or values of the gradient for one constraint.
The constraint * number is i (starting counting from 0. Other things are like with eval_jac_g.
Reimplemented in Bonmin::AmplTMINLP, and Bonmin::TMINLPLinObj.
Definition at line 313 of file BonTMINLP.hpp.
virtual void Bonmin::TMINLP::finalize_solution | ( | TMINLP::SolverReturn | status, |
Ipopt::Index | n, | ||
const Ipopt::Number * | x, | ||
Ipopt::Number | obj_value | ||
) | [pure virtual] |
This method is called when the algorithm is complete so the TNLP can store/write the solution.
Implemented in Bonmin::AmplTMINLP, and Bonmin::TMINLPLinObj.
virtual const BranchingInfo* Bonmin::TMINLP::branchingInfo | ( | ) | const [pure virtual] |
Implemented in Bonmin::AmplTMINLP, MyTMINLP, and Bonmin::TMINLPLinObj.
virtual const SosInfo* Bonmin::TMINLP::sosConstraints | ( | ) | const [pure virtual] |
Implemented in Bonmin::AmplTMINLP, Bonmin::TMINLPLinObj, and MyTMINLP.
virtual const PerturbInfo* Bonmin::TMINLP::perturbInfo | ( | ) | const [inline, virtual] |
Reimplemented in Bonmin::AmplTMINLP, and Bonmin::TMINLPLinObj.
Definition at line 333 of file BonTMINLP.hpp.
virtual bool Bonmin::TMINLP::hasUpperBoundingObjective | ( | ) | [inline, virtual] |
Say if has a specific function to compute upper bounds.
Reimplemented in Bonmin::AmplTMINLP, and Bonmin::TMINLPLinObj.
Definition at line 339 of file BonTMINLP.hpp.
virtual bool Bonmin::TMINLP::eval_upper_bound_f | ( | Ipopt::Index | n, |
const Ipopt::Number * | x, | ||
Ipopt::Number & | obj_value | ||
) | [inline, virtual] |
overload this method to return the value of an alternative objective function for upper bounding (to use it hasUpperBoundingObjective should return true).
Reimplemented in Bonmin::AmplTMINLP, and Bonmin::TMINLPLinObj.
Definition at line 344 of file BonTMINLP.hpp.
virtual bool Bonmin::TMINLP::get_constraint_convexities | ( | int | m, |
TMINLP::Convexity * | constraints_convexities | ||
) | const [inline, virtual] |
Get accest to constraint convexities.
Reimplemented in Bonmin::AmplTMINLP.
Definition at line 377 of file BonTMINLP.hpp.
References Convex.
virtual bool Bonmin::TMINLP::get_number_nonconvex | ( | int & | number_non_conv, |
int & | number_concave | ||
) | const [inline, virtual] |
Get dimension information on nonconvex constraints.
Reimplemented in Bonmin::AmplTMINLP.
Definition at line 381 of file BonTMINLP.hpp.
virtual bool Bonmin::TMINLP::get_constraint_convexities | ( | int | number_non_conv, |
MarkedNonConvex * | non_convs | ||
) | const [inline, virtual] |
Get array describing the constraints marked nonconvex in the model.
Definition at line 386 of file BonTMINLP.hpp.
virtual bool Bonmin::TMINLP::get_simple_concave_constraints | ( | int | number_concave, |
SimpleConcaveConstraint * | simple_concave | ||
) | const [inline, virtual] |
Fill array containing indices of simple concave constraints.
Definition at line 390 of file BonTMINLP.hpp.
virtual bool Bonmin::TMINLP::hasLinearObjective | ( | ) | [inline, virtual] |
Say if problem has a linear objective (for OA)
Reimplemented in Bonmin::AmplTMINLP, and Bonmin::TMINLPLinObj.
Definition at line 395 of file BonTMINLP.hpp.
bool Bonmin::TMINLP::hasGeneralInteger | ( | ) |
Say if problem has general integer variables.
virtual const int* Bonmin::TMINLP::get_const_xtra_id | ( | ) | const [inline, virtual] |
Access array describing constraint to which perspectives should be applied.
Reimplemented in Bonmin::AmplTMINLP.
Definition at line 401 of file BonTMINLP.hpp.
void Bonmin::TMINLP::operator= | ( | const TMINLP & | ) | [protected] |
Overloaded Equals Operator.
friend class TMINLP2TNLP [friend] |
Definition at line 62 of file BonTMINLP.hpp.