10 #ifndef COUENNETNLP_HPP
11 #define COUENNETNLP_HPP
24 class CouenneSparseMatrix;
67 Ipopt::Index& nnz_jac_g,
68 Ipopt::Index& nnz_h_lag,
69 enum Ipopt::TNLP::IndexStyleEnum& index_style);
76 virtual bool get_bounds_info (Ipopt::Index
n, Ipopt::Number* x_l, Ipopt::Number* x_u,
77 Ipopt::Index
m, Ipopt::Number* g_l, Ipopt::Number* g_u);
97 bool init_x, Ipopt::Number*
x,
98 bool init_z, Ipopt::Number* z_L, Ipopt::Number* z_U,
100 bool init_lambda, Ipopt::Number* lambda);
103 virtual bool eval_f (Ipopt::Index
n,
const Ipopt::Number*
x,
bool new_x,
104 Ipopt::Number& obj_value);
107 virtual bool eval_grad_f (Ipopt::Index
n,
const Ipopt::Number*
x,
109 Ipopt::Number* grad_f);
112 virtual bool eval_g (Ipopt::Index
n,
const Ipopt::Number*
x,
bool new_x,
113 Ipopt::Index
m, Ipopt::Number*
g);
120 virtual bool eval_jac_g (Ipopt::Index
n,
const Ipopt::Number*
x,
bool new_x,
121 Ipopt::Index
m, Ipopt::Index nele_jac, Ipopt::Index* iRow,
122 Ipopt::Index *jCol, Ipopt::Number*
values);
133 virtual bool eval_h (Ipopt::Index
n,
const Ipopt::Number*
x,
bool new_x,
134 Ipopt::Number obj_factor, Ipopt::Index
m,
const Ipopt::Number* lambda,
135 bool new_lambda, Ipopt::Index nele_hess,
136 Ipopt::Index* iRow, Ipopt::Index* jCol, Ipopt::Number*
values);
140 Ipopt::Index
n,
const Ipopt::Number*
x,
const Ipopt::Number* z_L,
const Ipopt::Number* z_U,
141 Ipopt::Index
m,
const Ipopt::Number*
g,
const Ipopt::Number* lambda,
142 Ipopt::Number obj_value,
143 const Ipopt::IpoptData* ip_data,
144 Ipopt::IpoptCalculatedQuantities* ip_cq);
150 Ipopt::Index iter, Ipopt::Number obj_value,
151 Ipopt::Number inf_pr, Ipopt::Number inf_du,
152 Ipopt::Number mu, Ipopt::Number d_norm,
153 Ipopt::Number regularization_size,
154 Ipopt::Number alpha_du, Ipopt::Number alpha_pr,
155 Ipopt::Index ls_trials,
156 const Ipopt::IpoptData* ip_data,
157 Ipopt::IpoptCalculatedQuantities* ip_cq);
175 Ipopt::Index* pos_nonlin_vars);
CouNumber * sol_
Optimal solution.
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)
return the starting point.
Jacobian of the problem (computed through Couenne expression classes).
CouNumber * getSolution()
returns best solution (if it exists)
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)
return the jacobian of the constraints.
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 ~CouenneTNLP()
Destructor.
ExprHess * HLa_
Hessian — there are 1+m of them, but all are squeezed in a single object.
virtual Ipopt::Index get_number_of_nonlinear_variables()
Pointer to the object containing all info.
CouenneTNLP & operator=(const CouenneTNLP &rhs)
Assignment.
CouenneProblem * problem_
Pointer to the object containing all info.
CouenneTNLP()
Empty constructor.
CouenneSparseMatrix * optHessian_
Stores the values of the Hessian of the Lagrangian at optimum for later use.
Class for sparse Matrixs (used in modifying distances in FP)
virtual bool eval_f(Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Number &obj_value)
return the value of the objective function
bool & getSaveOptHessian()
set and get saveOptHessian_
CouNumber * sol0_
Initial solution.
std::vector< std::pair< int, expression * > > gradient_
expression gradient (packed sparse vector)
CouNumber getSolValue()
returns value of the best solution
virtual bool eval_grad_f(Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Number *grad_f)
return the vector of the gradient of the objective w.r.t. x
CouNumber bestZ_
Value of the optimal solution.
virtual bool get_variables_linearity(Ipopt::Index n, Ipopt::TNLP::LinearityType *var_types)
return the variables linearity (TNLP::Linear or TNLP::NonLinear).
Class for MINLP problems with symbolic information.
virtual void setObjective(expression *newObj)
Change objective function and modify gradient expressions accordingly.
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.
double CouNumber
main number type in Couenne
CouenneSparseMatrix *& optHessian()
Get methods.
bool saveOptHessian_
Flag to be set to save this solution's Lagrangian Hessian in above structure.
virtual bool get_list_of_nonlinear_variables(Ipopt::Index num_nonlin_vars, Ipopt::Index *pos_nonlin_vars)
get real list
virtual bool eval_g(Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Index m, Ipopt::Number *g)
return the vector of constraint values
virtual bool get_nlp_info(Ipopt::Index &n, Ipopt::Index &m, Ipopt::Index &nnz_jac_g, Ipopt::Index &nnz_h_lag, enum Ipopt::TNLP::IndexStyleEnum &index_style)
return the number of variables and constraints, and the number of non-zeros in the jacobian and the h...
CouenneTNLP * clone()
Clone.
void fint fint fint real fint real real real real real real * g
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)
return the information about the bound on the variables and constraints.
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.
virtual bool get_constraints_linearity(Ipopt::Index m, Ipopt::TNLP::LinearityType *const_types)
return the constraint linearity.
Class for handling NLPs using CouenneProblem.
std::set< int > nonLinVars_
list of nonlinear variables
void setInitSol(const double *sol)
set initial solution
void fint fint fint real fint real * x