Minotaur 0.4.1
Docs for developers
|
Store function, bounds and other information about a cut. More...
#include <Cut.h>
Public Member Functions | |
Cut () | |
Empty Constructor. | |
Cut (size_t n, FunctionPtr f, double lb, double ub, bool never_delete, bool never_disable) | |
Default constructor. More... | |
Cut (ProblemPtr p, FunctionPtr f, double lb, double ub, bool never_delete, bool never_disable) | |
~Cut () | |
Destroy. | |
void | applyToProblem (ProblemPtr p) |
Add a cut to the problem. More... | |
double | eval (const double *x, int *err) |
Evaluate the activity of this cut at a given point. More... | |
void | evalScore (const double *x, double *vio, double *score) |
Evaluate score of this cut at a given point. More... | |
ConstraintPtr | getConstraint () |
Get Constraint pointer if this cut is in the problem. Null otherwise. | |
FunctionPtr | getFunction () |
Get Function Pointer of the cut. | |
CutInfo * | getInfo () |
Get pointer to the cut info data structure. | |
double | getLb () |
Get lb of the inequality. | |
std::string | getName () |
Get name of the cut. | |
double | getUb () |
Get ub of the inequality. | |
void | setCons (ConstraintPtr c) |
Constraint associated with the cut. | |
void | setName_ (std::string name) |
Set name of the cut. | |
void | write (std::ostream &out) const |
Display. | |
void | writeStats (std::ostream &out) const |
Display statistics and information. | |
Protected Member Functions | |
void | initInfo_ (bool never_delete, bool never_disable) |
Initialize the values in info_ data structure. More... | |
void | evalFixedScore_ () |
Assign a fixed score to the cut. | |
Protected Attributes | |
ConstraintPtr | cons_ |
Pointer to the constraint. Null if it is disabled. | |
FunctionPtr | f_ |
Pointer to the function of a cut. | |
CutInfo | info_ |
Information about the cut. | |
double | lb_ |
Lower bound. | |
LoggerPtr | logger_ |
Logger for display. | |
size_t | n_ |
Number of variables in the problem. Used to calculate hash. | |
double | ub_ |
Upper bound. | |
double | fixedScore_ |
Fixed score of each cut. | |
std::string | name_ |
Name of the cut (could be NULL). | |
Store function, bounds and other information about a cut.
The Cut class is meant to store a cut generated by different cut generators and handlers. This is a base class and special classes of cuts can be derived from it. Also stores auxiliary information and statistics about this cut.
Cut::Cut | ( | size_t | n, |
FunctionPtr | f, | ||
double | lb, | ||
double | ub, | ||
bool | never_delete, | ||
bool | never_disable | ||
) |
Default constructor.
[in] | n | Number of variables in the problem to which this cut is applied. Used for evaluating a hash value. |
[in] | f | Function ![]() ![]() |
[in] | lb | Lower bound ![]() |
[in] | ub | Upper bound ![]() |
[in] | never_delete | If true, this cut is never deleted from the pool. |
[in] | never_disable | If true, this cut is never removed from the problem. |
void Cut::applyToProblem | ( | ProblemPtr | p | ) |
Add a cut to the problem.
[in] | p | The given problem. |
double Cut::eval | ( | const double * | x, |
int * | err | ||
) |
Evaluate the activity of this cut at a given point.
[in] | x | The given point. |
[out] | err | Zero if no error ocurred in evaluation. |
void Cut::evalScore | ( | const double * | x, |
double * | vio, | ||
double * | score | ||
) |
Evaluate score of this cut at a given point.
[in] | x | The given point. |
[out] | vio | Violation of this cut. |
[out] | score | Score if this cut. |
|
protected |
Initialize the values in info_ data structure.
[in] | never_delete | True if cut should never leave the pool. |
[in] | never_disable | True if cut should never be removed from the problem. |