BonCouenne.cpp
Go to the documentation of this file.
1 // $Id: BonCouenne.cpp 1121 2015-03-01 15:12:50Z pbelotti $
2 //
3 // (C) Copyright International Business Machines Corporation and Carnegie Mellon University 2006, 2007
4 // All Rights Reserved.
5 // This code is published under the Eclipse Public License (EPL).
6 //
7 // Authors :
8 // Pietro Belotti, Carnegie Mellon University,
9 // Pierre Bonami, International Business Machines Corporation
10 //
11 // Date : 12/19/2006
12 
13 
14 #include <iomanip>
15 #include <fstream>
16 
17 #include <stdlib.h>
18 
19 #include "CoinPragma.hpp"
20 #include "CoinTime.hpp"
21 #include "CoinError.hpp"
22 #include "BonCouenneInterface.hpp"
23 
24 #include "BonCouenneSetup.hpp"
25 
26 #include "BonCbc.hpp"
27 #include "CouenneBab.hpp"
28 
29 #include "CbcCutGenerator.hpp"
30 #include "CouenneProblem.hpp"
31 #include "CouenneCutGenerator.hpp"
32 
33 #include "CouenneRecordBestSol.hpp"
34 
35 using namespace Couenne;
36 
37 // the maximum difference between a printed optimum and a CouNumber
38 #define PRINTED_PRECISION 1e-5
39 
40 #include "CouenneExprVar.hpp"
41 #include "CouenneExprConst.hpp"
42 #include "CouenneExprSum.hpp"
43 #include "CouenneExprClone.hpp"
44 #include "CouenneProblemElem.hpp"
45 #include "CouenneProblem.hpp"
46 #include "CouenneJournalist.hpp"
47 
48 #ifdef COIN_HAS_NTY
49 #include "Nauty.h"
51 #endif
52 
53 #ifdef COIN_HAS_SCIP
54 #include "lpiswitch.h"
55 #endif
56 
57 #include "CoinSignal.hpp"
58 
59 #undef printError // defined in SCIP, replaces error handling below...
60 
61 #if 0
62 extern "C" {
63 
64  static int nInterrupts = 0;
65  static void signal_handler (int sig) {
66 
67  if (!nInterrupts) {
68  std::cerr << "[BREAK]" << std::endl;
69  abort ();
70  }
71  return;
72  }
73 }
74 #endif
75 
76 //#define FM_FRES
77 
78 // restored working version
79 
80 int main (int argc, char *argv[]) {
81 
82 #ifdef WIN_
83  srand ((long) 42*666);
84 #endif
85 
86  //CoinSighandler_t saveSignal = SIG_DFL;
87  //saveSignal = signal (SIGINT, signal_handler);
88 
89  printf ("\
90 Couenne %s -- an Open-Source solver for Mixed Integer Nonlinear Optimization\n\
91 Mailing list: couenne@list.coin-or.org\n\
92 Instructions: http://www.coin-or.org/Couenne\n",
93  strcmp (COUENNE_VERSION, "trunk") ? COUENNE_VERSION : "");
94 
95  WindowsErrorPopupBlocker();
96 
97  using namespace Ipopt;
98 
99 #ifdef COIN_HAS_SCIP
100  //SCIPlpiSwitchSetDefaultSolver();
101  SCIPlpiSwitchSetSolver(SCIP_LPISW_CLP);
102 #endif
103 
104  char * pbName = NULL;
105 
106  bool infeasible = false;
107 
108  try {
109 
110  CouenneBab bb;
111 
112  CouenneProblem *p = NULL;
113  CouenneInterface *ci = NULL;
114 
115 #if 0
116  //ci = new CouenneInterface;
117  p = new CouenneProblem;
118 
119  p -> addVariable (false, p -> domain ());
120  p -> addVariable (false, p -> domain ());
121  p -> addVariable (false, p -> domain ());
122  p -> addVariable (false, p -> domain ());
123 
124  p -> addObjective (new exprSum (new exprClone (p->Var (1)), new exprClone (p->Var (2))), "min");
125  p -> addLEConstraint (new exprSum (new exprClone (p->Var (0)), new exprClone (p->Var (2))), new exprConst (1));
126  p -> addEQConstraint (new exprSum (new exprClone (p->Var (1)), new exprClone (p->Var (2))), new exprConst (1));
127  p -> addEQConstraint (new exprSum (new exprClone (p->Var (1)), new exprClone (p->Var (3))), new exprConst (1));
128  p -> addEQConstraint (new exprSum (new exprClone (p->Var (2)), new exprClone (p->Var (3))), new exprConst (1));
129 #endif
130 
131  CouenneSetup couenne;
132  CouenneCutGenerator *cg = NULL;
133  ConstJnlstPtr jnlst;
134  CouenneProblem *prob = NULL;
135 
136  infeasible = !(couenne.InitializeCouenne (argv, p, NULL, ci, &bb));
137 
138  // there is only one CouenneCutGenerator object; scan array until
139  // dynamic_cast returns non-NULL
140 
141  if (couenne. cutGenerators () . size () > 0) {
142 
143  for (std::list <Bonmin::BabSetupBase::CuttingMethod>::iterator
144  i = couenne.cutGenerators () . begin ();
145  !cg && (i != couenne.cutGenerators () . end ());
146  ++i)
147 
148  cg = dynamic_cast <CouenneCutGenerator *> (i -> cgl);
149  }
150 
151  // This assumes that first cut generator is CouenneCutGenerator
152  // CouenneCutGenerator *cg = dynamic_cast<CouenneCutGenerator *>
153  // (couenne.cutGenerators().begin()->cgl);
154 
155  if (cg)
156 
157  cg -> setBabPtr (&bb);
158 
159  else if (!infeasible) {
160 
161  printf ("main(): ### ERROR: Can not get CouenneCutGenerator\n");
162  exit (-1);
163  }
164 
165  // initial printout
166 
167  jnlst = couenne. couennePtr () -> Jnlst ();
168  prob = couenne. couennePtr () -> Problem ();
169 
170  bb. setProblem (prob);
171 
172  int retcomp = 2; // unspecified.
173 
174  jnlst -> Printf (J_ERROR, J_COUENNE, "\
175 Loaded instance \"%s\"\n\
176 Constraints: %8d\n\
177 Variables: %8d (%d integer)\n\
178 Auxiliaries: %8d (%d integer)\n\n",
179  prob -> problemName ().c_str (),
180  prob -> nOrigCons (),
181  prob -> nOrigVars (),
182  prob -> nOrigIntVars (),
183  prob -> nVars () - prob -> nOrigVars (),
184  CoinMax (0, prob -> nIntVars () - prob -> nOrigIntVars ()));
185 
186  double time_start = CoinCpuTime();
187 
188 #if 0
189  CouenneFeasibility feasibility;
190  bb.model().setProblemFeasibility (feasibility);
191 #endif
192 
193  couenne.options () -> SetIntegerValue ("bb_log_level", 1);
194  couenne.options () -> SetIntegerValue ("lp_log_level", 0);
195  couenne.options () -> SetIntegerValue ("nlp_log_level", 0);
196 
198  double timeLimit = 0;
199  couenne.options () -> GetNumericValue ("time_limit", timeLimit, "couenne.");
200  couenne.setDoubleParameter (Bonmin::BabSetupBase::MaxTime,
201  CoinMax (1., timeLimit - time_start));
202 
203  //jnlst -> Printf (J_ERROR, J_COUENNE, "Starting branch-and-bound\n");
204 
206 
207 #ifdef COIN_HAS_NTY
208  double symmGroupSize = prob -> orbitalBranching () ? prob -> getNtyInfo () -> getGroupSize () : -1;
209 #endif
210 
211  // run FP and exit if its option is equal to "only"
212 
213  std::string s;
214  couenne.options () -> GetStringValue ("feas_pump_heuristic", s, "couenne.");
215 
216  // if ("only" == s) {
217  // CouenneFeasPump *nlpHeuristic = NULL;
218  // for (std::list<struct Bonmin::BabSetupBase::HeuristicMethod>::iterator i = couenne.heuristics(). begin();
219  // i!=couenne.heuristics(). end() && !nlpHeuristic; ++i) {
220  // nlpHeuristic = dynamic_cast <CouenneFeasPump *> (i -> heuristic);
221  // }
222  // if (!nlpHeuristic) jnlst -> Printf (J_ERROR, J_COUENNE, "Set feas_pump_heuristic to \"once\" but FP not found.\n");
223  // else {
224  // CouNumber
225  // *newsol = new CouNumber [prob -> nVars ()],
226  // objval;
227  // nlpHeuristic -> solution (objval, newsol);
228  // // check solution and saves it
229  // if (! (prob -> checkNLP2 (newsol, 0, false, true, false, prob -> getFeasTol ())))
230  // jnlst -> Printf (J_ERROR, J_COUENNE, "Single run of FP found an infeasible solution\n");
231  // delete [] newsol;
232  // couenne.options () -> SetNumericValue ("time_limit", 0.001, "couenne.");
233  // couenne.setDoubleParameter (Bonmin::BabSetupBase::MaxTime, 0.001);
234  // }
235  // }
236 
237  if (!infeasible) // /|-------------=
238  bb (couenne); // do branch and bound // < | =
239  // \|-------------=
240  else {
241 
242  char *filename = new char [prob -> problemName (). length () + strlen ((char *) ".sol") + 1],
243  *lastdot;
244 
245  FILE *amplsol;
246 
247  strcpy (filename, prob -> problemName () . c_str ());
248 
249  if ((lastdot = strrchr (filename, '.')) != NULL)
250  *lastdot = 0;
251 
252  strcat (filename, ".sol");
253 
254  amplsol = fopen (filename, "w");
255 
256  if (amplsol != NULL) {
257 
258  fprintf (amplsol, "\n Couenne (%s %s): Infeasible\n\nOptions\n3\n0\n1\n0\n%d\n0\n%d\n0\nobjno 0 220\n",
259  prob -> problemName (). c_str (),
260  __DATE__,
261  prob -> nOrigCons (),
262  prob -> nOrigVars ());
263 
264  fclose (amplsol);
265  }
266 
267  delete [] filename;
268  }
269 
270 #ifdef COIN_HAS_NTY
272  printf ("%d orbital nontrivial branchings\n", CouenneBranchingObject::nOrbBr);
273 #endif
274 
275  std::cout.precision (10);
276 
277  int nr=-1, nt=-1;
278  double st=-1;
279 
280  if (cg) cg -> getStats (nr, nt, st);
281  else printf ("Warning, could not get pointer to CouenneCutGenerator\n");
282 
283  CouenneProblem *cp = cg ? cg -> Problem () : NULL;
284 
285 #if defined (FM_TRACE_OPTSOL) || defined (FM_FRES)
286  double cbcLb = (infeasible ? -COIN_DBL_MAX : bb.model (). getBestPossibleObjValue ());
287  double printObj = 0;
288  bool foundSol = false;
289 #endif
290 
291 #ifdef FM_TRACE_OPTSOL
292 
293  //FILE *fSol = fopen ("bidon.sol", "w");
294 
295  // if(fSol == NULL) {
296  // printf("### ERROR: can not open bidon.sol\n");
297  // exit(1);
298  // }
299 
300  if (cp != NULL) {
301  double cbcObjVal = infeasible ? COIN_DBL_MAX : bb.model().getObjValue();
302  int modelNvars = prob -> nVars ();//bb.model().getNumCols();
303 
305  const double *cbcSol = infeasible ? NULL : bb.model().getColSolution();
306  double *modCbcSol = new double[modelNvars];
307  double modCbcSolVal= 1e100, modCbcSolMaxViol = 0;
308  bool cbcSolIsFeas = false;
309 
310  if(modelNvars != cp->nVars()) {
311  printf("### ERROR: modelNvars: %d nVars: %d\n",
312  modelNvars, cp->nVars());
313  exit(1);
314  }
315 
316  // round cbcSol's integer coordinates
317 
318  // for (int i=0; i<modelNvars; i++)
319  // if (cp -> Var (i) -> isDefinedInteger ())
320  // cbcSol [i] = COUENNE_round (cbcSol [i]);
321 
322  if (cbcObjVal < 1e49 && !infeasible) {
323 
324 #ifdef FM_CHECKNLP2
325  int cMS = rs->getCardModSol();
326  cbcSolIsFeas = cp->checkNLP2(cbcSol, 0, false, // do not care about obj
327  false, // do not stop at first viol
328  true, // checkAll
329  cp->getFeasTol());
330  cMS = rs->getCardModSol(); // re-read in case it changed after checkNLP2 (it could be -1 if no solution present)
331  CoinCopyN(rs->getModSol(cMS), cMS, modCbcSol);
332  modCbcSolVal = rs->getModSolVal();
333  modCbcSolMaxViol = rs->getModSolMaxViol();
334 #else /* not FM_CHECKNLP2 */
335  int cMS = cp->nVars();
336  cbcSolIsFeas = cp->checkNLP(cbcSol, modCbcSolVal, true);
337  CoinCopyN(cbcSol, cMS, modCbcSol);
338  modCbcSolMaxViol = cp->getFeasTol();
339 #endif /* not FM_CHECKNLP2 */
340  foundSol = true;
341  }
342 
343  const double *couenneSol = rs->getSol();
344  double *modCouenneSol = new double[modelNvars];
345  double modCouenneSolVal= 1e100, modCouenneSolMaxViol = 0;
346  bool couenneSolIsFeas = false;
347 
348  // round couenneSol's integer coordinates
349 
350  // for (int i=0; i<modelNvars; i++)
351  // if (cp -> Var (i) -> isDefinedInteger ())
352  // couenneSol [i] = COUENNE_round (couenneSol [i]);
353 
354  if(couenneSol != NULL) {
355 #ifdef FM_CHECKNLP2
356  int cMS = rs->getCardModSol();
357  couenneSolIsFeas = cp->checkNLP2(couenneSol, 0, false,
358  false, true,
359  cp->getFeasTol());
360  CoinCopyN(rs->getModSol(cMS), cMS, modCouenneSol);
361  modCouenneSolVal = rs->getModSolVal();
362  modCouenneSolMaxViol = rs->getModSolMaxViol();
363 #else /* not FM_CHECKNLP2 */
364  int cMS = cp->nVars();
365  couenneSolIsFeas = cp->checkNLP(couenneSol, modCouenneSolVal, true);
366  CoinCopyN(couenneSol, cMS, modCouenneSol);
367  modCouenneSolMaxViol = cp->getFeasTol();
368 #endif /* not FM_CHECKNLP2 */
369  foundSol = true;
370  }
371 
372  retcomp = rs -> compareAndSave (modCbcSol, modCbcSolVal, modCbcSolMaxViol, cbcSolIsFeas,
373  modCouenneSol, modCouenneSolVal, modCouenneSolMaxViol, couenneSolIsFeas,
374  modelNvars, cp->getFeasTol());
375 
376 
377  // rs now has the best and/or least violated solution. Write it out if required
378 
379  std::string saveSol;
380 
381  couenne.options () -> GetStringValue ("save_soltext", saveSol, "couenne.");
382 
383  if (saveSol == "yes") {
384 
385  char *txtFileName = new char [20 + cp -> problemName () . length ()];
386 
387  sprintf (txtFileName, "%s-sol.txt", cp -> problemName (). c_str ());
388 
389  FILE *txtSol = fopen (txtFileName, "w");
390 
391  if (txtSol == NULL) {
392 
393  printf ("Could not create file %s for solving solution\n", txtFileName);
394 
395  } else {
396 
397  cp -> domain () -> push (cp -> nOrigVars (), rs -> getSol (), NULL, NULL);
398 
399  cp -> initAuxs (); // to get auxiliaries in case some of these were previously originals
400 
401  for (std::vector <exprVar *>::iterator it = cp -> Variables (). begin ();
402  it != cp -> Variables(). end (); ++it) {
403 
404  if ((*it) -> Index () >= cp -> nOrigVars ())
405  continue;
406 
407  if ((*it) -> Multiplicity () == 0) {
408 
409  if ((*it) -> Image ()) fprintf (txtSol, "%d %e\n", (*it) -> Index (), (*(*it) -> Image ()) ());
410  else fprintf (txtSol, "%d %e\n", (*it) -> Index (), 0);
411 
412  } else fprintf (txtSol, "%d %e\n", (*it) -> Index (), (*(*it)) ());
413  }
414 
415  cp -> domain () -> pop ();
416  }
417 
418  fclose (txtSol);
419 
420  delete [] txtFileName;
421  }
422 
423  // switch (retcomp) {
424  // case -1: printf("No solution found\n"); break;
425  // case 0: printf("Best solution found by Cbc. Value: %10.4f. Tolerance: %10g\n", modCbcSolVal, modCbcSolMaxViol); break;
426  // case 1: //printf("Best solution found by Couenne Value: %10.4f Tolerance: %10g\n", modCouenneSolVal, modCouenneSolMaxViol); break;
427  // default: break; // never happens
428  // }
429 
430  if(rs->getHasSol()) {
431  if(cbcLb > rs->getVal()) { // Best sol found by Couenne and not
432  // transmitted to Cbc
433  cbcLb = rs->getVal();
434  }
435  printObj = rs->getVal();
436  //rs->printSol(fSol);
437  }
438  delete[] modCbcSol;
439  delete[] modCouenneSol;
440  }
441  //fclose(fSol);
442 #endif /* FM_TRACE_OPTSOL */
443 
444 #ifdef FM_FRES
445  if(cp != NULL) {
446  FILE *f_res = NULL;
447  f_res = fopen("fres.xxx", "r");
448  if(f_res == NULL) {
449  f_res = fopen("fres.xxx", "w");
450  fprintf(f_res, "END_OF_HEADER\n");
451  }
452  else {
453  fclose(f_res);
454  f_res = fopen("fres.xxx", "a");
455  }
456  char *pbName, shortName[256];
457 
458  pbName = strdup(cp -> problemName ().c_str ());
459  char *f_name_pos = strrchr(pbName, '/');
460  if(f_name_pos != NULL) {
461  strcpy(shortName, &(f_name_pos[1]));
462  }
463  else {
464  strcpy(shortName, pbName);
465  }
466 
467 
468  fprintf(f_res, "%20s ", shortName);
469  if((cbcLb > 1e20) || (cbcLb < -1e20)) {
470  fprintf(f_res, "%10.4g", cbcLb);
471  }
472  else {
473  fprintf(f_res, "%10.4f", cbcLb);
474  }
475  if(foundSol) {
476  fprintf(f_res, " %10.4f", printObj);
477  }
478  else {
479  fprintf(f_res, " *");
480  }
481  fprintf(f_res, " %10d %10.4f\n", infeasible ? 0 : bb.numNodes (),
482  CoinCpuTime () - time_start);
483  fclose(f_res);
484  }
485 #endif
486 
487  // save solution to text file
488 
489  // retrieve test value to check
490  double global_opt;
491  couenne.options () -> GetNumericValue ("couenne_check", global_opt, "couenne.");
492 
493  double
494  ub = infeasible ? COIN_DBL_MAX : bb. model (). getObjValue (),
495  lb = infeasible ? -COIN_DBL_MAX : bb. model (). getBestPossibleObjValue ();
496 
497  if (cp -> getRecordBestSol () &&
498  cp -> getRecordBestSol () -> getHasSol () &&
499  (ub > cp -> getRecordBestSol () -> getVal ()))
500  ub = cp -> getRecordBestSol () -> getVal ();
501 
502  if (false || //(fabs (lb) > COUENNE_INFINITY / 1e4) ||
503  (lb > ub))
504  lb = ub;
505 
506  char
507  *gapstr = new char [40],
508  *lbstr = new char [40],
509  *ubstr = new char [40];
510 
511  // CouenneSolverInterface <OsiClpSolverInterface> *csi = dynamic_cast <CouenneSolverInterface *> (couenne.continuousSolver ());
512 
513  // double rootLB = csi -> rootLB ();
514 
515  sprintf (lbstr, "%10g", lb);
516  sprintf (ubstr, "%10g", ub);
517  if(ub > COUENNE_INFINITY/1e4) {
518  sprintf (gapstr, "--");
519  }
520  else {
521  sprintf (gapstr, "%.2f%%", fabs (100. * (ub - lb) / (1. + fabs (lb))));
522  }
523 
524  if (!infeasible)
525  jnlst -> Printf (J_ERROR, J_COUENNE, "\n\
526 Linearization cuts added at root node: %8d\n\
527 Linearization cuts added in total: %8d (separation time: %gs)\n",
528  nr, nt, st);
529 
530  else jnlst -> Printf (J_ERROR, J_COUENNE, "Problem infeasible\n");
531 
532  jnlst -> Printf (J_NONE, J_COUENNE, "\
533 Total solve time: %8gs (%gs in branch-and-bound)\n\
534 Lower bound: %s\n\
535 Upper bound: %s (gap: %s)\n\
536 Branch-and-bound nodes: %8d\n",
537  CoinCpuTime () - time_start,
538  cg ? (CoinCpuTime () - CoinMax (time_start, cg -> rootTime ())) : CoinCpuTime () - time_start,
539  ((lb <= -8.9999e12) ||
540  infeasible || (fabs (lb) > COUENNE_INFINITY/1e4)) ? " -inf" : lbstr,
541  ((retcomp < 0) || infeasible || (ub > COUENNE_INFINITY/1e4)) ? " inf" : ubstr,
542  ( infeasible || (CoinMax (fabs (lb), fabs (ub)) > COUENNE_INFINITY/1e4)) ? "--" : gapstr,
543  infeasible ? 0 : bb.numNodes ());
544 
545  // if (fabs (ub - bb. model (). getObjValue ()) > COUENNE_EPS * fabs (ub))
546  // jnlst -> Printf (J_ERROR, J_COUENNE,
547  // "Warning: upper bounds differ between Couenne and Cbc. Saving Couenne's (more reliable).\n");
548 
549  delete [] lbstr;
550  delete [] ubstr;
551  delete [] gapstr;
552 
553  if (global_opt < COUENNE_INFINITY) { // some value found in couenne.opt
554 
555  double opt = infeasible ? -COIN_DBL_MAX : bb.model (). getBestPossibleObjValue ();
556 
557  printf ("Global Optimum Test on %-40s %s\n",
558  cp ? cp -> problemName ().c_str () : "unknown",
559  (fabs (opt - global_opt) /
560  (1. + CoinMax (fabs (opt), fabs (global_opt))) < PRINTED_PRECISION) ?
561  (const char *) "OK" : (const char *) "FAILED");
562  //opt, global_opt,
563  //fabs (opt - global_opt));
564 
565  } else // good old statistics
566 
567  if (couenne.displayStats ()) { // print statistics
568 
569  if (cg && !cp) printf ("Warning, could not get pointer to problem\n");
570  else
571  printf ("Stats: %-15s %4d [var] %4d [int] %4d [con] %4d [aux] "
572  "%6d [root] %8d [tot] %6g [sep] %8g [time] %8g [bb] "
573 #ifdef COIN_HAS_NTY
574  "%20e [lower] %20e [upper] %7d [nodes] %.0g [sg] %d [sgc]\n",
575 #else
576  "%20e [lower] %20e [upper] %7d [nodes]\n",
577 #endif
578  cp ? cp -> problemName (). c_str () : "unknown",
579  cp ? cp -> nOrigVars () : -1,
580  cp ? cp -> nOrigIntVars () : -1,
581  cp ? cp -> nOrigCons () : -1,
582  cp ? (cp -> nVars () -
583  cp -> nOrigVars ()) : -1,
584  nr, nt, st,
585  CoinCpuTime () - time_start,
586  cg ? (CoinCpuTime () - cg -> rootTime ()) : CoinCpuTime (),
587  lb, //bb.model (). getBestPossibleObjValue (),
588  ub, //bb.model (). getObjValue (),
589  //bb.bestBound (),
590  //bb.bestObj (),
591  infeasible ? 0 : bb.numNodes ()
592 #ifdef COIN_HAS_NTY
593  ,symmGroupSize
595 #endif
596  );
597  //bb.iterationCount ());
598  //status.c_str (), message.c_str ());
599  }
600  }
602  E->writeDiffFiles();
603  E->printError(std::cerr);
604  //There has been a failure to solve a problem with Ipopt.
605  //And we will output file with information on what has been changed in the problem to make it fail.
606  //Now depending on what algorithm has been called (B-BB or other) the failed problem may be at different place.
607  // const OsiSolverInterface &si1 = (algo > 0) ? nlpSolver : *model.solver();
608  }
610  std::cerr<<E.className()<<"::"<<E.methodName()
611  <<std::endl
612  <<E.message()<<std::endl;
613  }
614  catch (CoinError &E) {
615  std::cerr<<E.className()<<"::"<<E.methodName()
616  <<std::endl
617  <<E.message()<<std::endl;
618  }
619  catch (Ipopt::OPTION_INVALID &E)
620  {
621  std::cerr<<"Ipopt exception : "<<E.Message()<<std::endl;
622  }
623  // catch (int generic_error) {
624  // // if (generic_error == infeasible)
625  // // printf ("problem infeasible\n");
626  // }
627 
628 // catch(...) {
629 // std::cerr<<pbName<<" unrecognized excpetion"<<std::endl;
630 // std::cerr<<pbName<<"\t Finished \t exception"<<std::endl;
631 // throw;
632 // }
633 
634  delete [] pbName;
635  return 0;
636 }
Cut Generator for linear convexifications.
int nVars() const
Total number of variables.
#define COUENNE_VERSION
int main(int argc, char *argv[])
Definition: BB_tm.cpp:32
void writeDiffFiles(const std::string prefix=std::string()) const
write files with differences between input model and this one
bool checkNLP2(const double *solution, const double obj, const bool careAboutObj, const bool stopAtFirstViol, const bool checkAll, const double precision) const
Return true if either solution or recomputed_solution obtained using getAuxs() from the original vari...
Definition: checkNLP.cpp:571
constant-type operator
Error class to throw exceptions from OsiTMINLPInterface.
CouenneRecordBestSol * getRecordBestSol() const
returns recorded best solution
fint end
static void signal_handler(int whichSignal)
Definition: BonCbc.cpp:47
Class for MINLP problems with symbolic information.
void printError(std::ostream &os)
Print error message.
expression clone (points to another expression)
#define PRINTED_PRECISION
Definition: BonCouenne.cpp:38
void fint fint fint fint fint fint fint fint fint fint real real real real real real real real * s
exprVar * Var(int i) const
Return pointer to i-th variable.
static const int infeasible
Definition: Couenne.cpp:68
#define COUENNE_INFINITY
We will throw this error when a problem is not solved.
double getFeasTol()
returns feasibility tolerance
fint nt
int numNodes() const
return the total number of nodes explored.
Definition: BonCbc.hpp:67
bool checkNLP(const double *solution, double &obj, bool recompute=false) const
Check if solution is MINLP feasible.
Definition: checkNLP.cpp:23
The in-memory representation of the variables element.
Definition: OSInstance.h:83
const Ipopt::EJournalCategory J_COUENNE(Ipopt::J_USER8)
double * getModSol(const int expectedCard)
const CbcModel & model() const
Get cbc model used to solve.
Definition: BonCbc.hpp:87