Couenne  0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CouenneChooseStrong.hpp
Go to the documentation of this file.
1 /* $Id: CouenneChooseStrong.hpp 792 2012-01-24 17:24:15Z pbelotti $
2  *
3  * Name: CouenneChooseStrong.hpp
4  * Authors: Andreas Waechter, IBM Corp.
5  * Purpose: Strong branching object for Couenne
6  *
7  * (C) Carnegie-Mellon University, 2006-10.
8  * This file is licensed under the Eclipse Public License (EPL)
9  */
10 
11 #ifndef COUENNECHOOSESTRONG_HPP
12 #define COUENNECHOOSESTRONG_HPP
13 
14 #include "BonChooseVariable.hpp"
15 #include "CouenneJournalist.hpp"
16 
17 namespace Couenne {
18 
19 class CouenneProblem;
20 
21 template <class T> class CouenneSolverInterface;
22 
23 class CouenneChooseStrong : public Bonmin::BonChooseVariable {
24 
25 public:
26 
28  CouenneChooseStrong (Bonmin::BabSetupBase& b, CouenneProblem* problem, JnlstPtr jnlst);
29 
32 
35 
37  virtual OsiChooseVariable * clone() const;
38 
40  virtual ~CouenneChooseStrong ();
41 
44  virtual int setupList (OsiBranchingInformation *info, bool initialize);
45 
46  // actually setting up the list
47  int gutsOfSetupList(OsiBranchingInformation *info, bool initialize);
48 
60  virtual int doStrongBranching (OsiSolverInterface * OsiSolver,
61  OsiBranchingInformation *info,
62  int numberToDo, int returnCriterion);
63 
65  virtual bool feasibleSolution (const OsiBranchingInformation * info,
66  const double * solution,
67  int numberObjects,
68  const OsiObject ** objects);
69 
71  virtual int chooseVariable (OsiSolverInterface * solver,
72  OsiBranchingInformation *info,
73  bool fixVariables);
74 
77 
78 private:
79 
82 
83  // print object violations
84  void printObjViol(OsiBranchingInformation *info);
85 
86  // Due to possible fixing during strong branching, must check
87  // that variable reference vInd for the selected object (if not -1)
88  // is not fixed or has a current value inside bounds.
89  // Return value is:
90  // 0: OsiSimpleInteger with upper[vInd] == lower[vInd]
91  // 1: OsiSimpleInteger with upper[vInd] > lower[vInd] and
92  // info->solution[vInd] outside bounds
93  // 2: CouenneBranchingObject with upper[vInd] == lower[vInd]
94  // 3: otherwise (meaning good object)
95  int goodCandidate(OsiSolverInterface *solver,
96  OsiBranchingInformation *info,
97  OsiObject **object, const int iObject, const double prec);
98 
100  bool saveBestCand(OsiObject **object, const int iObject,
101  const double value,
102  const double upEstimate,
103  const double downEstimate,
104  double &bestVal1,
105  double &bestVal2, int &bestIndex,
106  int &bestWay);
107 
108 protected:
109 
111  int simulateBranch (OsiObject *Object,
112  OsiBranchingInformation *info,
113  OsiBranchingObject *branch,
114  OsiSolverInterface *solver,
115  Bonmin::HotInfo * result,
116  int direction);
117 
120 
125 
136 
139 
141  double branchtime_;
142 };
143 
144 }
145 
146 #endif
int goodCandidate(OsiSolverInterface *solver, OsiBranchingInformation *info, OsiObject **object, const int iObject, const double prec)
virtual int doStrongBranching(OsiSolverInterface *OsiSolver, OsiBranchingInformation *info, int numberToDo, int returnCriterion)
This is a utility function which does strong branching on a list of objects and stores the results in...
int simulateBranch(OsiObject *Object, OsiBranchingInformation *info, OsiBranchingObject *branch, OsiSolverInterface *solver, Bonmin::HotInfo *result, int direction)
does one side of the branching
virtual int setupList(OsiBranchingInformation *info, bool initialize)
Sets up strong list and clears all if initialize is true.
void printObjViol(OsiBranchingInformation *info)
virtual ~CouenneChooseStrong()
Destructor.
CouenneProblem * problem_
Pointer to the associated MINLP problem.
virtual OsiChooseVariable * clone() const
Clone.
int gutsOfSetupList(OsiBranchingInformation *info, bool initialize)
static void registerOptions(Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions)
Add list of options to be read from file.
Solver interface class with a pointer to a Couenne cut generator.
bool estimateProduct_
Normally, a convex combination of the min/max lower bounds&#39; estimates is taken to select a branching ...
bool pseudoUpdateLP_
should we update the pseudocost multiplier with the distance between the LP point and the solution of...
Class for MINLP problems with symbolic information.
virtual bool feasibleSolution(const OsiBranchingInformation *info, const double *solution, int numberObjects, const OsiObject **objects)
Returns true if solution looks feasible against given objects.
JnlstPtr jnlst_
pointer to journalist for detailed information
bool saveBestCand(OsiObject **object, const int iObject, const double value, const double upEstimate, const double downEstimate, double &bestVal1, double &bestVal2, int &bestIndex, int &bestWay)
Save best candidate.
CouenneChooseStrong()
Default Constructor, forbidden for some reason.
CouenneChooseStrong & operator=(const CouenneChooseStrong &rhs)
Assignment operator.
virtual int chooseVariable(OsiSolverInterface *solver, OsiBranchingInformation *info, bool fixVariables)
choose object to branch based on earlier setup
double branchtime_
total time spent in strong branching