12 #ifndef __TMINLP2TNLP_HPP__ 13 #define __TMINLP2TNLP_HPP__ 24 class IpoptInteriorWarmStarter;
64 return static_cast<int>(
x_l_.size());
71 return static_cast<int>(
g_l_.size());
156 return return_status_;
225 void outputDiffs(
const std::string& probName,
const std::string* varNames);
244 return tminlp_->get_constraints_linearity(
m, const_types);
251 return tminlp_->get_variables_linearity(n,
var_types);
361 return tminlp_->hasUpperBoundingObjective();}
374 throw CoinError(
"BonTMINLP2TNLP",
"addCuts",
"Not implemented");}
380 throw CoinError(
"BonTMINLP2TNLP",
"addCuts",
"Not implemented");}
383 virtual void removeCuts(
unsigned int number ,
const int * toRemove){
385 throw CoinError(
"BonTMINLP2TNLP",
"removeCuts",
"Not implemented");}
392 return tminlp_->get_const_xtra_id();
439 return index_style_;}
485 bool warm_start_entire_iterate_;
487 bool need_new_warm_starter_;
493 void throw_exception_on_bad_variable_bound(
Ipopt::Index i);
virtual bool eval_g(Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Index m, Ipopt::Number *g)
Returns the vector of constraint values in x.
vector< Ipopt::Number > x_init_
Initial primal point.
virtual bool hasUpperBoundingObjective()
Say if has a specific function to compute upper bounds.
const Ipopt::Number * x_init() const
get the starting primal point
virtual void addCuts(const OsiCuts &cuts)
Add some cuts to the problem formulaiton (handles Quadratics).
const Ipopt::Number * duals_init() const
get the starting dual point
Ipopt::Index num_variables() const
Get the number of variables.
void SetVariablesBounds(Ipopt::Index n, const Ipopt::Number *x_l, const Ipopt::Number *x_u)
Change the bounds on the variables.
void setxInit(Ipopt::Index n, const Ipopt::Number *x_init)
set the starting point to x_init
Ipopt::Index nnz_h_lag() const
Access number of entries in tminlp_ hessian.
virtual bool get_variables_linearity(Ipopt::Index n, LinearityType *var_types)
Returns the variables linearity.
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
virtual bool intermediate_callback(Ipopt::AlgorithmMode mode, Ipopt::Index iter, Ipopt::Number obj_value, Ipopt::Number inf_pr, Ipopt::Number inf_du, Ipopt::Number mu, Ipopt::Number d_norm, Ipopt::Number regularization_size, Ipopt::Number alpha_du, Ipopt::Number alpha_pr, Ipopt::Index ls_trials, const Ipopt::IpoptData *ip_data, Ipopt::IpoptCalculatedQuantities *ip_cq)
Intermediate Callback method for the user.
(C) Copyright International Business Machines Corporation 2007
double check_solution(OsiObject **objects=0, int nObjects=-1)
Round and check the current solution, return norm inf of constraint violation.
vector< Ipopt::Number > x_init_user_
User-provideed initial prmal point.
const TMINLP::VariableType * var_types()
Get the variable types.
const Ipopt::Number * g_sol() const
get the g solution (activities)
const Ipopt::Number * x_u()
Get the current values for the upper bounds.
vector< Ipopt::Number > x_l_
Current lower bounds on variables.
const Ipopt::Number * orig_x_l() const
Get the original values for the lower bounds.
virtual const int * get_const_xtra_id() const
Access array describing constraint to which perspectives should be applied.
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)
Method called by Ipopt to get the starting point.
Ipopt::Index nnz_h_lag()
Get the nomber of nz in hessian.
const Ipopt::Number * orig_x_u() const
Get the original values for the upper bounds.
void outputDiffs(const std::string &probName, const std::string *varNames)
Procedure to ouptut relevant informations to reproduce a sub-problem.
Ipopt::SmartPtr< IpoptInteriorWarmStarter > GetWarmStarter()
void SetWarmStarter(Ipopt::SmartPtr< IpoptInteriorWarmStarter > warm_starter)
void SetVariableType(Ipopt::Index n, TMINLP::VariableType type)
Change the type of the variable.
vector< Ipopt::Number > x_u_
Current upper bounds on variables.
const Ipopt::Number * x_init_user() const
get the user provided starting primal point
vector< Ipopt::Number > orig_x_l_
Original lower bounds on variables.
void SetVariableUpperBound(Ipopt::Index var_no, Ipopt::Number x_u)
Change the upper bound on the variable.
void SetVariableLowerBound(Ipopt::Index var_no, Ipopt::Number x_l)
Change the lower bound on the variable.
virtual bool get_nlp_info(Ipopt::Index &n, Ipopt::Index &m, Ipopt::Index &nnz_jac_g, Ipopt::Index &nnz_h_lag, TNLP::IndexStyleEnum &index_style)
This call is just passed onto the TMINLP object.
virtual bool eval_f(Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Number &obj_value)
Returns the value of the objective function in x.
vector< Ipopt::Number > orig_x_u_
Original upper bounds on variables.
virtual ~TMINLP2TNLP()
Default destructor.
Ipopt::SolverReturn optimization_status() const
Get Optimization status.
const Ipopt::Number * duals_sol() const
get the dual values
Ipopt::Index num_constraints() const
Get the number of constraints.
Ipopt::Index nnz_jac_g() const
Access number of entries in tminlp_ hessian.
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)
The caller is allowed to modify the bounds, so this method returns the internal bounds information.
void resetStartingPoint()
reset the starting point to original one.
virtual void addCuts(unsigned int numberCuts, const OsiRowCut **cuts)
Methods are not implemented at this point.
Ipopt::Number * duals_init_
Initial values for all dual multipliers (constraints then lower bounds then upper bounds)
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)
Return the hessian of the lagrangian.
const Ipopt::Number * g_u()
Get the current values for constraints upper bounds.
const Ipopt::Number * x_sol() const
get the solution values
vector< Ipopt::Number > g_u_
Upper bounds on constraints values.
void Set_x_sol(Ipopt::Index n, const Ipopt::Number *x_sol)
Set the contiuous solution.
void force_fractionnal_sol()
force solution to be fractionnal.
TNLP::IndexStyleEnum index_style() const
Acces index_style.
virtual bool get_constraints_linearity(Ipopt::Index m, LinearityType *const_types)
Returns the constraint linearity.
This is an adapter class that converts a TMINLP to a TNLP to be solved by Ipopt.
VariableType
Type of the variables.
int has_x_init()
xInit has been set?
double evaluateUpperBoundingFunction(const double *x)
Evaluate the upper bounding function at given point and store the result.
virtual bool eval_grad_f(Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Number *grad_f)
Returns the vector of the gradient of the objective w.r.t.
Ipopt::Number obj_value() const
Get the objective value.
const Ipopt::Number * g_l()
Get the current values for constraints lower bounds.
virtual TMINLP2TNLP * clone() const
virtual copy .
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)
Method that returns scaling parameters.
virtual bool get_warm_start_iterate(Ipopt::IteratesVector &warm_start_iterate)
Methat that returns an Ipopt IteratesVector that has the starting point for all internal varibles.
void Set_dual_sol(Ipopt::Index n, const Ipopt::Number *dual_sol)
Set the contiuous dual solution.
vector< TMINLP::VariableType > var_types_
Types of the variable (TMINLP::CONTINUOUS, TMINLP::INTEGER, TMINLP::BINARY).
void set_obj_value(Ipopt::Number value)
Manually set objective value.
vector< Ipopt::Number > x_sol_
Optimal solution.
const Ipopt::Number * x_l()
Get the current values for the lower bounds.
void SetVariablesUpperBounds(Ipopt::Index n, const Ipopt::Number *x_u)
Change the upper bound on the variable.
vector< Ipopt::Number > g_sol_
Activities of constraint g( x_sol_)
virtual bool hasLinearObjective()
returns true if objective is linear.
void SetVariablesLowerBounds(Ipopt::Index n, const Ipopt::Number *x_l)
Change the lower bound on the variables.
void SetVariableBounds(Ipopt::Index var_no, Ipopt::Number x_l, Ipopt::Number x_u)
Change the bounds on the variable.
void setDualsInit(Ipopt::Index n, const Ipopt::Number *duals_init)
set the dual starting point to duals_init
vector< Ipopt::Number > duals_sol_
Dual multipliers of constraints and bounds.
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)
Returns the jacobian of the constraints.
virtual void removeCuts(unsigned int number, const int *toRemove)
Remove some cuts to the formulation.
vector< Ipopt::Number > g_l_
Lower bounds on constraints values.
virtual void finalize_solution(Ipopt::SolverReturn status, Ipopt::Index n, const Ipopt::Number *x, const Ipopt::Number *z_L, const Ipopt::Number *z_U, Ipopt::Index m, const Ipopt::Number *g, const Ipopt::Number *lambda, Ipopt::Number obj_value, const Ipopt::IpoptData *ip_data, Ipopt::IpoptCalculatedQuantities *ip_cq)
This method is called when the algorithm is complete so the TNLP can store/write the solution.
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