Bonmin 1.8.9
Loading...
Searching...
No Matches
Bonmin::AmplTMINLP Class Reference

Ampl MINLP Interface. More...

#include <BonAmplTMINLP.hpp>

+ Inheritance diagram for Bonmin::AmplTMINLP:
+ Collaboration diagram for Bonmin::AmplTMINLP:

Public Member Functions

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.
 
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)
 
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_onoff ()
 Read suffixes used to apply perspective in OA to some of the constraints.
 
void read_obj_suffixes ()
 Read suffixes on objective functions for upper bounding.
 
 AmplTMINLP ()
 Default constructor.
 
virtual AmplTMINLPcreateEmpty ()
 
virtual ~AmplTMINLP ()
 destructor
 
const ASL_pfgh * AmplSolverObject () const
 Return the ampl solver object (ASL*)
 
methods to gather information about the NLP. These

methods are overloaded from TMINLP.

See TMINLP for their more detailed documentation.

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.
 
virtual bool get_variables_types (Ipopt::Index n, VariableType *var_types)
 returns the vector of variable types
 
virtual bool get_variables_linearity (Ipopt::Index n, Ipopt::TNLP::LinearityType *var_types)
 return the variables linearity (linear or not)
 
virtual bool get_constraints_linearity (Ipopt::Index m, Ipopt::TNLP::LinearityType *const_types)
 Returns 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)
 returns bounds of the nlp.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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).
 
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)
 Called after optimizing to return results to ampl.
 
void write_solution (const std::string &message, const Ipopt::Number *x_sol)
 Write the solution using ampl's write_sol (called by finalize_solution).
 
virtual const BranchingInfobranchingInfo () const
 
virtual const SosInfososConstraints () const
 
virtual const PerturbInfoperturbInfo () const
 
User callbacks
virtual void fillApplicationOptions (Ipopt::AmplOptionsList *amplOptList)
 Additional application specific options.
 
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 (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).
 
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)
 
virtual const int * get_const_xtra_id () const
 Access array describing onoff constraint.
 
- Public Member Functions inherited from Bonmin::TMINLP
 TMINLP ()
 
virtual ~TMINLP ()
 Default destructor.
 
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.
 
bool hasGeneralInteger ()
 Say if problem has general integer variables.
 
- Public Member Functions inherited from Ipopt::ReferencedObject
 ReferencedObject ()
 
virtual ~ReferencedObject ()
 
Index ReferenceCount () const
 
void AddRef (const Referencer *referencer) const
 
void ReleaseRef (const Referencer *referencer) const
 

Additional Inherited Members

- Public Types inherited from Bonmin::TMINLP
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...
 
- Protected Member Functions inherited from Bonmin::TMINLP
 TMINLP (const TMINLP &)
 Copy constructor.
 
void operator= (const TMINLP &)
 Overloaded Equals Operator.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ AmplTMINLP() [1/2]

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.

◆ AmplTMINLP() [2/2]

Bonmin::AmplTMINLP::AmplTMINLP ( )

Default constructor.

◆ ~AmplTMINLP()

virtual Bonmin::AmplTMINLP::~AmplTMINLP ( )
virtual

destructor

Member Function Documentation

◆ Initialize()

virtual void Bonmin::AmplTMINLP::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 )
virtual

◆ read_priorities()

void Bonmin::AmplTMINLP::read_priorities ( )

read the branching priorities from ampl suffixes.

◆ read_sos()

void Bonmin::AmplTMINLP::read_sos ( )

read the sos constraints from ampl suffixes

◆ read_convexities()

void Bonmin::AmplTMINLP::read_convexities ( )

Read suffixes which indicate which constraints are convex.

◆ read_onoff()

void Bonmin::AmplTMINLP::read_onoff ( )

Read suffixes used to apply perspective in OA to some of the constraints.

◆ read_obj_suffixes()

void Bonmin::AmplTMINLP::read_obj_suffixes ( )

Read suffixes on objective functions for upper bounding.

◆ createEmpty()

virtual AmplTMINLP * Bonmin::AmplTMINLP::createEmpty ( )
inlinevirtual

Definition at line 86 of file BonAmplTMINLP.hpp.

◆ AmplSolverObject()

const ASL_pfgh * Bonmin::AmplTMINLP::AmplSolverObject ( ) const

Return the ampl solver object (ASL*)

◆ get_nlp_info()

virtual bool Bonmin::AmplTMINLP::get_nlp_info ( Ipopt::Index & n,
Ipopt::Index & m,
Ipopt::Index & nnz_jac_g,
Ipopt::Index & nnz_h_lag,
Ipopt::TNLP::IndexStyleEnum & index_style )
virtual

returns dimensions of the nlp.

Overloaded from TMINLP

Implements Bonmin::TMINLP.

◆ get_variables_types()

virtual bool Bonmin::AmplTMINLP::get_variables_types ( Ipopt::Index n,
VariableType * var_types )
virtual

returns the vector of variable types

Implements Bonmin::TMINLP.

◆ get_variables_linearity()

virtual bool Bonmin::AmplTMINLP::get_variables_linearity ( Ipopt::Index n,
Ipopt::TNLP::LinearityType * var_types )
virtual

return the variables linearity (linear or not)

Implements Bonmin::TMINLP.

◆ get_constraints_linearity()

virtual bool Bonmin::AmplTMINLP::get_constraints_linearity ( Ipopt::Index m,
Ipopt::TNLP::LinearityType * const_types )
virtual

Returns the constraint linearity.

array should be alocated with length at least n.

Implements Bonmin::TMINLP.

◆ get_bounds_info()

virtual bool Bonmin::AmplTMINLP::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 )
virtual

returns bounds of the nlp.

Overloaded from TMINLP

Implements Bonmin::TMINLP.

◆ get_starting_point()

virtual bool Bonmin::AmplTMINLP::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 )
virtual

provides a starting point for the nlp variables.

Overloaded from TMINLP

Implements Bonmin::TMINLP.

◆ eval_f()

virtual bool Bonmin::AmplTMINLP::eval_f ( Ipopt::Index n,
const Ipopt::Number * x,
bool new_x,
Ipopt::Number & obj_value )
virtual

evaluates the objective value for the nlp.

Overloaded from TMINLP

Implements Bonmin::TMINLP.

◆ eval_grad_f()

virtual bool Bonmin::AmplTMINLP::eval_grad_f ( Ipopt::Index n,
const Ipopt::Number * x,
bool new_x,
Ipopt::Number * grad_f )
virtual

evaluates the gradient of the objective for the nlp.

Overloaded from TMINLP

Implements Bonmin::TMINLP.

◆ eval_g()

virtual bool Bonmin::AmplTMINLP::eval_g ( Ipopt::Index n,
const Ipopt::Number * x,
bool new_x,
Ipopt::Index m,
Ipopt::Number * g )
virtual

evaluates the constraint residuals for the nlp.

Overloaded from TMINLP

Implements Bonmin::TMINLP.

◆ eval_jac_g()

virtual bool Bonmin::AmplTMINLP::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 )
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.

◆ eval_h()

virtual bool Bonmin::AmplTMINLP::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 )
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.

◆ eval_gi()

virtual bool Bonmin::AmplTMINLP::eval_gi ( Ipopt::Index n,
const Ipopt::Number * x,
bool new_x,
Ipopt::Index i,
Ipopt::Number & gi )
virtual

compute the value of a single constraint

Reimplemented from Bonmin::TMINLP.

◆ eval_grad_gi()

virtual bool Bonmin::AmplTMINLP::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 )
virtual

compute the structure or values of the gradient for one constraint

Reimplemented from Bonmin::TMINLP.

◆ finalize_solution()

virtual void Bonmin::AmplTMINLP::finalize_solution ( TMINLP::SolverReturn status,
Ipopt::Index n,
const Ipopt::Number * x,
Ipopt::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.

Code
Status
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.

◆ write_solution()

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).

◆ branchingInfo()

virtual const BranchingInfo * Bonmin::AmplTMINLP::branchingInfo ( ) const
inlinevirtual

Implements Bonmin::TMINLP.

Definition at line 192 of file BonAmplTMINLP.hpp.

◆ sosConstraints()

virtual const SosInfo * Bonmin::AmplTMINLP::sosConstraints ( ) const
inlinevirtual

Implements Bonmin::TMINLP.

Definition at line 197 of file BonAmplTMINLP.hpp.

◆ perturbInfo()

virtual const PerturbInfo * Bonmin::AmplTMINLP::perturbInfo ( ) const
inlinevirtual

Reimplemented from Bonmin::TMINLP.

Definition at line 202 of file BonAmplTMINLP.hpp.

◆ fillApplicationOptions()

virtual void Bonmin::AmplTMINLP::fillApplicationOptions ( Ipopt::AmplOptionsList * amplOptList)
inlinevirtual

Additional application specific options.

Definition at line 210 of file BonAmplTMINLP.hpp.

◆ getLinearPartOfObjective()

virtual void Bonmin::AmplTMINLP::getLinearPartOfObjective ( double * obj)
virtual

This methods gives the linear part of the objective function.

◆ hasUpperBoundingObjective()

virtual bool Bonmin::AmplTMINLP::hasUpperBoundingObjective ( )
inlinevirtual

Do we have an alternate objective for upper bounding?

Reimplemented from Bonmin::TMINLP.

Definition at line 220 of file BonAmplTMINLP.hpp.

◆ eval_upper_bound_f()

virtual bool Bonmin::AmplTMINLP::eval_upper_bound_f ( Ipopt::Index n,
const Ipopt::Number * x,
Ipopt::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.

◆ get_constraint_convexities() [1/2]

virtual bool Bonmin::AmplTMINLP::get_constraint_convexities ( int m,
TMINLP::Convexity * constraints_convexities ) const
inlinevirtual

Get accest to constraint convexities.

Reimplemented from Bonmin::TMINLP.

Definition at line 231 of file BonAmplTMINLP.hpp.

◆ get_number_nonconvex()

virtual bool Bonmin::AmplTMINLP::get_number_nonconvex ( int & number_non_conv,
int & number_concave ) const
inlinevirtual

Get dimension information on nonconvex constraints.

Reimplemented from Bonmin::TMINLP.

Definition at line 242 of file BonAmplTMINLP.hpp.

◆ get_constraint_convexities() [2/2]

virtual bool Bonmin::AmplTMINLP::get_constraint_convexities ( int number_non_conv,
MarkedNonConvex * non_convexes ) const
inlinevirtual

Get array describing the constraints marked nonconvex in the model.

Reimplemented from Bonmin::TMINLP.

Definition at line 249 of file BonAmplTMINLP.hpp.

◆ get_simple_concave_constraints()

virtual bool Bonmin::AmplTMINLP::get_simple_concave_constraints ( int number_concave,
SimpleConcaveConstraint * simple_concave ) const
inlinevirtual

Fill array containing indices of simple concave constraints.

Reimplemented from Bonmin::TMINLP.

Definition at line 256 of file BonAmplTMINLP.hpp.

◆ hasLinearObjective()

virtual bool Bonmin::AmplTMINLP::hasLinearObjective ( )
inlinevirtual

Say if problem has a linear objective (for OA)

Reimplemented from Bonmin::TMINLP.

Definition at line 264 of file BonAmplTMINLP.hpp.

◆ get_const_xtra_id()

virtual const int * Bonmin::AmplTMINLP::get_const_xtra_id ( ) const
inlinevirtual

Access array describing onoff constraint.

Reimplemented from Bonmin::TMINLP.

Definition at line 270 of file BonAmplTMINLP.hpp.


The documentation for this class was generated from the following file: