Minotaur 0.4.1
Docs for developers
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Minotaur::Cut Class Reference

Store function, bounds and other information about a cut. More...

#include <Cut.h>

Inheritance diagram for Minotaur::Cut:
Inheritance graph
[legend]
Collaboration diagram for Minotaur::Cut:
Collaboration graph
[legend]

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.
 
CutInfogetInfo ()
 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).
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Cut()

Cut::Cut ( size_t  n,
FunctionPtr  f,
double  lb,
double  ub,
bool  never_delete,
bool  never_disable 
)

Default constructor.

Parameters
[in]nNumber of variables in the problem to which this cut is applied. Used for evaluating a hash value.
[in]fFunction $f$ in the cut $l \leq f() \leq u$.
[in]lbLower bound $l$ in the above cut.
[in]ubUpper bound $u$ in the above cut.
[in]never_deleteIf true, this cut is never deleted from the pool.
[in]never_disableIf true, this cut is never removed from the problem.

Member Function Documentation

◆ applyToProblem()

void Cut::applyToProblem ( ProblemPtr  p)

Add a cut to the problem.

Parameters
[in]pThe given problem.

◆ eval()

double Cut::eval ( const double *  x,
int *  err 
)

Evaluate the activity of this cut at a given point.

Parameters
[in]xThe given point.
[out]errZero if no error ocurred in evaluation.
Returns
The activity at the given point.

◆ evalScore()

void Cut::evalScore ( const double *  x,
double *  vio,
double *  score 
)

Evaluate score of this cut at a given point.

Parameters
[in]xThe given point.
[out]vioViolation of this cut.
[out]scoreScore if this cut.

◆ initInfo_()

void Cut::initInfo_ ( bool  never_delete,
bool  never_disable 
)
protected

Initialize the values in info_ data structure.

Parameters
[in]never_deleteTrue if cut should never leave the pool.
[in]never_disableTrue if cut should never be removed from the problem.

The documentation for this class was generated from the following files:

Minotaur source code documented by Doxygen 1.9.4 on Thu Apr 24 2025