#include <OsiChooseVariable.hpp>
Inheritance diagram for OsiChooseVariable:
Public Member Functions | |
OsiChooseVariable () | |
Default Constructor. | |
OsiChooseVariable (const OsiSolverInterface *solver) | |
Constructor from solver (so we can set up arrays etc). | |
OsiChooseVariable (const OsiChooseVariable &) | |
Copy constructor. | |
OsiChooseVariable & | operator= (const OsiChooseVariable &rhs) |
Assignment operator. | |
virtual OsiChooseVariable * | clone () const |
Clone. | |
virtual | ~OsiChooseVariable () |
Destructor. | |
virtual int | setupList (OsiBranchingInformation *info, bool initialize) |
Sets up strong list and clears all if initialize is true. | |
virtual int | chooseVariable (OsiSolverInterface *solver, OsiBranchingInformation *info, bool fixVariables) |
Choose a variable Returns - -1 Node is infeasible 0 Normal termination - we have a candidate 1 All looks satisfied - no candidate 2 We can change the bound on a variable - but we also have a strong branching candidate 3 We can change the bound on a variable - but we have a non-strong branching candidate 4 We can change the bound on a variable - no other candidates We can pick up branch from bestObjectIndex() and bestWhichWay() We can pick up a forced branch (can change bound) from firstForcedObjectIndex() and firstForcedWhichWay() If we have a solution then we can pick up from goodObjectiveValue() and goodSolution() If fixVariables is true then 2,3,4 are all really same as problem changed. | |
int | doStrongBranching (OsiSolverInterface *solver, OsiBranchingInformation *info, int numberToDo, OsiHotInfo *results, int returnCriterion, int &numberDone) |
This is a utility function which does strong branching on a list of objects and stores the results in OsiHotInfo.objects. | |
bool | feasibleSolution (const OsiBranchingInformation *info, const double *solution, int numberObjects, const OsiObject **objects) |
Returns true if solution looks feasible against given objects. | |
void | saveSolution (const OsiSolverInterface *solver) |
Saves a good solution. | |
void | clearGoodSolution () |
Clears out good solution after use. | |
virtual void | updateInformation (const OsiBranchingInformation *info, int branch, OsiHotInfo *hotInfo) |
Given a candidate fill in useful information e.g. estimates. | |
double | goodObjectiveValue () const |
Objective value for feasible solution. | |
double | upChange () const |
Estimate of up change or change on chosen if n-way. | |
double | downChange () const |
Estimate of down change or max change on other possibilities if n-way. | |
const double * | goodSolution () const |
Good solution - deleted by finalize. | |
int | bestObjectIndex () const |
Index of chosen object. | |
void | setBestObjectIndex (int value) |
Set index of chosen object. | |
int | bestWhichWay () const |
Preferred way of chosen object. | |
void | setBestWhichWay (int value) |
Set preferred way of chosen object. | |
int | firstForcedObjectIndex () const |
Index of forced object. | |
void | setFirstForcedObjectIndex (int value) |
Set index of forced object. | |
int | firstForcedWhichWay () const |
Preferred way of forced object. | |
void | setFirstForcedWhichWay (int value) |
Set preferred way of forced object. | |
int | numberUnsatisfied () const |
Get the number of objects unsatisfied at this node - accurate on first pass. | |
int | numberStrong () const |
Number of objects to choose for strong branching. | |
void | setNumberStrong (int value) |
Set number of objects to choose for strong branching. | |
int | numberOnList () const |
Number left on strong list. | |
int | numberStrongDone () const |
Number of strong branches actually done. | |
int | numberStrongIterations () const |
Number of strong iterations actually done. | |
int | numberStrongFixed () const |
Number of strong branches which changed bounds. | |
const int * | candidates () const |
List of candidates. | |
bool | trustStrongForBound () const |
Trust results from strong branching for changing bounds. | |
void | setTrustStrongForBound (bool yesNo) |
Set trust results from strong branching for changing bounds. | |
bool | trustStrongForSolution () const |
Trust results from strong branching for valid solution. | |
void | setTrustStrongForSolution (bool yesNo) |
Set trust results from strong branching for valid solution. | |
void | setSolver (const OsiSolverInterface *solver) |
Set solver and redo arrays. | |
int | status () const |
Return status - -1 Node is infeasible 0 Normal termination - we have a candidate 1 All looks satisfied - no candidate 2 We can change the bound on a variable - but we also have a strong branching candidate 3 We can change the bound on a variable - but we have a non-strong branching candidate 4 We can change the bound on a variable - no other candidates We can pick up branch from bestObjectIndex() and bestWhichWay() We can pick up a forced branch (can change bound) from firstForcedObjectIndex() and firstForcedWhichWay() If we have a solution then we can pick up from goodObjectiveValue() and goodSolution(). | |
void | setStatus (int value) |
Protected Attributes | |
double | goodObjectiveValue_ |
Objective value for feasible solution. | |
double | upChange_ |
Estimate of up change or change on chosen if n-way. | |
double | downChange_ |
Estimate of down change or max change on other possibilities if n-way. | |
double * | goodSolution_ |
Good solution - deleted by finalize. | |
int * | list_ |
List of candidates. | |
double * | useful_ |
Useful array (for sorting etc). | |
const OsiSolverInterface * | solver_ |
Pointer to solver. | |
int | status_ |
int | bestObjectIndex_ |
Index of chosen object. | |
int | bestWhichWay_ |
Preferred way of chosen object. | |
int | firstForcedObjectIndex_ |
Index of forced object. | |
int | firstForcedWhichWay_ |
Preferred way of forced object. | |
int | numberUnsatisfied_ |
The number of objects unsatisfied at this node. | |
int | numberStrong_ |
Number of objects to choose for strong branching. | |
int | numberOnList_ |
Number left on strong list. | |
int | numberStrongDone_ |
Number of strong branches actually done. | |
int | numberStrongIterations_ |
Number of strong iterations actually done. | |
int | numberStrongFixed_ |
Number of bound changes due to strong branching. | |
bool | trustStrongForBound_ |
List of unsatisfied objects - first numberOnList_ for strong branching Trust results from strong branching for changing bounds. | |
bool | trustStrongForSolution_ |
Trust results from strong branching for valid solution. |
The base class just chooses the variable and direction without strong branching but it has information which would normally be used by strong branching e.g. to re-enter having fixed a variable but using same candidates for strong branching.
The flow is : a) initialize the process. This decides on strong branching list and stores indices of all infeasible objects b) do strong branching on list. If list is empty then just choose one candidate and return without strong branching. If not empty then go through list and return best. However we may find that the node is infeasible or that we can fix a variable. If so we return and it is up to user to call again (after fixing a variable).
Definition at line 31 of file OsiChooseVariable.hpp.
OsiChooseVariable::OsiChooseVariable | ( | ) |
Default Constructor.
OsiChooseVariable::OsiChooseVariable | ( | const OsiSolverInterface * | solver | ) |
Constructor from solver (so we can set up arrays etc).
OsiChooseVariable::OsiChooseVariable | ( | const OsiChooseVariable & | ) |
Copy constructor.
virtual OsiChooseVariable::~OsiChooseVariable | ( | ) | [virtual] |
Destructor.
OsiChooseVariable& OsiChooseVariable::operator= | ( | const OsiChooseVariable & | rhs | ) |
Assignment operator.
virtual OsiChooseVariable* OsiChooseVariable::clone | ( | ) | const [virtual] |
virtual int OsiChooseVariable::setupList | ( | OsiBranchingInformation * | info, | |
bool | initialize | |||
) | [virtual] |
Sets up strong list and clears all if initialize is true.
Returns number of infeasibilities. If returns -1 then has worked out node is infeasible!
Reimplemented in OsiChooseStrong.
virtual int OsiChooseVariable::chooseVariable | ( | OsiSolverInterface * | solver, | |
OsiBranchingInformation * | info, | |||
bool | fixVariables | |||
) | [virtual] |
Choose a variable Returns - -1 Node is infeasible 0 Normal termination - we have a candidate 1 All looks satisfied - no candidate 2 We can change the bound on a variable - but we also have a strong branching candidate 3 We can change the bound on a variable - but we have a non-strong branching candidate 4 We can change the bound on a variable - no other candidates We can pick up branch from bestObjectIndex() and bestWhichWay() We can pick up a forced branch (can change bound) from firstForcedObjectIndex() and firstForcedWhichWay() If we have a solution then we can pick up from goodObjectiveValue() and goodSolution() If fixVariables is true then 2,3,4 are all really same as problem changed.
Reimplemented in OsiChooseStrong.
int OsiChooseVariable::doStrongBranching | ( | OsiSolverInterface * | solver, | |
OsiBranchingInformation * | info, | |||
int | numberToDo, | |||
OsiHotInfo * | results, | |||
int | returnCriterion, | |||
int & | numberDone | |||
) |
This is a utility function which does strong branching on a list of objects and stores the results in OsiHotInfo.objects.
On entry the object sequence is stored in the OsiHotInfo object and maybe more. It returns - -1 - one branch was infeasible both ways 0 - all inspected - nothing can be fixed 1 - all inspected - some can be fixed (returnCriterion==0) 2 - may be returning early - one can be fixed (last one done) (returnCriterion==1) 3 - returning because max time
bool OsiChooseVariable::feasibleSolution | ( | const OsiBranchingInformation * | info, | |
const double * | solution, | |||
int | numberObjects, | |||
const OsiObject ** | objects | |||
) |
Returns true if solution looks feasible against given objects.
void OsiChooseVariable::saveSolution | ( | const OsiSolverInterface * | solver | ) |
Saves a good solution.
void OsiChooseVariable::clearGoodSolution | ( | ) |
Clears out good solution after use.
virtual void OsiChooseVariable::updateInformation | ( | const OsiBranchingInformation * | info, | |
int | branch, | |||
OsiHotInfo * | hotInfo | |||
) | [virtual] |
double OsiChooseVariable::goodObjectiveValue | ( | ) | const [inline] |
Objective value for feasible solution.
Definition at line 101 of file OsiChooseVariable.hpp.
References goodObjectiveValue_.
double OsiChooseVariable::upChange | ( | ) | const [inline] |
Estimate of up change or change on chosen if n-way.
Definition at line 104 of file OsiChooseVariable.hpp.
References upChange_.
double OsiChooseVariable::downChange | ( | ) | const [inline] |
Estimate of down change or max change on other possibilities if n-way.
Definition at line 107 of file OsiChooseVariable.hpp.
References downChange_.
const double* OsiChooseVariable::goodSolution | ( | ) | const [inline] |
Good solution - deleted by finalize.
Definition at line 110 of file OsiChooseVariable.hpp.
References goodSolution_.
int OsiChooseVariable::bestObjectIndex | ( | ) | const [inline] |
Index of chosen object.
Definition at line 113 of file OsiChooseVariable.hpp.
References bestObjectIndex_.
void OsiChooseVariable::setBestObjectIndex | ( | int | value | ) | [inline] |
Set index of chosen object.
Definition at line 116 of file OsiChooseVariable.hpp.
References bestObjectIndex_.
int OsiChooseVariable::bestWhichWay | ( | ) | const [inline] |
Preferred way of chosen object.
Definition at line 119 of file OsiChooseVariable.hpp.
References bestWhichWay_.
void OsiChooseVariable::setBestWhichWay | ( | int | value | ) | [inline] |
Set preferred way of chosen object.
Definition at line 122 of file OsiChooseVariable.hpp.
References bestWhichWay_.
int OsiChooseVariable::firstForcedObjectIndex | ( | ) | const [inline] |
Index of forced object.
Definition at line 125 of file OsiChooseVariable.hpp.
References firstForcedObjectIndex_.
void OsiChooseVariable::setFirstForcedObjectIndex | ( | int | value | ) | [inline] |
Set index of forced object.
Definition at line 128 of file OsiChooseVariable.hpp.
References firstForcedObjectIndex_.
int OsiChooseVariable::firstForcedWhichWay | ( | ) | const [inline] |
Preferred way of forced object.
Definition at line 131 of file OsiChooseVariable.hpp.
References firstForcedWhichWay_.
void OsiChooseVariable::setFirstForcedWhichWay | ( | int | value | ) | [inline] |
Set preferred way of forced object.
Definition at line 134 of file OsiChooseVariable.hpp.
References firstForcedWhichWay_.
int OsiChooseVariable::numberUnsatisfied | ( | ) | const [inline] |
Get the number of objects unsatisfied at this node - accurate on first pass.
Definition at line 137 of file OsiChooseVariable.hpp.
References numberUnsatisfied_.
int OsiChooseVariable::numberStrong | ( | ) | const [inline] |
Number of objects to choose for strong branching.
Definition at line 140 of file OsiChooseVariable.hpp.
References numberStrong_.
void OsiChooseVariable::setNumberStrong | ( | int | value | ) | [inline] |
Set number of objects to choose for strong branching.
Definition at line 143 of file OsiChooseVariable.hpp.
References numberStrong_.
int OsiChooseVariable::numberOnList | ( | ) | const [inline] |
Number left on strong list.
Definition at line 146 of file OsiChooseVariable.hpp.
References numberOnList_.
int OsiChooseVariable::numberStrongDone | ( | ) | const [inline] |
Number of strong branches actually done.
Definition at line 149 of file OsiChooseVariable.hpp.
References numberStrongDone_.
int OsiChooseVariable::numberStrongIterations | ( | ) | const [inline] |
Number of strong iterations actually done.
Definition at line 152 of file OsiChooseVariable.hpp.
References numberStrongIterations_.
int OsiChooseVariable::numberStrongFixed | ( | ) | const [inline] |
Number of strong branches which changed bounds.
Definition at line 155 of file OsiChooseVariable.hpp.
References numberStrongFixed_.
const int* OsiChooseVariable::candidates | ( | ) | const [inline] |
bool OsiChooseVariable::trustStrongForBound | ( | ) | const [inline] |
Trust results from strong branching for changing bounds.
Definition at line 161 of file OsiChooseVariable.hpp.
References trustStrongForBound_.
void OsiChooseVariable::setTrustStrongForBound | ( | bool | yesNo | ) | [inline] |
Set trust results from strong branching for changing bounds.
Definition at line 164 of file OsiChooseVariable.hpp.
References trustStrongForBound_.
bool OsiChooseVariable::trustStrongForSolution | ( | ) | const [inline] |
Trust results from strong branching for valid solution.
Definition at line 167 of file OsiChooseVariable.hpp.
References trustStrongForSolution_.
void OsiChooseVariable::setTrustStrongForSolution | ( | bool | yesNo | ) | [inline] |
Set trust results from strong branching for valid solution.
Definition at line 170 of file OsiChooseVariable.hpp.
References trustStrongForSolution_.
void OsiChooseVariable::setSolver | ( | const OsiSolverInterface * | solver | ) |
Set solver and redo arrays.
int OsiChooseVariable::status | ( | ) | const [inline] |
Return status - -1 Node is infeasible 0 Normal termination - we have a candidate 1 All looks satisfied - no candidate 2 We can change the bound on a variable - but we also have a strong branching candidate 3 We can change the bound on a variable - but we have a non-strong branching candidate 4 We can change the bound on a variable - no other candidates We can pick up branch from bestObjectIndex() and bestWhichWay() We can pick up a forced branch (can change bound) from firstForcedObjectIndex() and firstForcedWhichWay() If we have a solution then we can pick up from goodObjectiveValue() and goodSolution().
Definition at line 185 of file OsiChooseVariable.hpp.
References status_.
void OsiChooseVariable::setStatus | ( | int | value | ) | [inline] |
Definition at line 187 of file OsiChooseVariable.hpp.
double OsiChooseVariable::goodObjectiveValue_ [protected] |
Objective value for feasible solution.
Definition at line 188 of file OsiChooseVariable.hpp.
Referenced by goodObjectiveValue().
double OsiChooseVariable::upChange_ [protected] |
Estimate of up change or change on chosen if n-way.
Definition at line 196 of file OsiChooseVariable.hpp.
Referenced by upChange().
double OsiChooseVariable::downChange_ [protected] |
Estimate of down change or max change on other possibilities if n-way.
Definition at line 198 of file OsiChooseVariable.hpp.
Referenced by downChange().
double* OsiChooseVariable::goodSolution_ [protected] |
Good solution - deleted by finalize.
Definition at line 200 of file OsiChooseVariable.hpp.
Referenced by goodSolution().
int* OsiChooseVariable::list_ [protected] |
List of candidates.
Definition at line 202 of file OsiChooseVariable.hpp.
Referenced by candidates().
double* OsiChooseVariable::useful_ [protected] |
const OsiSolverInterface* OsiChooseVariable::solver_ [protected] |
int OsiChooseVariable::status_ [protected] |
int OsiChooseVariable::bestObjectIndex_ [protected] |
Index of chosen object.
Definition at line 217 of file OsiChooseVariable.hpp.
Referenced by bestObjectIndex(), and setBestObjectIndex().
int OsiChooseVariable::bestWhichWay_ [protected] |
Preferred way of chosen object.
Definition at line 219 of file OsiChooseVariable.hpp.
Referenced by bestWhichWay(), and setBestWhichWay().
int OsiChooseVariable::firstForcedObjectIndex_ [protected] |
Index of forced object.
Definition at line 221 of file OsiChooseVariable.hpp.
Referenced by firstForcedObjectIndex(), and setFirstForcedObjectIndex().
int OsiChooseVariable::firstForcedWhichWay_ [protected] |
Preferred way of forced object.
Definition at line 223 of file OsiChooseVariable.hpp.
Referenced by firstForcedWhichWay(), and setFirstForcedWhichWay().
int OsiChooseVariable::numberUnsatisfied_ [protected] |
The number of objects unsatisfied at this node.
Definition at line 225 of file OsiChooseVariable.hpp.
Referenced by numberUnsatisfied().
int OsiChooseVariable::numberStrong_ [protected] |
Number of objects to choose for strong branching.
Definition at line 227 of file OsiChooseVariable.hpp.
Referenced by numberStrong(), and setNumberStrong().
int OsiChooseVariable::numberOnList_ [protected] |
Number left on strong list.
Definition at line 229 of file OsiChooseVariable.hpp.
Referenced by numberOnList().
int OsiChooseVariable::numberStrongDone_ [protected] |
Number of strong branches actually done.
Definition at line 231 of file OsiChooseVariable.hpp.
Referenced by numberStrongDone().
int OsiChooseVariable::numberStrongIterations_ [protected] |
Number of strong iterations actually done.
Definition at line 233 of file OsiChooseVariable.hpp.
Referenced by numberStrongIterations().
int OsiChooseVariable::numberStrongFixed_ [protected] |
Number of bound changes due to strong branching.
Definition at line 235 of file OsiChooseVariable.hpp.
Referenced by numberStrongFixed().
bool OsiChooseVariable::trustStrongForBound_ [protected] |
List of unsatisfied objects - first numberOnList_ for strong branching Trust results from strong branching for changing bounds.
Definition at line 238 of file OsiChooseVariable.hpp.
Referenced by setTrustStrongForBound(), and trustStrongForBound().
bool OsiChooseVariable::trustStrongForSolution_ [protected] |
Trust results from strong branching for valid solution.
Definition at line 240 of file OsiChooseVariable.hpp.
Referenced by setTrustStrongForSolution(), and trustStrongForSolution().