Minotaur 0.4.1
Docs for developers
|
Public Member Functions | |
PerspCutHandler () | |
Default constructor. | |
PerspCutHandler (EnvPtr env, ProblemPtr problem) | |
Constructor. | |
~PerspCutHandler () | |
Destructor. | |
virtual Branches | getBranches (BrCandPtr, DoubleVector &, RelaxationPtr, SolutionPoolPtr) |
Does nothing. More... | |
virtual void | getBranchingCandidates (RelaxationPtr, const DoubleVector &, ModVector &, BrVarCandSet &, BrCandVector &, bool &) |
find branching candidates. More... | |
virtual ModificationPtr | getBrMod (BrCandPtr, DoubleVector &, RelaxationPtr, BranchDirection) |
Does nothing. More... | |
std::string | getName () const |
Returns name of the handler. More... | |
SolveStatus | presolve (PreModQ *, bool *, Solution **sol) |
Does nothing. More... | |
virtual bool | presolveNode (RelaxationPtr, NodePtr, SolutionPoolPtr, ModVector &, ModVector &) |
Does nothing. More... | |
void | relaxInitFull (RelaxationPtr, bool *) |
Does nothing. | |
void | relaxInitInc (RelaxationPtr, bool *) |
Does nothing. | |
void | relaxNodeFull (NodePtr, RelaxationPtr, bool *) |
Does nothing. More... | |
void | relaxNodeInc (NodePtr, RelaxationPtr, bool *) |
Does nothing. More... | |
void | separate (ConstSolutionPtr sol, NodePtr node, RelaxationPtr rel, CutManager *cutman, SolutionPoolPtr s_pool, ModVector &p_mods, ModVector &r_mods, bool *sol_found, SeparationStatus *status) |
Separates current solution. More... | |
void | addCut (RelaxationPtr rel, const double *nlpx, const double *lpx, UInt it, SeparationStatus *pcStatus) |
void | atIntPt (RelaxationPtr rel, const double *nlpx, const double *lpx, SeparationStatus *pcStatus, CutManager *) |
void | linearAt (RelaxationPtr rel, FunctionPtr f, double fval, const double *x, double *c, LinearFunctionPtr *lf, int *error) |
void | getCutFun (RelaxationPtr rel, LinearFunctionPtr *lf, UInt it, const double *x, double *c, int *error) |
void | addCutToRel (RelaxationPtr rel, LinearFunctionPtr lf, double c) |
Add PCut torelaxation. | |
void | oriFeasPt (RelaxationPtr rel, const double *x) |
Iterate over PR amenable constraints to add PCut;. More... | |
void | oriInfeasPt (RelaxationPtr rel, const double *x) |
void | atPtx (RelaxationPtr rel, const double *x) |
void | cutToCons (RelaxationPtr rel, const double *x, UInt it) |
void | bisecPt (const double *x, double *y, UInt it) |
void | cvxCombPt (RelaxationPtr rel, const double *y, UInt it) |
double | changeVarForm (VariablePtr v, double xc, double xb, UInt itn, int *error) |
void | linearAt (RelaxationPtr rel, const double *y, double *c, LinearFunctionPtr *lf, UInt itn, int *error) |
std::vector< ConstraintPtr > | getPRCons () |
Return vector of perspective amenable constraint. | |
bool | isFeasible (ConstSolutionPtr, RelaxationPtr, bool &, double &) |
Check feasibility of PR amenable constraints at the given solution. More... | |
void | prVars (const double *x, double *y, UInt itn, int *error) |
Generate variables for PR reformulation. | |
void | findPRCons () |
bool | getStatus () |
Return 1 if there are PR amenable constraints in the problem. | |
void | writeStats (std::ostream &out) const |
Writes statistics. More... | |
![]() | |
Handler () | |
Default constructor. | |
virtual | ~Handler () |
Destroy. | |
virtual void | addConstraint (ConstraintPtr newcon) |
Add constraint to be handled by this handler. More... | |
virtual ConstraintVector::const_iterator | consBegin () const |
virtual ConstraintVector::const_iterator | consEnd () const |
virtual int | fixNodeErr (RelaxationPtr, ConstSolutionPtr, SolutionPoolPtr, bool &) |
virtual Branches | getBranches (BrCandPtr cand, DoubleVector &x, RelaxationPtr rel, SolutionPoolPtr s_pool)=0 |
Return branches for branching. More... | |
virtual void | getBranchingCandidates (RelaxationPtr rel, const DoubleVector &x, ModVector &mods, BrVarCandSet &cands, BrCandVector &gencands, bool &is_inf)=0 |
find branching candidates. More... | |
virtual ModificationPtr | getBrMod (BrCandPtr cand, DoubleVector &x, RelaxationPtr rel, BranchDirection dir)=0 |
Get the modifcation that creates a given (up or down) branch. More... | |
virtual std::string | getName () const =0 |
Return the name of the handler. More... | |
bool | getStrongerMods (RelaxationPtr rel, NodePtr node, SolutionPoolPtr s_pool, ModVector &p_mods, ModVector &r_mods) |
do node presolve to get mods for stronger branching All params are presolveNode params. | |
virtual bool | isFeasible (ConstSolutionPtr sol, RelaxationPtr rel, bool &should_prune, double &inf_meas)=0 |
Check if a solution is feasible. More... | |
virtual bool | isNeeded () |
Return true if this handler is needed for the problem. More... | |
virtual SolveStatus | presolve (PreModQ *pre_mods, bool *changed, Solution **sol)=0 |
Initial presolve. More... | |
virtual bool | presolveNode (RelaxationPtr rel, NodePtr node, SolutionPoolPtr s_pool, ModVector &p_mods, ModVector &r_mods)=0 |
Presolve the problem and its relaxation at a node. More... | |
virtual bool | postSolveRootNode (RelaxationPtr, SolutionPoolPtr, ConstSolutionPtr, ModVector &, ModVector &) |
At the root node post solve the problem and its relaxation. LP based bound tightening (OBBT) is employed here after filtering variables for which no OBBT is required. More... | |
virtual void | relaxInitFull (RelaxationPtr rel, SolutionPool *sp, bool *is_inf)=0 |
Create root relaxation if doing full node relaxations. More... | |
virtual void | relaxInitInc (RelaxationPtr rel, SolutionPool *sp, bool *is_inf)=0 |
Create root relaxation if doing incremental node relaxations. More... | |
virtual void | relaxNodeFull (NodePtr node, RelaxationPtr rel, bool *is_inf)=0 |
Create a relaxation for a node, building from scratch. More... | |
virtual void | relaxNodeInc (NodePtr node, RelaxationPtr rel, bool *is_inf)=0 |
Create an incremental relaxation for a node. More... | |
virtual void | removeCuts (RelaxationPtr, ConstSolutionPtr) |
virtual void | separate (ConstSolutionPtr sol, NodePtr node, RelaxationPtr rel, CutManager *cutman, SolutionPoolPtr s_pool, ModVector &p_mods, ModVector &r_mods, bool *sol_found, SeparationStatus *status)=0 |
add cuts to separate a given point. More... | |
virtual void | setModFlags (bool mod_prob, bool mod_rel) |
Tell the handler whether the problem will be modified or the relaxation will be modified or both. These modifications will be saved in the tree as well. More... | |
virtual void | simplePresolve (ProblemPtr, SolutionPoolPtr, ModVector &, SolveStatus &status) |
void | undoStrongerMods (ProblemPtr p, RelaxationPtr rel, ModVector &p_mods, ModVector &r_mods) |
Undo Modifications made during stronger branching. More... | |
virtual void | writeStats (std::ostream &) const |
Write statistics to ostream out. More... | |
Additional Inherited Members | |
![]() | |
ConstraintVector | cons_ |
bool | modProb_ |
If true, modify the original (or transformed) problem. | |
bool | modRel_ |
If true, modify the relaxation of original (or transformed) problem. | |
void Minotaur::PerspCutHandler::addCut | ( | RelaxationPtr | rel, |
const double * | nlpx, | ||
const double * | lpx, | ||
UInt | it, | ||
SeparationStatus * | pcStatus | ||
) |
Add Perspective cut (PCut) to a violated PR amenable constraint whose associated binary variable in integer at the given point (nlpx).
void PerspCutHandler::atIntPt | ( | RelaxationPtr | rel, |
const double * | nlpx, | ||
const double * | lpx, | ||
SeparationStatus * | pcStatus, | ||
CutManager * | |||
) |
Add PCut to violated PR amenable constraints whose associated binary variable in integer at the given point (nlpx).
void PerspCutHandler::atPtx | ( | RelaxationPtr | rel, |
const double * | x | ||
) |
Add PCut to a PR amenable constraint. If both the original and PR amenable constraints are satisfied at x, PCut is added at x. If only former is satisfied, then a point feasible to latter is obtained using bisection at which PCut is then added. If both the constraints are not satisfied then first a point feasible to original constraint is obtained using which a point satisfying PR amneable constraint is obtained using bisection, at which PCut is added.
void PerspCutHandler::bisecPt | ( | const double * | x, |
double * | y, | ||
UInt | it | ||
) |
Determine a point feasible to orginal constraint when the given point (x) violates both original and PR reformulated constraints. Give variable values when associated binary variable is 0 for a PR amenable constraint. Find a point (w1) feasible to original constraint using bisection method on points x and w, where former in feasible and latter is infeasible to the original constraint. Given point x violating PR amenable constraint give a feasible point using bisection.
|
inlinevirtual |
Does nothing.
Implements Minotaur::Handler.
|
inlinevirtual |
find branching candidates.
A brancher will ask each handler by calling this function to list branching candidates.
[in] | rel | Relaxation being solved at current node. |
[in] | x | Solution of the relaxation. |
[out] | mods | Any modifications that the handler found (Unused). |
[out] | cands | The set of candidates to which branching candidates must be inserted. This set has candidates that want to branch on a single variable only. Other candidates must go into gencands. |
[out] | gencands | The vector of general branching candidates. All candidates that do not want to branch on a variable dichotomy must be added in this vector. |
[out] | is_inf | true if the handler finds that the problem is infeasible and the node can be pruned. |
Implements Minotaur::Handler.
|
inlinevirtual |
Does nothing.
Implements Minotaur::Handler.
void PerspCutHandler::getCutFun | ( | RelaxationPtr | rel, |
LinearFunctionPtr * | lf, | ||
UInt | it, | ||
const double * | x, | ||
double * | c, | ||
int * | error | ||
) |
Add PCut to a PR amenable constraint whose associated binary variable in integer at the given point (nlpx).
|
virtual |
Returns name of the handler.
Implements Minotaur::Handler.
|
virtual |
Check feasibility of PR amenable constraints at the given solution.
Implements Minotaur::Handler.
void PerspCutHandler::linearAt | ( | RelaxationPtr | rel, |
const double * | y, | ||
double * | c, | ||
LinearFunctionPtr * | lf, | ||
UInt | itn, | ||
int * | error | ||
) |
Given outer-approximatio to a violated PR constraint
void PerspCutHandler::linearAt | ( | RelaxationPtr | rel, |
FunctionPtr | f, | ||
double | fval, | ||
const double * | x, | ||
double * | c, | ||
LinearFunctionPtr * | lf, | ||
int * | error | ||
) |
Add OA cut to original constraint of a violated PR constraint whose associated binary variable has value 0.
void PerspCutHandler::oriFeasPt | ( | RelaxationPtr | rel, |
const double * | x | ||
) |
Iterate over PR amenable constraints to add PCut;.
Add PCut to a PR amenable constraint. At point (x) original constraint is known to be satisfied but not necessarily PR constraint. If PR constraint is satisfied at x then PCut is added at x. Otherwise, a feasible point to add PCut is obtained using bisection.
|
inlinevirtual |
Does nothing.
Implements Minotaur::Handler.
|
inlinevirtual |
Does nothing.
Implements Minotaur::Handler.
|
inlinevirtual |
Does nothing.
Implements Minotaur::Handler.
|
inlinevirtual |
Does nothing.
Implements Minotaur::Handler.
|
virtual |
Separates current solution.
Implements Minotaur::Handler.
|
virtual |
Writes statistics.
Reimplemented from Minotaur::Handler.