14 #ifndef __IPAMPLTMINLP_HPP__
15 #define __IPAMPLTMINLP_HPP__
18 #include "IpSmartPtr.hpp"
19 #include "CoinPackedMatrix.hpp"
20 #include "OsiCuts.hpp"
33 class AmplSuffixHandler;
34 class AmplOptionsList;
52 AmplTMINLP(
const Ipopt::SmartPtr<const Ipopt::Journalist>& jnlst,
53 const Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions,
54 const Ipopt::SmartPtr<Ipopt::OptionsList> options,
56 Ipopt::AmplSuffixHandler* suffix_handler = NULL,
57 const std::string& appName =
"bonmin",
58 std::string* nl_file_content = NULL);
60 virtual void Initialize(
const Ipopt::SmartPtr<const Ipopt::Journalist>& jnlst,
61 const Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions,
62 const Ipopt::SmartPtr<Ipopt::OptionsList> options,
64 Ipopt::AmplSuffixHandler* suffix_handler =NULL,
65 const std::string& appName =
"bonmin",
66 std::string* nl_file_content = NULL);
105 virtual bool get_nlp_info(Ipopt::Index& n, Ipopt::Index& m, Ipopt::Index& nnz_jac_g,
106 Ipopt::Index& nnz_h_lag,
107 Ipopt::TNLP::IndexStyleEnum& index_style);
118 Ipopt::TNLP::LinearityType* const_types);
121 virtual bool get_bounds_info(Ipopt::Index n, Ipopt::Number* x_l, Ipopt::Number* x_u,
122 Ipopt::Index m, Ipopt::Number* g_l, Ipopt::Number* g_u);
127 bool init_z, Ipopt::Number* z_L, Ipopt::Number* z_U,
128 Ipopt::Index m,
bool init_lambda, Ipopt::Number* lambda);
131 virtual bool eval_f(Ipopt::Index n,
const Ipopt::Number* x,
bool new_x,
132 Ipopt::Number& obj_value);
136 virtual bool eval_grad_f(Ipopt::Index n,
const Ipopt::Number* x,
bool new_x,
137 Ipopt::Number* grad_f);
140 virtual bool eval_g(Ipopt::Index n,
const Ipopt::Number* x,
bool new_x,
141 Ipopt::Index m, Ipopt::Number* g);
146 virtual bool eval_jac_g(Ipopt::Index n,
const Ipopt::Number* x,
bool new_x,
147 Ipopt::Index m, Ipopt::Index nele_jac, Ipopt::Index* iRow,
148 Ipopt::Index *jCol, Ipopt::Number* values);
153 virtual bool eval_h(Ipopt::Index n,
const Ipopt::Number* x,
bool new_x,
154 Ipopt::Number obj_factor, Ipopt::Index m,
const Ipopt::Number* lambda,
155 bool new_lambda, Ipopt::Index nele_hess, Ipopt::Index* iRow,
156 Ipopt::Index* jCol, Ipopt::Number* values);
159 virtual bool eval_gi(Ipopt::Index n,
const Ipopt::Number* x,
bool new_x,
160 Ipopt::Index i, Ipopt::Number& gi);
163 virtual bool eval_grad_gi(Ipopt::Index n,
const Ipopt::Number* x,
bool new_x,
164 Ipopt::Index i, Ipopt::Index& nele_grad_gi, Ipopt::Index* jCol,
165 Ipopt::Number* values);
183 Ipopt::Index n,
const Ipopt::Number* x, Ipopt::Number obj_value);
186 void write_solution(
const std::string & message,
const Ipopt::Number *x_sol);
228 Ipopt::Number& obj_value);
297 Ipopt::SmartPtr<const Ipopt::Journalist>
jnlst_;
virtual bool get_number_nonconvex(int &number_non_conv, int &number_concave) const
Get dimension information on nonconvex constraints.
const ASL_pfgh * AmplSolverObject() const
Return the ampl solver object (ASL*)
Base class for all MINLPs that use a standard triplet matrix form and dense vectors.
virtual bool get_variables_types(Ipopt::Index n, VariableType *var_types)
returns the vector of variable types
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
std::string appName_
Name of application.
virtual bool get_simple_concave_constraints(int number_concave, SimpleConcaveConstraint *simple_concave) const
Fill array containing indices of simple concave constraints.
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_constraint_convexities(int number_non_conv, MarkedNonConvex *non_convexes) const
Get array describing the constraints marked nonconvex in the model.
virtual bool get_constraint_convexities(int m, TMINLP::Convexity *constraints_convexities) const
Get accest to constraint convexities.
void read_sos()
read the sos constraints from ampl suffixes
virtual void getLinearPartOfObjective(double *obj)
This methods gives the linear part of the objective function.
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.
Ipopt::AmplTNLP * ampl_tnlp_
pointer to the internal AmplTNLP
SosInfo sos_
Storage of sos constraints.
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.
PerturbInfo perturb_info_
Storage for perturbation radii.
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)
Constructor.
virtual bool hasLinearObjective()
Say if problem has a linear objective (for OA)
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.
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 bool hasUpperBoundingObjective()
Do we have an alternate objective for upper bounding?
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...
BranchingInfo branch_
Storage of branching priorities information.
int numberNonConvex_
Ipopt::Number of nonConvex constraints.
virtual void fillApplicationOptions(Ipopt::AmplOptionsList *amplOptList)
Additional application specific options.
virtual const BranchingInfo * branchingInfo() const
virtual const PerturbInfo * perturbInfo() const
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.
Ipopt::SmartPtr< const Ipopt::Journalist > jnlst_
Journalist.
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 ...
bool hasLinearObjective_
Flag to indicate if objective function is linear.
SolverReturn
Return statuses of algorithm.
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 ...
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.
virtual bool get_variables_linearity(Ipopt::Index n, Ipopt::TNLP::LinearityType *var_types)
return the variables linearity (linear or not)
MarkedNonConvex * nonConvexConstraintsAndRelaxations_
Store marked non-convex constraints and their relaxations.
vector< int > c_extra_id_
Store onoff information.
Convexity
Used to mark constraints of the problem.
virtual const SosInfo * sosConstraints() const
TMINLP::Convexity * constraintsConvexities_
Store constraints types.
void operator=(const AmplTMINLP &)
Overloaded Equals Operator.
int writeAmplSolFile_
Flag to say if AMPL solution file should be written.
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
AmplTMINLP()
Default constructor.
int numberSimpleConcave_
Ipopt::Number of simpleConcave constraints.
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.
SimpleConcaveConstraint * simpleConcaves_
Store simple concave constraints descriptions.
virtual AmplTMINLP * createEmpty()
Constructor.
void read_obj_suffixes()
Read suffixes on objective functions for upper bounding.
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.
int upperBoundingObj_
Index of the objective to use for upper bounding.
void read_priorities()
read the branching priorities from ampl suffixes.
virtual bool get_constraints_linearity(Ipopt::Index m, Ipopt::TNLP::LinearityType *const_types)
Returns the constraint linearity.
virtual ~AmplTMINLP()
destructor
Ipopt::SmartPtr< Ipopt::AmplSuffixHandler > suffix_handler_
Store a suffix handler.
virtual const int * get_const_xtra_id() const
Access array describing onoff constraint.
VariableType
Type of the variables.