17 #include "AmplTNLP.hpp"
22 #include "CoinHelperFunctions.hpp"
25 using namespace Ipopt;
29 RegisteredOptions::fillAmplOptionList(
ExtraCategoriesInfo which, Ipopt::AmplOptionsList * amplOptList){
31 std::list< Ipopt::RegisteredOption * > options;
32 chooseOptions(which, options);
33 for(std::list< Ipopt::RegisteredOption * >::iterator i = options.begin();
34 i != options.end() ; i++)
36 std::string name =
"bonmin.";
38 Ipopt::RegisteredOptionType T = (*i)->Type();
39 Ipopt::AmplOptionsList::AmplOptionType type;
41 case Ipopt::OT_Number: type = Ipopt::AmplOptionsList::Number_Option;
43 case Ipopt::OT_Integer: type = Ipopt::AmplOptionsList::Integer_Option;
45 case Ipopt::OT_String: type = Ipopt::AmplOptionsList::String_Option;
47 case Ipopt::OT_Unknown:
49 throw CoinError(
"RegisteredOptions",
"fillAmplOptionList",
"Unknown option type");
51 amplOptList->AddAmplOption(name, name, type, (*i)->ShortDescription());
61 void sos_kludge(
int nsos,
int *sosbeg,
double *sosref);
66 AmplTMINLP::AmplTMINLP()
70 upperBoundingObj_(-1),
74 suffix_handler_(NULL),
75 constraintsConvexities_(NULL),
77 nonConvexConstraintsAndRelaxations_(NULL),
78 numberSimpleConcave_(0),
79 simpleConcaves_(NULL),
80 hasLinearObjective_(false)
88 AmplSuffixHandler* suffix_handler ,
89 const std::string& appName,
90 std::string* nl_file_content
95 upperBoundingObj_(-1),
99 suffix_handler_(NULL),
100 constraintsConvexities_(NULL),
102 nonConvexConstraintsAndRelaxations_(NULL),
103 numberSimpleConcave_(0),
104 simpleConcaves_(NULL),
105 hasLinearObjective_(false)
107 Initialize(jnlst, roptions, options, argv, suffix_handler, appName, nl_file_content);
115 AmplSuffixHandler* suffix_handler ,
116 const std::string& appName,
117 std::string* nl_file_content
124 if (suffix_handler==NULL)
128 suffix_handler->AddAvailableSuffix(
"scaling_factor", AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Number_Type);
129 suffix_handler->AddAvailableSuffix(
"scaling_factor", AmplSuffixHandler::Constraint_Source, AmplSuffixHandler::Number_Type);
130 suffix_handler->AddAvailableSuffix(
"scaling_factor", AmplSuffixHandler::Objective_Source, AmplSuffixHandler::Number_Type);
133 suffix_handler->AddAvailableSuffix(
"ipopt_zL_out", AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Number_Type);
134 suffix_handler->AddAvailableSuffix(
"ipopt_zU_out", AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Number_Type);
135 suffix_handler->AddAvailableSuffix(
"ipopt_zL_in", AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Number_Type);
136 suffix_handler->AddAvailableSuffix(
"ipopt_zU_in", AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Number_Type);
139 suffix_handler->AddAvailableSuffix(
"priority", AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Index_Type);
140 suffix_handler->AddAvailableSuffix(
"direction", AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Number_Type);
141 suffix_handler->AddAvailableSuffix(
"downPseudocost", AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Number_Type);
142 suffix_handler->AddAvailableSuffix(
"upPseudocost", AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Number_Type);
147 suffix_handler->AddAvailableSuffix(
"ref", AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Number_Type);
148 suffix_handler->AddAvailableSuffix(
"sos",AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Index_Type);
149 suffix_handler->AddAvailableSuffix(
"sos",AmplSuffixHandler::Constraint_Source, AmplSuffixHandler::Index_Type);
150 suffix_handler->AddAvailableSuffix(
"sosno",AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Number_Type);
151 suffix_handler->AddAvailableSuffix(
"sosref",AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Number_Type);
152 suffix_handler->AddAvailableSuffix(
"sstatus", AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Index_Type);
153 suffix_handler->AddAvailableSuffix(
"sstatus", AmplSuffixHandler::Constraint_Source, AmplSuffixHandler::Index_Type);
157 suffix_handler->AddAvailableSuffix(
"non_conv",AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Index_Type);
158 suffix_handler->AddAvailableSuffix(
"primary_var",AmplSuffixHandler::Constraint_Source, AmplSuffixHandler::Index_Type);
161 suffix_handler->AddAvailableSuffix(
"onoff_c",AmplSuffixHandler::Constraint_Source, AmplSuffixHandler::Index_Type);
162 suffix_handler->AddAvailableSuffix(
"onoff_v",AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Index_Type);
165 suffix_handler->AddAvailableSuffix(
"UBObj", AmplSuffixHandler::Objective_Source, AmplSuffixHandler::Index_Type);
169 suffix_handler->AddAvailableSuffix(
"perturb_radius",AmplSuffixHandler::Variable_Source, AmplSuffixHandler::Number_Type);
176 std::string options_id = appName +
"_options";
177 ampl_tnlp_ =
new AmplTNLP(jnlst, options, argv, suffix_handler,
true,
178 ampl_options_list, options_id.c_str(),
179 appName.c_str(), appName.c_str(), nl_file_content);
191 Index n_non_linear_b= 0;
192 Index n_non_linear_bi= 0;
193 Index n_non_linear_c= 0;
194 Index n_non_linear_ci = 0;
195 Index n_non_linear_o= 0;
196 Index n_non_linear_oi = 0;
197 Index n_binaries = 0;
198 Index n_integers = 0;
199 ampl_tnlp_->get_discrete_info(n_non_linear_b, n_non_linear_bi, n_non_linear_c,
200 n_non_linear_ci, n_non_linear_o, n_non_linear_oi,
201 n_binaries, n_integers);
202 if (n_non_linear_b == 0 && n_non_linear_o == 0) {
218 int numcols,
m, dummy1, dummy2;
219 TNLP::IndexStyleEnum index_style;
220 ampl_tnlp_->get_nlp_info(numcols, m, dummy1, dummy2, index_style);
224 const Index* pri = suffix_handler->GetIntegerSuffixValues(
"priority", AmplSuffixHandler::Variable_Source);
225 const Index* brac = suffix_handler->GetIntegerSuffixValues(
"direction", AmplSuffixHandler::Variable_Source);
226 const Number* upPs = suffix_handler->GetNumberSuffixValues(
"upPseudocost", AmplSuffixHandler::Variable_Source);
227 const Number* dwPs = suffix_handler->GetNumberSuffixValues(
"downPseudocost", AmplSuffixHandler::Variable_Source);
234 for (
int i = 0 ; i < numcols ; i++) {
241 if (upPs && !dwPs) dwPs = upPs;
242 else if (dwPs && !upPs) upPs = dwPs;
251 const double* perturb_radius =
252 suffix_handler->GetNumberSuffixValues(
"perturb_radius", AmplSuffixHandler::Variable_Source);
259 ASL_pfgh* asl =
ampl_tnlp_->AmplSolverObject();
261 int copri[2], **p_sospri;
265 int * indices = NULL;
267 double * weights = NULL;
268 int * priorities = NULL;
269 p_sospri = &priorities;
274 &starts, &indices, &weights);
276 throw CoinError(
"number of constraints changed by suf_sos. Not supported.",
277 "read_sos",
"Bonmin::AmplTMINLP");
288 for (
int ii=0;ii<
sos_.
num;ii++) {
290 if (ichar != 1 && ichar != 2) {
291 std::cerr<<
"Unsuported type of sos constraint: "<<
sos_.
types[ii]<<std::endl;
294 sos_.
types[ii]=
static_cast<char>(ichar);
302 ASL_pfgh* asl =
ampl_tnlp_->AmplSolverObject();
305 if (n_obj < 2)
return;
309 const Index* UBObj = suffix_handler->GetIntegerSuffixValues(
"UBObj", AmplSuffixHandler::Objective_Source);
312 int lowerBoundingObj = (UBObj[0] == 1)? 1:0;
314 ampl_tnlp_->set_active_objective(lowerBoundingObj);
317 for (
int i = 0; i < n_obj; i++) {
320 jnlst_->Printf(J_ERROR, J_MAIN,
321 "Too many objectives for upper-bounding");
354 ASL_pfgh* asl =
ampl_tnlp_->AmplSolverObject();
358 const Index *
id = suffix_handler->GetIntegerSuffixValues(
"non_conv", AmplSuffixHandler::Variable_Source);
359 const Index * primary_var = suffix_handler->GetIntegerSuffixValues(
"primary_var", AmplSuffixHandler::Constraint_Source);
362 if (primary_var!= NULL) {
368 std::cerr<<
"Incorrect suffixes description in ampl model. n_conv's are not declared "<<std::endl;
371 int numberSimpleConcave = 0;
372 std::map<int, int> id_map;
374 for (
int i = 0 ; i < n_var ; i++) {
379 for (
int i = 0 ; i < n_con ; i++) {
380 if (primary_var[i] != 0) {
382 numberSimpleConcave++;
388 numberSimpleConcave = 0;
389 int * jCol =
new int[n_var];
390 for (
int i = 0 ; i < n_con ; i++) {
391 if (primary_var[i] != 0) {
403 std::cout<<
"Incorrect suffixes description in ampl model. Constraint with id "
404 <<
id<<
" is simple concave and should have only two nonzero elements"<<std::endl;
407 if (jCol[0] - 1== yIdx) {
411 if (jCol[1] - 1!= yIdx) {
412 std::cout<<
"Incorrect suffixes description in ampl model. Constraint with id "
413 <<
id<<
" : variable marked as y does not appear in the constraint."<<std::endl;
418 numberSimpleConcave++;
431 ASL_pfgh* asl =
ampl_tnlp_->AmplSolverObject();
435 const Index * onoff_c = suffix_handler->GetIntegerSuffixValues(
"onoff_c", AmplSuffixHandler::Constraint_Source);
436 const Index * onoff_v = suffix_handler->GetIntegerSuffixValues(
"onoff_v", AmplSuffixHandler::Variable_Source);
438 if(onoff_c == NULL && onoff_v == NULL){
441 if(onoff_c == NULL || onoff_v == NULL){
442 std::cerr<<
"Incorrect suffixes description in ampl model. One of per_v or per_c is declared but not the other."<<std::endl;
448 std::map<int, int> id_map;
450 for (
int i = 0 ; i < n_var ; i++) {
452 id_map[onoff_v[i]] = i;
455 for (
int i = 0 ; i < n_con ; i++) {
457 std::map<int, int >::iterator
k = id_map.find(onoff_c[i]);
458 if(k != id_map.end()){
462 std::cerr<<
"Incorrect suffixes description in ampl model. onoff_c has value attributed to no variable "<<std::endl;
471 return ampl_tnlp_->get_nlp_info(n, m, nnz_jac_g, nnz_h_lag, index_style);
480 Index n_non_linear_b= 0;
481 Index n_non_linear_bi= 0;
482 Index n_non_linear_c= 0;
483 Index n_non_linear_ci = 0;
484 Index n_non_linear_o= 0;
485 Index n_non_linear_oi = 0;
486 Index n_binaries = 0;
487 Index n_integers = 0;
488 ampl_tnlp_->get_discrete_info(n_non_linear_b, n_non_linear_bi, n_non_linear_c,
489 n_non_linear_ci, n_non_linear_o, n_non_linear_oi,
490 n_binaries, n_integers);
491 int totalNumberOfNonContinuous = 0;
497 Index
end = n_non_linear_b - n_non_linear_bi;
498 for (
int i=start; i<
end; i++) {
504 end = start + n_non_linear_bi;
505 for (
int i=start; i <
end; i++) {
507 totalNumberOfNonContinuous++;
512 end = std::max(start,end + n_non_linear_c - n_non_linear_ci - n_non_linear_b);
513 for (
int i=start; i<
end; i++) {
519 end = start + n_non_linear_ci;
520 for (
int i=start; i <
end; i++) {
522 totalNumberOfNonContinuous++;
528 end = std::max(start,end + n_non_linear_o - std::max(n_non_linear_b, n_non_linear_c) - n_non_linear_oi);
529 for (
int i=start; i<
end; i++) {
535 end = start + n_non_linear_oi;
536 for (
int i=start; i <
end; i++) {
538 totalNumberOfNonContinuous++;
544 end = n - n_binaries - n_integers;
545 for (
int i=start; i<
end; i++) {
551 end = start + n_binaries;
552 for (
int i=start; i <
end; i++) {
554 totalNumberOfNonContinuous++;
559 end = start + n_integers;
560 for (
int i=start; i <
end; i++) {
562 totalNumberOfNonContinuous++;
573 Index n_non_linear_b= 0;
574 Index n_non_linear_bi= 0;
575 Index n_non_linear_c= 0;
576 Index n_non_linear_ci = 0;
577 Index n_non_linear_o= 0;
578 Index n_non_linear_oi = 0;
579 Index n_binaries = 0;
580 Index n_integers = 0;
581 ampl_tnlp_->get_discrete_info(n_non_linear_b, n_non_linear_bi, n_non_linear_c,
582 n_non_linear_ci, n_non_linear_o, n_non_linear_oi,
583 n_binaries, n_integers);
586 int n_non_linear = std::max(n_non_linear_c, n_non_linear_o);
591 int end = n_non_linear;
592 for (
int i=start; i<
end; i++) {
593 var_types[i] = Ipopt::TNLP::NON_LINEAR;
600 for (
int i=start; i<
end; i++) {
610 Ipopt::TNLP::LinearityType* const_types)
612 return ampl_tnlp_->get_constraints_linearity(m, const_types);
616 Index
m, Number* g_l, Number* g_u)
618 return ampl_tnlp_->get_bounds_info(n, x_l, x_u, m, g_l, g_u);
622 bool init_z, Number* z_L, Number* z_U,
623 Index
m,
bool init_lambda, Number* lambda)
625 return ampl_tnlp_->get_starting_point(n, init_x, x,
627 m, init_lambda, lambda);
632 return ampl_tnlp_->eval_f(n, x, new_x, obj_value);
637 return ampl_tnlp_->eval_grad_f(n, x, new_x, grad_f);
646 Index
m, Index nele_jac, Index* iRow,
647 Index *jCol, Number*
values)
650 m, nele_jac, iRow, jCol,
655 Number obj_factor, Index
m,
const Number* lambda,
656 bool new_lambda, Index nele_hess, Index* iRow,
657 Index* jCol, Number*
values)
659 return ampl_tnlp_->eval_h(n, x, new_x, obj_factor,
660 m, lambda, new_lambda, nele_hess, iRow,
667 ASL_pfgh* asl =
ampl_tnlp_->AmplSolverObject();
673 gi = conival(i, const_cast<real*>(x), &nerror);
683 Index i, Index& nele_grad_gi, Index* jCol,
686 ASL_pfgh* asl =
ampl_tnlp_->AmplSolverObject();
692 for (cgrad* cg=Cgrad[i]; cg; cg = cg->next) {
693 jCol[nele_grad_gi++] = cg->varno + 1;
702 asl->i.congrd_mode = 1;
704 congrd(i, const_cast<real*>(x), values, &nerror);
714 Index
n,
const Number*
x, Number obj_value)
716 ASL_pfgh* asl =
ampl_tnlp_->AmplSolverObject();
718 std::string status_str;
720 status_str =
"\t\"Finished\"";
721 message =
"\n" +
appName_ +
": Optimal";
722 solve_result_num = 3;
725 status_str =
"\t\"Finished\"";
726 message =
"\n" +
appName_ +
": Infeasible problem";
727 solve_result_num = 220;
730 status_str =
"\t\"Finished\"";
731 message =
"\n" +
appName_ +
" Continuous relaxation is unbounded.";
732 solve_result_num = 300;
735 status_str =
"\t\"Not finished\"";
736 message =
"\n" +
appName_ +
": Optimization interrupted on limit.";
738 solve_result_num = 421;
740 solve_result_num = 410;
743 status_str =
"\t\"Not finished\"";
744 message =
"\n" +
appName_ +
": Optimization interrupted by user.";
746 solve_result_num = 422;
748 solve_result_num = 411;
751 status_str =
"\t\"Aborted\"";
752 message =
"\n" +
appName_ +
": Error encountered in optimization.";
753 solve_result_num = 500;
757 std::cout<<
"\n "<<status_str<<std::endl;
760 std::cout<<status_str<<message<<std::endl;
761 std::string fName =
appName_ +
".sol";
762 std::ofstream of(fName.c_str());
763 for (
int i = 0 ; i <
n ; i++) {
764 of<<i<<
"\t"<<x[i]<<std::endl;
772 ASL_pfgh* asl =
ampl_tnlp_->AmplSolverObject();
779 char* cmessage =
new char[message.length()+1];
780 strcpy(cmessage, message.c_str());
783 double* x_sol_copy = NULL;
785 x_sol_copy =
new double[n_var];
786 for (
int i=0; i<n_var; i++) {
787 x_sol_copy[i] = x_sol[i];
790 write_sol(cmessage, x_sol_copy, NULL, NULL);
792 delete [] x_sol_copy;
801 Index
n,
m, nnz_jac_g, nnz_h_lag;
802 TNLP::IndexStyleEnum index_style = TNLP::FORTRAN_STYLE;
805 Index n_non_linear_b= 0;
806 Index n_non_linear_bi= 0;
807 Index n_non_linear_c= 0;
808 Index n_non_linear_ci = 0;
809 Index n_non_linear_o= 0;
810 Index n_non_linear_oi = 0;
811 Index n_binaries = 0;
812 Index n_integers = 0;
813 ampl_tnlp_->get_discrete_info(n_non_linear_b, n_non_linear_bi, n_non_linear_c,
814 n_non_linear_ci, n_non_linear_o, n_non_linear_oi,
815 n_binaries, n_integers);
820 Index
end = n_non_linear_b;
821 for (
int i=start; i<
end; i++) {
830 start = end + n_non_linear_c;
831 end = start + n_non_linear_o;
832 for (
int i=start; i <
end; i++) {
846 ASL_pfgh* asl =
ampl_tnlp_->AmplSolverObject();
851 jnlst_->Printf(J_ERROR, J_MAIN,
852 "Error in evaluating upper bounding objecting");
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.
Option category for Bqpd.
Base class for all MINLPs that use a standard triplet matrix form and dense vectors.
int cIdx
Index of the nonconvex constraint.
std::string appName_
Name of application.
int num
Number of SOS constraints.
Structure for marked non-convex constraints.
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 ...
const ASL_pfgh * AmplSolverObject() const
Return the ampl solver object (ASL*)
int scXIdx
Index of variable x in a simple concave constraint of type y >= F(x).
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 read_sos()
read the sos constraints from ampl suffixes
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.
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.
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.
Ipopt::AmplTNLP * ampl_tnlp_
pointer to the internal AmplTNLP
SosInfo sos_
Storage of sos constraints.
Bonmin::BqpdSolver::fint fint
double * downPsCosts
User set down pseudo costs.
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 ...
void sos_kludge(int nsos, int *sosbeg, double *sosref)
PerturbInfo perturb_info_
Storage for perturbation radii.
void write_solution(const std::string &message, const Ipopt::Number *x_sol)
Write the solution using ampl's write_sol (called by finalize_solution).
NonConvexSuff()
Default constructor.
BranchingInfo branch_
Storage of branching priorities information.
int numberNonConvex_
Ipopt::Number of nonConvex constraints.
int * branchingDirections
User set preferered branching direction.
virtual void fillApplicationOptions(Ipopt::AmplOptionsList *amplOptList)
Additional application specific options.
virtual void getLinearPartOfObjective(double *obj)
This methods gives the linear part of the objective function.
Option category for FilterSqp.
int * starts
For 0 <= i < nums, start[i] gives the indice of indices and weights arrays at which the description o...
Ipopt::SmartPtr< const Ipopt::Journalist > jnlst_
Journalist.
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
User set priorities on variables.
Structure which describes a constraints of the form $f[ y F(x) ] with a concave function...
bool hasLinearObjective_
Flag to indicate if objective function is linear.
SolverReturn
Return statuses of algorithm.
int numNz
Total number of non zeroes in SOS 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)
specifies the structure of the hessian of the lagrangian (if values is NULL) and evaluates the values...
virtual bool get_constraints_linearity(Ipopt::Index m, Ipopt::TNLP::LinearityType *const_types)
Returns the constraint linearity.
Constraint is concave of the simple form y >= F(x).
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.
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 * priorities
priorities of sos constraints.
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.
int xIdx
Index of the variable x.
To store all data stored in the nonconvex suffixes.
U * GetRawPtr(const OSSmartPtr< U > &smart_ptr)
NonConvexSuff(const NonConvexSuff &other)
Copy constructor.
virtual bool get_variables_types(Ipopt::Index n, VariableType *var_types)
returns the vector of variable types
TMINLP::Convexity * constraintsConvexities_
Store constraints types.
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
int writeAmplSolFile_
Flag to say if AMPL solution file should be written.
AmplTMINLP()
Default constructor.
int numberSimpleConcave_
Ipopt::Number of simpleConcave constraints.
int cIdx
Index of the constraint.
SimpleConcaveConstraint * simpleConcaves_
Store simple concave constraints descriptions.
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 get_variables_linearity(Ipopt::Index n, Ipopt::TNLP::LinearityType *var_types)
return the variables linearity (linear or not)
void read_obj_suffixes()
Read suffixes on objective functions for upper bounding.
void fint fint fint real fint real real real real real real * g
int size
number of variables
int upperBoundingObj_
Index of the objective to use for upper bounding.
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.
void read_priorities()
read the branching priorities from ampl suffixes.
int scYIdx
Index of variable y in a simple concave constraint of type y >= F(x).
int nnz
ATTENTION: Filter expect the jacobian to be ordered by row.
int cRelaxIdx
Index of constraint relaxing the nonconvex constraint.
Ipopt::SmartPtr< Ipopt::AmplSuffixHandler > suffix_handler_
Store a suffix handler.
int relIdx
Index of its relaxation.
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.
VariableType
Type of the variables.
void gutsOfDestructor()
Reset information.
virtual ~AmplTMINLP()
destructor
double * upPsCosts
User set up pseudo costs.
int yIdx
Index of the variable y.
double * weights
weights of the elements of the SOS.
void fint fint fint real fint real * x