MyTMINLP Class Reference

A C++ example for interfacing an MINLP with bonmin. More...

#include <MyTMINLP.hpp>

Inheritance diagram for MyTMINLP:

Inheritance graph
[legend]
Collaboration diagram for MyTMINLP:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 MyTMINLP ()
 Default constructor.
virtual ~MyTMINLP ()
 virtual destructor.
 MyTMINLP (const MyTMINLP &)
 Copy constructor.
virtual const SosInfo * sosConstraints () const
virtual const BranchingInfo * branchingInfo () const
Overloaded functions specific to a TMINLP.
virtual bool get_var_types (Index n, VariableType *var_types)
 Pass the type of the variables (INTEGER, BINARY, CONTINUOUS) to the optimizer.
virtual bool get_constraints_types (Index m, ConstraintType *const_types)
 Pass the type of the constraints (LINEAR, NON_LINEAR) to the optimizer.
Overloaded functions defining a TNLP.
This group of function implement the various elements needed to define and solve a TNLP. They are the same as those in a standard Ipopt NLP problem

virtual bool get_nlp_info (Index &n, Index &m, Index &nnz_jac_g, Index &nnz_h_lag, TNLP::IndexStyleEnum &index_style)
 Method to pass the main dimensions of the problem to Ipopt.
virtual bool get_bounds_info (Index n, Number *x_l, Number *x_u, Index m, Number *g_l, Number *g_u)
 Method to pass the bounds on variables and constraints to Ipopt.
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 to to pass the starting point for optimization to Ipopt.
virtual bool eval_f (Index n, const Number *x, bool new_x, Number &obj_value)
 Method which compute the value of the objective function at point x.
virtual bool eval_grad_f (Index n, const Number *x, bool new_x, Number *grad_f)
 Method which compute the gradient of the objective at a point x.
virtual bool eval_g (Index n, const Number *x, bool new_x, Index m, Number *g)
 Method which compute the value of the functions defining the constraints at a point 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)
 Method to compute the Jacobian of the functions defining 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)
 Method to compute the Jacobian of the functions defining the constraints.
virtual void finalize_solution (SolverReturn status, Index n, const Number *x, Number obj_value) const
 Method called by Ipopt at the end of optimization.

Detailed Description

A C++ example for interfacing an MINLP with bonmin.

This class implements the following NLP :

\[ \begin{array}{l} \min x_0 - x_1 - x_2 \\ \mbox{s.t}\\ (x_1 - \frac{1}{2})^2 + (x_2 - \frac{1}{2})^2 \leq \frac{1}{4} \\ x_0 - x_1 \leq 0 \\ x_1 + x_2 + x_3 \leq 2\\ x_0 \in \{0,1\}^n \; (x_1, x_2) \in R^2 \; x_3 \in N \end{array} \]

Definition at line 27 of file MyTMINLP.hpp.


Constructor & Destructor Documentation

MyTMINLP::MyTMINLP (  )  [inline]

Default constructor.

Definition at line 31 of file MyTMINLP.hpp.

virtual MyTMINLP::~MyTMINLP (  )  [inline, virtual]

virtual destructor.

Definition at line 34 of file MyTMINLP.hpp.

MyTMINLP::MyTMINLP ( const MyTMINLP  )  [inline]

Copy constructor.

(no data = nothing to copy).

Definition at line 38 of file MyTMINLP.hpp.


Member Function Documentation

virtual bool MyTMINLP::get_var_types ( Index  n,
VariableType var_types 
) [virtual]

Pass the type of the variables (INTEGER, BINARY, CONTINUOUS) to the optimizer.

Parameters:
n size of var_types (has to be equal to the number of variables in the problem)
var_types types of the variables (has to be filled by function).

virtual bool MyTMINLP::get_constraints_types ( Index  m,
ConstraintType const_types 
) [virtual]

Pass the type of the constraints (LINEAR, NON_LINEAR) to the optimizer.

Parameters:
m size of const_types (has to be equal to the number of constraints in the problem)
const_types types of the constraints (has to be filled by function).

virtual bool MyTMINLP::get_nlp_info ( Index n,
Index m,
Index nnz_jac_g,
Index nnz_h_lag,
TNLP::IndexStyleEnum index_style 
) [virtual]

Method to pass the main dimensions of the problem to Ipopt.

Parameters:
n number of variables in problem.
m number of constraints.
nnz_jac_g number of nonzeroes in Jacobian of constraints system.
nnz_h_lag number of nonzeroes in Hessian of the Lagrangean.
index_style indicate wether arrays are numbered from 0 (C-style) or from 1 (Fortran).
Returns:
true in case of success.

Implements Ipopt::TMINLP.

virtual bool MyTMINLP::get_bounds_info ( Index  n,
Number x_l,
Number x_u,
Index  m,
Number g_l,
Number g_u 
) [virtual]

Method to pass the bounds on variables and constraints to Ipopt.

Parameters:
n size of x_l and x_u (has to be equal to the number of variables in the problem)
x_l lower bounds on variables (function should fill it).
x_u upper bounds on the variables (function should fill it).
m size of g_l and g_u (has to be equal to the number of constraints in the problem).
g_l lower bounds of the constraints (function should fill it).
g_u upper bounds of the constraints (function should fill it).
Returns:
true in case of success.

Implements Ipopt::TMINLP.

virtual bool MyTMINLP::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 to to pass the starting point for optimization to Ipopt.

Parameters:
init_x do we initialize primals?
x pass starting primal points (function should fill it if init_x is 1).
m size of lambda (has to be equal to the number of constraints in the problem).
init_lambda do we initialize duals of constraints?
lambda lower bounds of the constraints (function should fill it).
Returns:
true in case of success.

Implements Ipopt::TMINLP.

virtual bool MyTMINLP::eval_f ( Index  n,
const Number x,
bool  new_x,
Number obj_value 
) [virtual]

Method which compute the value of the objective function at point x.

Parameters:
n size of array x (has to be the number of variables in the problem).
x point where to evaluate.
new_x Is this the first time we evaluate functions at this point? (in the present context we don't care).
obj_value value of objective in x (has to be computed by the function).
Returns:
true in case of success.

Implements Ipopt::TMINLP.

virtual bool MyTMINLP::eval_grad_f ( Index  n,
const Number x,
bool  new_x,
Number grad_f 
) [virtual]

Method which compute the gradient of the objective at a point x.

Parameters:
n size of array x (has to be the number of variables in the problem).
x point where to evaluate.
new_x Is this the first time we evaluate functions at this point? (in the present context we don't care).
grad_f gradient of objective taken in x (function has to fill it).
Returns:
true in case of success.

Implements Ipopt::TMINLP.

virtual bool MyTMINLP::eval_g ( Index  n,
const Number x,
bool  new_x,
Index  m,
Number g 
) [virtual]

Method which compute the value of the functions defining the constraints at a point x.

Parameters:
n size of array x (has to be the number of variables in the problem).
x point where to evaluate.
new_x Is this the first time we evaluate functions at this point? (in the present context we don't care).
m size of array g (has to be equal to the number of constraints in the problem)
grad_f values of the constraints (function has to fill it).
Returns:
true in case of success.

Implements Ipopt::TMINLP.

virtual bool MyTMINLP::eval_jac_g ( Index  n,
const Number x,
bool  new_x,
Index  m,
Index  nele_jac,
Index iRow,
Index jCol,
Number values 
) [virtual]

Method to compute the Jacobian of the functions defining the constraints.

If the parameter values==NULL fill the arrays iCol and jRow which store the position of the non-zero element of the Jacobian. If the paramenter values!=NULL fill values with the non-zero elements of the Jacobian.

Parameters:
n size of array x (has to be the number of variables in the problem).
x point where to evaluate.
new_x Is this the first time we evaluate functions at this point? (in the present context we don't care).
m size of array g (has to be equal to the number of constraints in the problem)
grad_f values of the constraints (function has to fill it).
Returns:
true in case of success.

Implements Ipopt::TMINLP.

virtual bool MyTMINLP::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]

Method to compute the Jacobian of the functions defining the constraints.

If the parameter values==NULL fill the arrays iCol and jRow which store the position of the non-zero element of the Jacobian. If the paramenter values!=NULL fill values with the non-zero elements of the Jacobian.

Parameters:
n size of array x (has to be the number of variables in the problem).
x point where to evaluate.
new_x Is this the first time we evaluate functions at this point? (in the present context we don't care).
m size of array g (has to be equal to the number of constraints in the problem)
grad_f values of the constraints (function has to fill it).
Returns:
true in case of success.

Implements Ipopt::TMINLP.

virtual void MyTMINLP::finalize_solution ( SolverReturn  status,
Index  n,
const Number x,
Number  obj_value 
) const [virtual]

Method called by Ipopt at the end of optimization.

virtual const SosInfo* MyTMINLP::sosConstraints (  )  const [inline, virtual]

Implements Ipopt::TMINLP.

Definition at line 163 of file MyTMINLP.hpp.

virtual const BranchingInfo* MyTMINLP::branchingInfo (  )  const [inline, virtual]

Implements Ipopt::TMINLP.

Definition at line 164 of file MyTMINLP.hpp.


The documentation for this class was generated from the following file:
Generated on Fri May 16 21:15:58 2008 for Bonmin by  doxygen 1.4.7