CouenneProblem.hpp
Go to the documentation of this file.
1 /* $Id: CouenneProblem.hpp 1083 2014-11-20 17:29:43Z pbelotti $
2  *
3  * Name: CouenneProblem.hpp
4  * Author: Pietro Belotti, Lehigh University
5  * Andreas Waechter, IBM
6  * Purpose: define the class CouenneProblem
7  *
8  * (C) Carnegie-Mellon University, 2006-11.
9  * This file is licensed under the Eclipse Public License (EPL)
10  */
11 
12 #ifndef COUENNE_PROBLEM_HPP
13 #define COUENNE_PROBLEM_HPP
14 
15 #define FM_TRACE_OPTSOL
16 #define FM_CHECKNLP2
17 
18 #include <vector>
19 #include <map>
20 #include <string.h>
21 
22 #include "CouenneConfig.h"
23 
24 #include "CouenneTypes.hpp"
25 #include "CouenneExpression.hpp"
26 
27 #include "CouenneJournalist.hpp"
28 #include "CouenneDomain.hpp"
29 
30 namespace Ipopt {
31  template <class T> class SmartPtr;
32  class OptionsList;
33  class Journalist;
34 }
35 
36 namespace Bonmin {
37  class RegisteredOptions;
38  class BabInfo;
39  class OsiTMINLPInterface;
40  class BabSetupBase;
41 }
42 
43 struct ASL;
44 struct expr;
45 
46 class CglTreeInfo;
47 class CbcModel;
48 class OsiObject;
49 class CoinWarmStart;
50 
51 class Nauty;
52 
53  class Node{
54  int index;
55  double coeff;
56  double lb;
57  double ub;
58  int color;
59  int code;
60  int sign;
61  public:
62  void node(int, double, double, double, int, int);
63  inline void color_vertex (register int k) {color = k;}
64  inline int get_index () const {return index;}
65  inline double get_coeff () const {return coeff;}
66  inline double get_lb () const {return lb;}
67  inline double get_ub () const {return ub;}
68  inline int get_color () const {return color;}
69  inline int get_code () const {return code;}
70  inline int get_sign () const {return sign;}
71  inline void bounds(register double a, register double b){ lb = a; ub = b;}
72  };
73 
74 #define COUENNE_EPS_SYMM 1e-8
75 
76  struct myclass0 {
77  inline bool operator() (register const Node &a, register const Node &b) {
78 
79  return (( a.get_code () < b.get_code ()) ||
80  (( a.get_code () == b.get_code () &&
81  (( a.get_coeff () < b.get_coeff () - COUENNE_EPS_SYMM) ||
82  (( fabs (a.get_coeff () - b.get_coeff ()) < COUENNE_EPS_SYMM) &&
83  (( a.get_lb () < b.get_lb () - COUENNE_EPS_SYMM) ||
84  (( fabs (a.get_lb () - b.get_lb ()) < COUENNE_EPS_SYMM) &&
85  (( a.get_ub () < b.get_ub () - COUENNE_EPS_SYMM) ||
86  (( fabs (a.get_ub () - b.get_ub ()) < COUENNE_EPS_SYMM) &&
87  (( a.get_index () < b.get_index ())))))))))));
88 
89  // bool is_less = 0;
90  // if(a.get_code() < b.get_code() )
91  // is_less = 1;
92  // else {
93  // if(a.get_code() == b.get_code() ) {
94  // if(a.get_coeff() < b.get_coeff() )
95  // is_less = 1;
96  // else{
97  // if(a.get_coeff() == b.get_coeff() ) {
98  // if(a.get_lb() < b.get_lb())
99  // is_less = 1;
100  // else{
101  // if(a.get_lb() == b.get_lb()) {
102  // if(a.get_ub() < b.get_ub())
103  // is_less = 1;
104  // else{
105  // if(a.get_ub() == b.get_ub()) {
106  // if(a.get_index() < b.get_index())
107  // is_less = 1;
108  // }
109  // }
110  // }
111  // }
112  // }
113  // }
114  // }
115  // }
116  // return is_less;
117 
118  }
119  } ;
120 
121 
122  struct myclass {
123  inline bool operator() (register const Node &a, register const Node &b) {
124  return (a.get_index() < b.get_index() );
125  }
126  };
127 
129  inline bool operator() (register const char *a, register const char *b) const
130  {return strcmp (a, b) < 0;}
131 };
132 
133 
134 namespace Couenne {
135 
137 
138  class exprVar;
139  class exprAux;
140  class DepGraph;
141  class CouenneObject;
142  class CouenneCutGenerator;
143  class quadElem;
144  class LinMap;
145  class QuadMap;
146  class CouenneConstraint;
147  class CouenneObjective;
148  class GlobalCutOff;
149  class CouenneBTPerfIndicator;
150  class CouenneRecordBestSol;
151  class CouenneSdpCuts;
152 
155 
156  struct compExpr;
157 
158 // default tolerance for checking feasibility (and integrality) of NLP solutions
160 
170 
171  friend class exprMul;
172 
175 
176  public:
177 
180 
181  // min depth for strong branching output
183 
184  // min number of nodes for strong branching output
186 
187  // indicate if strong branching output should be printed
188  bool doPrint_;
189 
190  protected:
191 
193  std::string problemName_;
194 
195  std::vector <exprVar *> variables_;
196  std::vector <CouenneObjective *> objectives_;
197  std::vector <CouenneConstraint *> constraints_;
198 
200  std::vector <expression *> commonexprs_;
201 
202  mutable Domain domain_;
203 
206  std::set <exprAux *, compExpr> *auxSet_;
207 
209  mutable int curnvars_;
210 
213 
215  mutable CouNumber *optimum_;
216 
219 
221  bool *commuted_;
222 
226 
229 
235 
238 
242 
245 
248 
250  mutable bool created_pcutoff_;
251 
252  bool doFBBT_;
253  bool doRCBT_;
254  bool doOBBT_;
255  bool doABT_;
256 
259 
262 
265 
268 
271 
275  std::vector <std::set <int> > dependence_;
276 
280  std::vector <CouenneObject *> objects_;
281 
284  mutable int *integerRank_;
285 
287  mutable std::vector <int> numberInRank_;
288 
290  double maxCpuTime_;
291 
294 
296  ASL *asl_;
297 
302 
305 
306  // to speedup sorting operations in strong branching
308 
309  // to record best solution found
311 
314 
317 
320  mutable bool fbbtReachedIterLimit_;
321 
324 
330 
333 
335  double constObjVal_;
336 
340 
346  std::map <const char *, std::vector <CouenneConstraint *> *, less_than_str> ConstraintClass_;
347 
352 
353  public:
354 
355  CouenneProblem (ASL * = NULL,
356  Bonmin::BabSetupBase *base = NULL,
357  JnlstPtr jnlst = NULL);
358  CouenneProblem (const CouenneProblem &);
359  ~CouenneProblem ();
360 
363 
366  {return new CouenneProblem (*this);}
367 
368  int nObjs () const {return (int) objectives_. size ();}
369  int nCons () const {return (int) constraints_. size ();}
370  int nOrigCons () const {return nOrigCons_;}
371 
372  inline int nOrigVars () const {return nOrigVars_;}
373  inline int nDefVars () const {return ndefined_;}
374  inline int nOrigIntVars () const {return nOrigIntVars_;}
375  inline int nIntVars () const {return nIntVars_;}
376  inline int nVars () const {return (int) variables_. size ();}
377 
378  void setNDefVars (int ndefined__) {ndefined_ = ndefined__;}
379 
380  // Symmetry Info
381 
382  std::vector<int> *Find_Orbit(int) const;
383  mutable std::vector<Node> node_info;
384  mutable Nauty *nauty_info;
385 
388 
389  void sym_setup();
390  void Compute_Symmetry() const;
391  void Print_Orbits() const;
392  void ChangeBounds (const double * , const double *, int ) const;
393  inline bool compare (register Node &a, register Node &b) const;
395 
396  // bool node_sort ( Node a, Node b);
397  // bool index_sort ( Node a, Node b);
398 
400  void setupSymmetry ();
401 
403  inline int evalOrder (int i) const
404  {return numbering_ [i];}
405 
407  inline int *evalVector ()
408  {return numbering_;}
409 
410  // get elements from vectors
411  inline CouenneConstraint *Con (int i) const {return constraints_ [i];}
412  inline CouenneObjective *Obj (int i) const {return objectives_ [i];}
413 
415  inline exprVar *Var (int i) const
416  {return variables_ [i];}
417 
419  inline std::vector <exprVar *> &Variables ()
420  {return variables_;}
421 
423  inline std::set <exprAux *, compExpr> *& AuxSet ()
424  {return auxSet_;}
425 
427  inline DepGraph *getDepGraph ()
428  {return graph_;}
429 
431  inline Domain *domain () const
432  {return &domain_;}
433 
434  inline std::vector <expression *>& commonExprs() { return commonexprs_; }
435 
436  // Get and set current variable and bounds
437  inline CouNumber &X (int i) const {return domain_.x (i);}
438  inline CouNumber &Lb (int i) const {return domain_.lb (i);}
439  inline CouNumber &Ub (int i) const {return domain_.ub (i);}
440 
441  // get and set current variable and bounds
442  inline CouNumber *X () const {return domain_.x ();}
443  inline CouNumber *Lb () const {return domain_.lb ();}
444  inline CouNumber *Ub () const {return domain_.ub ();}
445 
446  // get optimal solution and objective value
447  CouNumber *&bestSol () const {return optimum_;}
448  CouNumber bestObj () const {return bestObj_;}
449 
451  bool *&Commuted ()
452  {return commuted_;}
453 
455  void addObjective (expression *, const std::string & = "min");
456 
457  // Add (non linear) "=", ">=", "<=", and range constraints
458  void addEQConstraint (expression *, expression * = NULL);
459  void addGEConstraint (expression *, expression * = NULL);
460  void addLEConstraint (expression *, expression * = NULL);
461  void addRNGConstraint (expression *, expression * = NULL,
462  expression * = NULL);
463 
465  void setObjective (int indObj = 0, expression * = NULL, const std::string & = "min");
466 
471  expression *addVariable (bool isint = false, Domain *d = NULL);
472 
476 
478  void reformulate (CouenneCutGenerator * = NULL);
479 
483  bool standardize ();
484 
487  void print (std::ostream & = std::cout);
488 
489 #ifdef COIN_HAS_ASL
490  int readnl (const struct ASL *);
492 
494  expression *nl2e (struct expr *, const ASL *asl);
495 #endif
496 
497  // bound tightening parameters
498  bool doFBBT () const {return (doFBBT_ && (max_fbbt_iter_ != 0));}
499  bool doRCBT () const {return doRCBT_;}
500  bool doOBBT () const {return doOBBT_;}
501  bool doABT () const {return doABT_;}
502 
503  int logObbtLev () const {return logObbtLev_;}
504  int logAbtLev () const {return logAbtLev_;}
505 
518  void writeAMPL (const std::string &fname, bool aux);
519 
523  void writeGAMS (const std::string &fname);
524 
529  void writeLP (const std::string &fname);
530 
533  //void initAuxs (const CouNumber *, const CouNumber *, const CouNumber *);
534  void initAuxs () const;
535 
537  void getAuxs (CouNumber *) const;
538 
541  const CglTreeInfo info,
542  Bonmin::BabInfo * = NULL) const;
543 
545  bool btCore (t_chg_bounds *chg_bds) const;
546 
548  int obbt (const CouenneCutGenerator *cg,
549  const OsiSolverInterface &csi,
550  OsiCuts &cs,
551  const CglTreeInfo &info,
552  Bonmin::BabInfo * babInfo,
553  t_chg_bounds *chg_bds);
554 
559  t_chg_bounds *,
560  const CglTreeInfo &info,
561  Bonmin::BabInfo * = NULL) const;
562 
565  int redCostBT (const OsiSolverInterface *psi,
566  t_chg_bounds *chg_bds) const;
567 
570  int tightenBounds (t_chg_bounds *) const;
571 
573  int impliedBounds (t_chg_bounds *) const;
574 
576  void fillQuadIndices ();
577 
579  void fillObjCoeff (double *&);
580 
583  void auxiliarize (exprVar *, exprVar * = NULL);
584 
586  void setCutOff (CouNumber cutoff, const CouNumber *sol = NULL) const;
587 
589  void resetCutOff (CouNumber value = COUENNE_INFINITY) const;
590 
592  CouNumber getCutOff () const;
593 
595  CouNumber *getCutOffSol () const;
596 
598  void installCutOff () const;
599 
601  ConstJnlstPtr Jnlst () const;
602 
604  bool checkNLP (const double *solution, double &obj, bool recompute = false) const;
605 
608  int getIntegerCandidate (const double *xFrac, double *xInt, double *lb, double *ub) const;
609 
611  bool readOptimum (std::string *fname = NULL);
612 
615 
617  exprAux *linStandardize (bool addAux,
618  CouNumber c0,
619  LinMap &lmap,
620  QuadMap &qmap);
621 
624  int splitAux (CouNumber, expression *, expression *&, bool *, enum expression::auxSign &);
625 
627  void indcoe2vector (int *indexL,
628  CouNumber *coeff,
629  std::vector <std::pair <exprVar *, CouNumber> > &lcoeff);
630 
632  void indcoe2vector (int *indexI,
633  int *indexJ,
634  CouNumber *coeff,
635  std::vector <quadElem> &qcoeff);
636 
647  void decomposeTerm (expression *term,
648  CouNumber initCoe,
649  CouNumber &c0,
650  LinMap &lmap,
651  QuadMap &qmap);
652 
654  const std::string &problemName () const
655  {return problemName_;}
656 
657  void setProblemName(std::string& problemName__)
658  { problemName_ = problemName__; }
659 
661  const std::vector <std::set <int> > &Dependence () const
662  {return dependence_;}
663 
665  const std::vector <CouenneObject *> &Objects () const
666  {return objects_;}
667 
669  int findSOS (CbcModel *CbcModelPtr,
670  OsiSolverInterface *solver,
671  OsiObject ** objects);
672 
674  inline void setMaxCpuTime (double time)
675  {maxCpuTime_ = time;}
676 
678  inline double getMaxCpuTime () const
679  {return maxCpuTime_;}
680 
682  void setBase (Bonmin::BabSetupBase *base);
683 
688  void createUnusedOriginals ();
689 
693  void restoreUnusedOriginals (CouNumber * = NULL) const;
694 
697  {return unusedOriginalsIndices_;}
698 
701  {return nUnusedOriginals_;}
702 
704  enum multiSep MultilinSep () const
705  {return multilinSep_;}
706 
708  bool fbbtReachedIterLimit () const
709  {return fbbtReachedIterLimit_;}
710 
712  bool orbitalBranching () const
713  {return orbitalBranching_;}
714 
718  void setCheckAuxBounds (bool value)
719  {checkAuxBounds_ = value;}
720 
723  bool checkAuxBounds () const
724  {return checkAuxBounds_;}
725 
728  {return trilinDecompType_;}
729 
732 
734  inline double constObjVal () const {return constObjVal_;}
735 
738 
739 protected:
740 
746  int fake_tighten (char direction,
747  int index,
748  const double *X,
749  CouNumber *olb,
750  CouNumber *oub,
751  t_chg_bounds *chg_bds,
752  t_chg_bounds *f_chg) const;
753 
755  int obbtInner (OsiSolverInterface *,
756  OsiCuts &,
757  t_chg_bounds *,
758  Bonmin::BabInfo *) const;
759 
760  int obbt_iter (OsiSolverInterface *csi,
761  t_chg_bounds *chg_bds,
762  const CoinWarmStart *warmstart,
763  Bonmin::BabInfo *babInfo,
764  double *objcoe,
765  int sense,
766  int index) const;
767 
768  int call_iter (OsiSolverInterface *csi,
769  t_chg_bounds *chg_bds,
770  const CoinWarmStart *warmstart,
771  Bonmin::BabInfo *babInfo,
772  double *objcoe,
773  enum nodeType type,
774  int sense) const;
775 
779  void analyzeSparsity (CouNumber,
780  LinMap &,
781  QuadMap &);
782 
785  void flattenMul (expression *mul,
786  CouNumber &coe,
787  std::map <int, CouNumber> &indices);
788 
790  void realign ();
791 
794 
796  void fillIntegerRank () const;
797 
799  int testIntFix (int index,
800  CouNumber xFrac,
801  enum fixType *fixed,
802  CouNumber *xInt,
803  CouNumber *dualL, CouNumber *dualR,
804  CouNumber *olb, CouNumber *oub,
805  bool patient) const;
806 
807 public:
808 
810  inline int getLastPrioSort() const
811  {return lastPrioSort_;}
812 
814  void setLastPrioSort (int givenLastPS);
815 
818  {return recBSol;}
819 
821  double getFeasTol() {return feas_tolerance_;}
822 
824  double checkObj(const CouNumber *sol, const double &precision) const;
825 
829  bool checkInt(const CouNumber *sol,
830  const int from, const int upto,
831  const std::vector<int> listInt,
832  const bool origVarOnly,
833  const bool stopAtFirstViol,
834  const double precision, double &maxViol) const;
835 
837  bool checkBounds(const CouNumber *sol,
838  const bool stopAtFirstViol,
839  const double precision, double &maxViol) const;
840 
842  bool checkAux(const CouNumber *sol,
843  const bool stopAtFirstViol,
844  const double precision, double &maxViol) const;
845 
847  bool checkCons(const CouNumber *sol,
848  const bool stopAtFirstViol,
849  const double precision, double &maxViol) const;
850 
863 
867 
872 
875  bool checkNLP2 (const double *solution,
876  const double obj,
877  const bool careAboutObj,
878  const bool stopAtFirstViol,
879  const bool checkAll,
880  const double precision) const;
881 
883  bool checkNLP0 (const double *solution,
884  double &obj,
885  bool recompute_obj = false,
886  const bool careAboutObj = false,
887  const bool stopAtFirstViol = true,
888  const bool checkAll = false,
889  const double precision = -1) const; // if -1 then use feas_tolerance_
890 
896  std::vector <CouenneConstraint *> *ConstraintClass (const char *str) {return ConstraintClass_ [str];}
897 };
898 
899 }
900 
901 #endif
Cut Generator for linear convexifications.
void realign()
clear all spurious variables pointers not referring to the variables_ vector
Definition: problem.cpp:392
const std::vector< CouenneObject * > & Objects() const
return object vector
CouNumber & Ub(int i) const
upper bound on
void setObjective(int indObj=0, expression *=NULL, const std::string &="min")
Add (non linear) objective function.
int impliedBounds(t_chg_bounds *) const
&quot;Backward&quot; bound tightening, aka implied bounds.
GlobalCutOff * pcutoff_
Pointer to a global cutoff object.
bool checkInt(const CouNumber *sol, const int from, const int upto, const std::vector< int > listInt, const bool origVarOnly, const bool stopAtFirstViol, const double precision, double &maxViol) const
check integrality of vars in sol with index between from and upto (original vars only if origVarOnly ...
Definition: checkNLP.cpp:313
const CouNumber feas_tolerance_default
void setLastPrioSort(int givenLastPS)
void addLEConstraint(expression *, expression *=NULL)
Add constraint, .
DepGraph * getDepGraph()
Return pointer to dependence graph.
int nVars() const
Total number of variables.
double lb
double maxCpuTime_
maximum cpu time
int fake_tighten(char direction, int index, const double *X, CouNumber *olb, CouNumber *oub, t_chg_bounds *chg_bds, t_chg_bounds *f_chg) const
single fake tightening.
CouenneProblem(ASL *=NULL, Bonmin::BabSetupBase *base=NULL, JnlstPtr jnlst=NULL)
Constructor.
int redCostBT(const OsiSolverInterface *psi, t_chg_bounds *chg_bds) const
procedure to strengthen variable bounds.
CouNumber & ub(register int index)
current upper bound
void addObjective(expression *, const std::string &="min")
Add (non linear) objective function.
void fint fint fint real fint real real real real real real real real real fint real fint fint fint real fint fint fint fint * info
bool *& Commuted()
Get vector of commuted variables.
int max_fbbt_iter_
number of FBBT iterations
std::vector< CouenneObjective * > objectives_
Objectives.
multiSep
Type of multilinear separation.
status of lower/upper bound of a variable, to be checked/modified in bound tightening ...
std::vector< expression * > & commonExprs()
bool doABT_
do Aggressive bound tightening
int nIntVars_
Number of discrete variables.
int nOrigCons_
Number of original constraints (disregarding those that turned into auxiliary variable definition) ...
CouenneBTPerfIndicator * perfIndicator_
Performance indicator for FBBT – to be moved away from CouenneProblem when we do it with FBBT...
int tightenBounds(t_chg_bounds *) const
&quot;Forward&quot; bound tightening, that is, propagate bound of variable in an expression to the bounds of ...
double constObjVal_
constant value of the objective if no variable is declared in it
int call_iter(OsiSolverInterface *csi, t_chg_bounds *chg_bds, const CoinWarmStart *warmstart, Bonmin::BabInfo *babInfo, double *objcoe, enum nodeType type, int sense) const
Definition: obbt.cpp:42
exprAux * linStandardize(bool addAux, CouNumber c0, LinMap &lmap, QuadMap &qmap)
standardization of linear exprOp&#39;s
This is class provides an Osi interface for a Mixed Integer Linear Program expressed as a TMINLP (so ...
bool operator()(register const Node &a, register const Node &b)
void fillIntegerRank() const
fill freeIntegers_ array
CouNumber & lb(register int index)
current lower bound
std::vector< std::set< int > > dependence_
inverse dependence structure: for each variable x give set of auxiliary variables (or better...
std::string problemName_
problem name
DepGraph * graph_
Dependence (acyclic) graph: shows dependence of all auxiliary variables on one another and on origina...
void fint fint fint real * a
int * integerRank_
each element is true if variable is integer and, if auxiliary, depends on no integer ...
void print(std::ostream &=std::cout)
Display current representation of problem: objective, linear and nonlinear constraints, and auxiliary variables.
Definition: problemIO.cpp:24
void setCutOff(CouNumber cutoff, const CouNumber *sol=NULL) const
Set cutoff.
Definition: problem.cpp:326
int nUnusedOriginals()
number of unused originals
int get_code() const
bool orbitalBranching() const
return true if orbital branching activated
CouenneSdpCuts * sdpCutGen_
Temporary pointer to SDP cut generator.
bool operator()(register const char *a, register const char *b) const
bool checkNLP0(const double *solution, double &obj, bool recompute_obj=false, const bool careAboutObj=false, const bool stopAtFirstViol=true, const bool checkAll=false, const double precision=-1) const
And finally a method to get both.
Definition: checkNLP.cpp:959
int get_sign() const
bool doFBBT() const
shall we do Feasibility Based Bound Tightening?
CouNumber bestObj_
Best known objective function.
bool checkAux(const CouNumber *sol, const bool stopAtFirstViol, const double precision, double &maxViol) const
returns true iff value of all auxiliaries are within bounds
Definition: checkNLP.cpp:403
bool checkAuxBounds_
check bounds on auxiliary variables when verifying MINLP feasibility of a solution.
int nOrigIntVars_
Number of original integer variables.
std::set< exprAux *, compExpr > * auxSet_
Expression map for comparison in standardization and to count occurrences of an auxiliary.
bool boundTightening(t_chg_bounds *, const CglTreeInfo info, Bonmin::BabInfo *=NULL) const
tighten bounds using propagation, implied bounds and reduced costs
These are cuts of the form.
Ipopt::SmartPtr< const Ipopt::Journalist > ConstJnlstPtr
int logAbtLev_
frequency of Aggressive bound tightening
void Print_Orbits() const
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
CouNumber & X(int i) const
CouNumber & Lb(int i) const
lower bound on
int * unusedOriginalsIndices()
return indices of neglected redundant variables
std::vector< expression * > commonexprs_
AMPL&#39;s common expressions (read from AMPL through structures cexps and cexps1)
bool doOBBT() const
shall we do Optimality Based Bound Tightening?
bool doOBBT_
do Optimality-based bound tightening
int findSOS(CbcModel *CbcModelPtr, OsiSolverInterface *solver, OsiObject **objects)
find SOS constraints in problem
Definition: CouenneSOS.cpp:28
int splitAux(CouNumber, expression *, expression *&, bool *, enum expression::auxSign &)
split a constraint w - f(x) = c into w&#39;s index (it is returned) and rest = f(x) + c ...
Definition: splitAux.cpp:36
double checkObj(const CouNumber *sol, const double &precision) const
Recompute objective value for sol.
Definition: checkNLP.cpp:280
int nUnusedOriginals_
number of unused originals
double get_lb() const
Domain * domain() const
return current point &amp; bounds
exprAux * addAuxiliary(expression *)
Add auxiliary variable and associate it with expression given as argument (used in standardization) ...
int evalOrder(int i) const
get evaluation order index
CouNumber getCutOff() const
Get cutoff.
void initOptions(Ipopt::SmartPtr< Ipopt::OptionsList > options)
initializes parameters like doOBBT
std::vector< CouenneObject * > objects_
vector of pointer to CouenneObjects.
void writeGAMS(const std::string &fname)
Write nonlinear problem to a .gms file.
Definition: writeGAMS.cpp:24
std::vector< CouenneConstraint * > * ConstraintClass(const char *str)
return particular constraint class.
void setBase(Bonmin::BabSetupBase *base)
save CouenneBase
Definition: problem.cpp:37
int nIntVars() const
Number of integer variables.
CouNumber bestObj() const
Objective of best known solution.
CouNumber * getCutOffSol() const
Get cutoff solution.
void fint fint fint real fint real real real real real real real real real * e
void writeLP(const std::string &fname)
Write nonlinear problem to a .lp file.
Definition: writeLP.cpp:270
bool doRCBT() const
shall we do reduced cost Bound Tightening?
A class to have all elements necessary to setup a branch-and-bound.
double get_coeff() const
const std::vector< std::set< int > > & Dependence() const
return inverse dependence structure
Class to represent nonlinear constraints.
void restoreUnusedOriginals(CouNumber *=NULL) const
Some originals may be unused due to their zero multiplicity (that happens when they are duplicates)...
bool checkBounds(const CouNumber *sol, const bool stopAtFirstViol, const double precision, double &maxViol) const
Check bounds; returns true iff feasible for given precision.
Definition: checkNLP.cpp:361
bool doABT() const
shall we do Aggressive Bound Tightening?
int nOrigCons() const
Get number of original constraints.
CouenneProblem * clone() const
Clone method (for use within CouenneCutGenerator::clone)
void getAuxs(CouNumber *) const
Get auxiliary variables from original variables.
Definition: problem.cpp:162
int ndefined_
Number of &quot;defined variables&quot; (aka &quot;common expressions&quot;)
CouNumber opt_window_
window around known optimum (for testing purposes)
CouenneRecordBestSol * getRecordBestSol() const
returns recorded best solution
auxSign
&quot;sign&quot; of the constraint defining an auxiliary.
void addEQConstraint(expression *, expression *=NULL)
Add equality constraint .
void setupSymmetry()
empty if no NTY, symmetry data structure setup otherwise
ConstJnlstPtr Jnlst() const
Provide Journalist.
const std::string & problemName() const
return problem name
Bonmin::BabSetupBase * bonBase_
options
std::vector< int > numberInRank_
numberInRank_ [i] is the number of integer variables in rank i
std::vector< CouenneConstraint * > constraints_
Constraints.
int obbtInner(OsiSolverInterface *, OsiCuts &, t_chg_bounds *, Bonmin::BabInfo *) const
Optimality Based Bound Tightening – inner loop.
Definition: obbt.cpp:98
int testIntFix(int index, CouNumber xFrac, enum fixType *fixed, CouNumber *xInt, CouNumber *dualL, CouNumber *dualR, CouNumber *olb, CouNumber *oub, bool patient) const
Test fixing of an integer variable (used in getIntegerCandidate())
Definition: testIntFix.cpp:19
bool btCore(t_chg_bounds *chg_bds) const
core of the bound tightening procedure
CouenneConstraint * Con(int i) const
i-th constraint
int nDefVars() const
Number of def&#39;d variables.
int obbt(const CouenneCutGenerator *cg, const OsiSolverInterface &csi, OsiCuts &cs, const CglTreeInfo &info, Bonmin::BabInfo *babInfo, t_chg_bounds *chg_bds)
Optimality Based Bound Tightening.
Definition: obbt.cpp:176
Bonmin::BabSetupBase * bonBase() const
options
expression * addVariable(bool isint=false, Domain *d=NULL)
Add original variable.
int * evalVector()
get evaluation order vector (numbering_)
int obbt_iter(OsiSolverInterface *csi, t_chg_bounds *chg_bds, const CoinWarmStart *warmstart, Bonmin::BabInfo *babInfo, double *objcoe, int sense, int index) const
Iteration on one variable.
Definition: obbt_iter.cpp:68
#define COUENNE_EPS_SYMM
double constObjVal() const
returns constant objective value if it contains no variables
bool created_pcutoff_
flag indicating if this class is creator of global cutoff object
Class for MINLP problems with symbolic information.
bool compare(register Node &a, register Node &b) const
int curnvars_
Number of elements in the x_, lb_, ub_ arrays.
bool fbbtReachedIterLimit_
true if FBBT exited for iteration limits as opposed to inability to further tighten bounds ...
void fint fint * k
std::map< const char *, std::vector< CouenneConstraint * > *, less_than_str > ConstraintClass_
Return particular constraint class.
bool aggressiveBT(Bonmin::OsiTMINLPInterface *nlp, t_chg_bounds *, const CglTreeInfo &info, Bonmin::BabInfo *=NULL) const
aggressive bound tightening.
exprVar * Var(int i) const
Return pointer to i-th variable.
std::vector< exprVar * > variables_
Variables (original, auxiliary, and defined)
int getIntegerCandidate(const double *xFrac, double *xInt, double *lb, double *ub) const
generate integer NLP point Y starting from fractional solution using bound tightening ...
std::vector< exprVar * > & Variables()
Return vector of variables (symbolic representation)
CouenneRecordBestSol * recBSol
int nOrigVars() const
Number of orig. variables.
std::set< exprAux *, compExpr > *& AuxSet()
Return pointer to set for comparisons.
CouNumber *& bestSol() const
Best known solution (read from file)
bool * commuted_
Variables that have commuted to auxiliary.
CouenneSdpCuts * getSdpCutGen()
Returns pointer to sdp cut generator.
enum TrilinDecompType trilinDecompType_
return type of decomposition of quadrilinear terms
Domain domain_
current point and bounds;
int * numbering_
numbering of variables.
std::vector< Node > node_info
int nOrigIntVars() const
Number of original integers.
CouNumber * Ub() const
Return vector of upper bounds.
void addGEConstraint(expression *, expression *=NULL)
Add constraint, .
bool standardize()
Break problem&#39;s nonlinear constraints in simple expressions to be convexified later.
Definition: standardize.cpp:34
void ChangeBounds(const double *, const double *, int) const
void installCutOff() const
Make cutoff known to the problem.
Definition: problem.cpp:363
CouNumber * optimum_
Best solution known to be loaded from file – for testing purposes.
bool orbitalBranching_
use orbital branching?
enum TrilinDecompType getTrilinDecompType()
return type of decomposition of quadrilinear terms
void fillQuadIndices()
Look for quadratic terms to be used with SDP cuts.
void color_vertex(register int k)
int get_color() const
void initAuxs() const
Initialize auxiliary variables and their bounds from original variables.
Definition: problem.cpp:51
void flattenMul(expression *mul, CouNumber &coe, std::map< int, CouNumber > &indices)
re-organizes multiplication and stores indices (and exponents) of its variables
Definition: flattenMul.cpp:21
double CouNumber
main number type in Couenne
nodeType
type of a node in an expression tree
void setMaxCpuTime(double time)
set maximum CPU time
void reformulate(CouenneCutGenerator *=NULL)
preprocess problem in order to extract linear relaxations etc.
Definition: reformulate.cpp:32
fixType
structure to record fixed, non-fixed, and continuous variables
int nOrigVars_
Number of original variables.
CouNumber feas_tolerance_
feasibility tolerance (to be used in checkNLP)
bool useQuadratic_
Use quadratic expressions?
void resetCutOff(CouNumber value=COUENNE_INFINITY) const
Reset cutoff.
Definition: problem.cpp:348
ASL * asl_
AMPL structure pointer (temporary — looking forward to embedding into OS...)
void addRNGConstraint(expression *, expression *=NULL, expression *=NULL)
Add range constraint, .
#define COUENNE_INFINITY
Dependence graph.
Auxiliary variable.
void Compute_Symmetry() const
void node(int, double, double, double, int, int)
CouNumber * X() const
Return vector of variables.
void setNDefVars(int ndefined__)
bool readOptimum(std::string *fname=NULL)
Read best known solution from file given in argument.
Definition: problemIO.cpp:107
int logObbtLev_
frequency of Optimality-based bound tightening
CouNumber & x(register int index)
current variable
double coeff
enum multiSep multilinSep_
Type of Multilinear separation.
void createUnusedOriginals()
Some originals may be unused due to their zero multiplicity (that happens when they are duplicates)...
variable-type operator
int nCons() const
Get number of constraints.
bool checkCons(const CouNumber *sol, const bool stopAtFirstViol, const double precision, double &maxViol) const
returns true iff value of all auxiliaries are within bounds
Definition: checkNLP.cpp:489
enum multiSep MultilinSep() const
return type of separator for multilinear terms
double getFeasTol()
returns feasibility tolerance
int * unusedOriginalsIndices_
some originals may be unused due to their zero multiplicity (that happens when they are duplicates)...
JnlstPtr jnlst_
SmartPointer to the Journalist.
void analyzeSparsity(CouNumber, LinMap &, QuadMap &)
analyze sparsity of potential exprQuad/exprGroup and change linear/quadratic maps accordingly...
Definition: Nauty.h:23
double ub
bool checkNLP(const double *solution, double &obj, bool recompute=false) const
Check if solution is MINLP feasible.
Definition: checkNLP.cpp:23
void indcoe2vector(int *indexL, CouNumber *coeff, std::vector< std::pair< exprVar *, CouNumber > > &lcoeff)
translates pair (indices, coefficients) into vector with pointers to variables
Expression base class.
CouenneObjective * Obj(int i) const
i-th objective
void setCheckAuxBounds(bool value)
set the value for checkAuxBounds.
bool doRCBT_
do reduced cost bound tightening
Ipopt::SmartPtr< Ipopt::Journalist > JnlstPtr
bool fbbtReachedIterLimit() const
true if latest call to FBBT terminated due to iteration limit reached
double get_ub() const
static void registerOptions(Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions)
Add list of options to be read from file.
Definition: problem.cpp:421
void decomposeTerm(expression *term, CouNumber initCoe, CouNumber &c0, LinMap &lmap, QuadMap &qmap)
given (expression *) element of sum, returns (coe,ind0,ind1) depending on element: ...
bool checkAuxBounds() const
return true if bounds of auxiliary variables have to be satisfied whenever a solution is tested for M...
void auxiliarize(exprVar *, exprVar *=NULL)
Replace all occurrences of original variable with new aux given as argument.
Definition: auxiliarize.cpp:27
int nObjs() const
Get number of objectives.
void bounds(register double a, register double b)
bool operator()(register const Node &a, register const Node &b)
int logObbtLev() const
How often shall we do OBBT?
return b
Definition: OSdtoa.cpp:1719
void fillDependence(Bonmin::BabSetupBase *base, CouenneCutGenerator *=NULL)
fill dependence_ structure
double getMaxCpuTime() const
return maximum CPU time
void fillObjCoeff(double *&)
Fill vector with coefficients of objective function.
Definition: problem.cpp:241
bool doFBBT_
do Feasibility-based bound tightening
std::vector< int > * Find_Orbit(int) const
Bonmin class for passing info between components of branch-and-cuts.
Definition: BonBabInfos.hpp:19
void setProblemName(std::string &problemName__)
Define a dynamic point+bounds, with a way to save and restore previous points+bounds through a LIFO s...
void writeAMPL(const std::string &fname, bool aux)
Write nonlinear problem to a .mod file (with lots of defined variables)
Definition: writeAMPL.cpp:22
class for multiplications,
CouNumber * Lb() const
Return vector of lower bounds.
int get_index() const
int logAbtLev() const
How often shall we do ABT?