11 #include "CbcModel.hpp"
12 #include "CoinTime.hpp"
13 #include "CoinHelperFunctions.hpp"
23 using namespace Ipopt;
24 using namespace Couenne;
55 bool firstNLP = (nlp_ == NULL);
60 problem_ -> domain () -> push (problem_ -> nVars (),
62 problem_ -> domain () -> lb (),
63 problem_ -> domain () -> ub ());
68 *oldObj = problem_ -> Obj (0) -> Body (),
69 *newObj = updateNLPObj (iSol);
71 newObj -> realign (problem_);
72 problem_ -> setObjective (0, newObj);
73 nlp_ -> setObjective (newObj);
75 if (problem_ -> Jnlst () -> ProduceOutput (J_ALL,
J_NLPHEURISTIC)) {
76 printf (
"----------------------- now solving NLP:\n");
78 printf (
"-----------------------\n");
84 nlp_ -> setInitSol (iSol);
88 ApplicationReturnStatus status = firstNLP ?
89 app_ -> OptimizeTNLP (nlp_) :
90 app_ -> ReOptimizeTNLP (nlp_);
94 if (nlp_ -> getSolution ())
96 if (nSol) CoinCopyN (nlp_ -> getSolution (), problem_ -> nVars (), nSol);
97 else nSol = CoinCopyOfArray (nlp_ -> getSolution (), problem_ -> nVars ());
99 else problem_ -> Jnlst () -> Printf (J_WARNING,
J_NLPHEURISTIC,
"FP: warning, NLP returns a NULL solution\n");
101 if (nlp_ -> getSolution () && (problem_ -> Jnlst () -> ProduceOutput (J_ALL,
J_NLPHEURISTIC))) {
102 printf (
"######################## NLP solution (nlp):\n");
103 for (
int i=0; i< problem_ -> nVars ();) {
104 printf (
"%+e ", nSol [i]);
105 if (!(++i % 15)) printf (
"\n");
113 problem_ -> setObjective (0, oldObj);
115 if ((status != Solve_Succeeded) &&
116 (status != Solved_To_Acceptable_Level))
118 problem_ -> Jnlst () -> Printf
119 (J_WARNING,
J_NLPHEURISTIC,
"Feasibility Pump: Error solving NLP problem\n");
121 retval = nlp_ -> getSolValue ();
123 problem_ -> domain () -> pop ();
double CouNumber
main number type in Couenne
const Ipopt::EJournalCategory J_NLPHEURISTIC(Ipopt::J_USER5)
Class for handling NLPs using CouenneProblem.