14 #ifndef __TMINLP_HPP__
15 #define __TMINLP_HPP__
17 #include "IpUtils.hpp"
18 #include "IpReferenced.hpp"
19 #include "IpException.hpp"
20 #include "IpAlgTypes.hpp"
21 #include "CoinPackedMatrix.hpp"
22 #include "OsiCuts.hpp"
24 #include "CoinError.hpp"
25 #include "CoinHelperFunctions.hpp"
59 class TMINLP :
public Ipopt::ReferencedObject
212 virtual bool get_nlp_info(Ipopt::Index&
n, Ipopt::Index&
m, Ipopt::Index& nnz_jac_g,
213 Ipopt::Index& nnz_h_lag, Ipopt::TNLP::IndexStyleEnum& index_style)=0;
223 bool& use_x_scaling, Ipopt::Index
n,
224 Ipopt::Number* x_scaling,
225 bool& use_g_scaling, Ipopt::Index
m,
226 Ipopt::Number* g_scaling)
239 Ipopt::TNLP::LinearityType* var_types) = 0;
244 Ipopt::TNLP::LinearityType* const_types) = 0;
254 virtual bool get_bounds_info(Ipopt::Index
n, Ipopt::Number* x_l, Ipopt::Number* x_u,
255 Ipopt::Index
m, Ipopt::Number* g_l, Ipopt::Number* g_u)=0;
265 bool init_z, Ipopt::Number* z_L, Ipopt::Number* z_U,
266 Ipopt::Index
m,
bool init_lambda,
267 Ipopt::Number* lambda)=0;
270 virtual bool eval_f(Ipopt::Index
n,
const Ipopt::Number*
x,
bool new_x,
271 Ipopt::Number& obj_value)=0;
275 virtual bool eval_grad_f(Ipopt::Index
n,
const Ipopt::Number*
x,
bool new_x,
276 Ipopt::Number* grad_f)=0;
279 virtual bool eval_g(Ipopt::Index
n,
const Ipopt::Number*
x,
bool new_x,
280 Ipopt::Index
m, Ipopt::Number*
g)=0;
287 virtual bool eval_jac_g(Ipopt::Index
n,
const Ipopt::Number*
x,
bool new_x,
288 Ipopt::Index
m, Ipopt::Index nele_jac, Ipopt::Index* iRow,
289 Ipopt::Index *jCol, Ipopt::Number*
values)=0;
298 virtual bool eval_h(Ipopt::Index
n,
const Ipopt::Number*
x,
bool new_x,
299 Ipopt::Number obj_factor, Ipopt::Index
m,
const Ipopt::Number* lambda,
300 bool new_lambda, Ipopt::Index nele_hess,
301 Ipopt::Index* iRow, Ipopt::Index* jCol, Ipopt::Number*
values)=0;
304 virtual bool eval_gi(Ipopt::Index
n,
const Ipopt::Number*
x,
bool new_x,
305 Ipopt::Index i, Ipopt::Number& gi)
307 std::cerr <<
"Method eval_gi not overloaded from TMINLP\n";
314 Ipopt::Index i, Ipopt::Index& nele_grad_gi, Ipopt::Index* jCol,
317 std::cerr <<
"Method eval_grad_gi not overloaded from TMINLP\n";
326 Ipopt::Index
n,
const Ipopt::Number*
x, Ipopt::Number obj_value) =0;
345 Ipopt::Number& obj_value){
return false; }
387 assert(number_non_conv == 0);
391 assert(number_concave == 0);
Constraint is non-convex.
DECLARE_STD_EXCEPTION(TMINLP_INVALID)
Base class for all MINLPs that use a standard triplet matrix form and dense vectors.
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 const int * get_const_xtra_id() const
Access array describing constraint to which perspectives should be applied.
int num
Number of SOS constraints.
Structure for marked non-convex constraints.
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_constraint_convexities(int m, TMINLP::Convexity *constraints_convexities) const
Get accest to constraint convexities.
SimpleConcaveConstraint()
Default constructor gives "safe" values.
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 const SosInfo * sosConstraints() const =0
PerturbInfo()
default constructor.
void operator=(const TMINLP &)
Overloaded Equals Operator.
virtual bool get_simple_concave_constraints(int number_concave, SimpleConcaveConstraint *simple_concave) const
Fill array containing indices of simple concave constraints.
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.
double * downPsCosts
User set down pseudo costs.
TMINLP()
Default destructor.
Class to store sos constraints for model.
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 i...
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 ...
BranchingInfo(const BranchingInfo &other)
int * branchingDirections
User set preferered branching direction.
virtual bool get_constraints_linearity(Ipopt::Index m, Ipopt::TNLP::LinearityType *const_types)=0
overload this method to provide the constraint linearity.
int * starts
For 0 <= i < nums, start[i] gives the indice of indices and weights arrays at which the description o...
int * priorities
User set priorities on variables.
const double * GetPerturbationArray() const
Method for getting the array for the perturbation radii in order to use the values.
Structure which describes a constraints of the form $f[ y F(x) ] with a concave function...
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...
SolverReturn
Return statuses of algorithm.
int numNz
Total number of non zeroes in SOS constraints.
virtual ~TMINLP()
Default destructor.
virtual bool get_number_nonconvex(int &number_non_conv, int &number_concave) const
Get dimension information on nonconvex constraints.
Constraint is concave of the simple form y >= F(x).
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.
int * priorities
priorities of sos constraints.
Convexity
Used to mark constraints of the problem.
int xIdx
Index of the variable x.
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.
bool hasGeneralInteger()
Say if problem has general integer variables.
int cIdx
Index of the constraint.
int * indices
indices of elements belonging to the SOS.
int cIdx
Index of the nonconvex constraint.
void SetPerturbationArray(Ipopt::Index numvars, const double *perturb_radius)
Method for setting the perturbation radii.
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 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.
double * perturb_radius_
Perturbation radii for all variables.
virtual const BranchingInfo * branchingInfo() const =0
Stores branching priorities information.
void fint fint fint real fint real real real real real real * g
int size
number of variables
virtual bool get_constraint_convexities(int number_non_conv, MarkedNonConvex *non_convs) const
Get array describing the constraints marked nonconvex in the model.
MarkedNonConvex()
Default constructor gives "safe" values.
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
This is an adapter class that converts a TMINLP to a TNLP to be solved by Ipopt.
int cRelaxIdx
Index of constraint relaxing the nonconvex constraint.
Class to store perturbation radii for variables in the model.
virtual bool hasLinearObjective()
Say if problem has a linear objective (for OA)
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
VariableType
Type of the variables.
void gutsOfDestructor()
Reset information.
double * upPsCosts
User set up pseudo costs.
int yIdx
Index of the variable y.
SosInfo()
default constructor.
double * weights
weights of the elements of the SOS.
virtual const PerturbInfo * perturbInfo() const
void fint fint fint real fint real * x
virtual bool hasUpperBoundingObjective()
Say if has a specific function to compute upper bounds.
virtual bool get_variables_linearity(Ipopt::Index n, Ipopt::TNLP::LinearityType *var_types)=0
overload this method to provide the variables linearity.