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

Linear Feasibility Pump for MINLPs. More...

#include <LinFeasPump.h>

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

Public Member Functions

 LinFeasPump (EnvPtr env, ProblemPtr p, EnginePtr e1, EnginePtr e2)
 Default constructor. More...
 
 ~LinFeasPump ()
 Default destructor.
 
void solve (NodePtr node, RelaxationPtr rel, SolutionPoolPtr s_pool)
 Call to the heuristic. More...
 
void writeStats (std::ostream &out) const
 Write statistics to the logger. More...
 
- Public Member Functions inherited from Minotaur::FeasibilityPump
 FeasibilityPump (EnvPtr env, ProblemPtr p, EnginePtr e)
 default constructor
 
 FeasibilityPump (EnvPtr env, ProblemPtr p, EnginePtr nlpe, EnginePtr e)
 constructor for derived class
 
virtual ~FeasibilityPump ()
 default destructor
 
void solve (NodePtr node, RelaxationPtr rel, SolutionPoolPtr s_pool)
 call to the heuristic More...
 
void writeStats (std::ostream &out) const
 write statistic to the logger More...
 
- Public Member Functions inherited from Minotaur::Heuristic
 Heuristic ()
 Default constructor.
 
virtual ~Heuristic ()
 Destroy.
 
virtual void solve (NodePtr node, RelaxationPtr rel, SolutionPoolPtr s_pool)=0
 Use this heuristic. More...
 
virtual void solveNode (ConstSolutionPtr, NodePtr, RelaxationPtr, SolutionPoolPtr)
 Use this heuristic. More...
 
virtual void writeStats (std::ostream &out) const =0
 Write statistics to the logger. More...
 

Protected Member Functions

void constructObj_ (ProblemPtr prob, ConstSolutionPtr sol)
 Function to construct/update the objective function. More...
 
void implementFP_ (const double *x, SolutionPoolPtr s_pool)
 Fucntion to implement the linear feasibility pump. More...
 
double getSolGap_ (double f_nlp, double f_feas)
 Calculate the gap between the NLP relaxation solution and integer feasible solution. More...
 
bool prepareLP_ (SolutionPool *sp)
 A function to prepare the linear relaxation. More...
 
void separatingCut_ (double f_nlp, SolutionPoolPtr s_pool)
 This function makes a cut by including the objective as constraint. More...
 
bool shouldFP_ ()
 Function to decide whether to use Linear Feasibility Pump. More...
 
- Protected Member Functions inherited from Minotaur::FeasibilityPump
virtual void constructObj_ (ProblemPtr prob, ConstSolutionPtr sol)
 Function to construct/update the objective function. More...
 
void convertSol_ (SolutionPoolPtr s_pool, ConstSolutionPtr sol)
 Function to convert a solution of the cloned problem to that of an original problem. More...
 
bool cycle_ (double find_value)
 A search function for detection of cycling. More...
 
double hash_ ()
 A function to hash the solutions. More...
 
virtual void implementFP_ (const double *x, SolutionPoolPtr s_pool)
 Function to implement the Feasibility Pump method. More...
 
bool isFrac_ (const double *x)
 Function to check the integrality of a variable. More...
 
void perturb_ (double hash_val, UInt n_to_flip)
 A function to perturb the rounded solution in case of cycling. More...
 
void restoreBounds_ (double *LB_copy, double *UB_copy, UInt vars)
 A function to restore the upper and lower bounds of the problem. More...
 
void saveBounds_ (double *LB_copy, double *UB_copy, UInt vars)
 A function to save the upper and lower bounds of the problem. More...
 
VarVector selectToFlip_ (UInt n_to_flip)
 A funtion to randomly select "n" binary/integer variable to be flipped. More...
 
virtual bool shouldFP_ ()
 Function to decide whether to use Feasibility Pump. More...
 

Protected Attributes

double * gradientObj_
 gradient of the objective function
 
LinHandlerPtr lh_
 Linear Handler pointer.
 
EnginePtr lpE_
 LP Engine to be used to solving linear relaxation.
 
ConstraintPtr objConstraint_
 objective improvement constraint pointer
 
VariablePtr objVar_
 
LinearFunctionPtr olfClone_
 clone of linear objective function
 
QGHandlerPtr qh_
 QG Handler.
 
RelaxationPtr r_
 Relaxation Pointer.
 
LinFeasStatsstatsLFP_
 Statistics.
 
- Protected Attributes inherited from Minotaur::FeasibilityPump
VarVector bins_
 Binary/integer variables present in the problem.
 
EnginePtr e_
 Pointer to the engine to be used to solve the problem.
 
EnvPtr env_
 Pointer to the environment.
 
DoubleVector hashVal_
 Vector for hash value of solutions.
 
double intTol_
 Tolerance for a number to be considered as an integer.
 
LoggerPtr logger_
 Pointer to the logger.
 
UInt nToFlip_
 Number of variables to be flipped if cycling is detected.
 
ProblemPtr p_
 Pointer to the problem being solved.
 
DoubleVector random_
 A random vector for inner product with the solution.
 
DoubleVector roundedSol_
 Vector of rounded solution.
 
FeasPumpStatsstats_
 Statistics for the Feasibility Pump heuristic.
 
Timertimer_
 Timer of the heuristic.
 

Static Protected Attributes

static const std::string me_ = "Linear Feas Pump: "
 Message name for the heuristic.
 
- Static Protected Attributes inherited from Minotaur::FeasibilityPump
static const std::string me_ = "Feasibility Pump: "
 Message name for the heuristic.
 

Detailed Description

Linear Feasibility Pump for MINLPs.

A Linear Feasibility Pump heuristic used to find solutions for Mixed Integer NLPs by solving a linear relaxation of NLP using a LP engine. An NLP is solved after every "n" iterations and solution from NLP solve is used to construct a LP relaxation. This class is derived from the class FeasibilityPump.

Constructor & Destructor Documentation

◆ LinFeasPump()

LinFeasPump::LinFeasPump ( EnvPtr  env,
ProblemPtr  p,
EnginePtr  e1,
EnginePtr  e2 
)

Default constructor.

Parameters
[in]envEnvironment pointer
[in]pProblem pointer
[in]e1The NLP engine pointer
[in[e2 The LP engine pointer

The constructor initializes the base class using env, p and e1 and uses e2 to initialize the LP engine. Logger of the base is also defined in this function.

Member Function Documentation

◆ constructObj_()

void LinFeasPump::constructObj_ ( ProblemPtr  prob,
ConstSolutionPtr  sol 
)
protectedvirtual

Function to construct/update the objective function.

Parameters
[in]probPointer to the cloned problem
[in]solPointer to the solution of relaxation that was previously solved.

This function selects the variable which are fractional and construct the objective function out of such variables. The new objective function replaces the objective of the problem passed

Reimplemented from Minotaur::FeasibilityPump.

◆ getSolGap_()

double LinFeasPump::getSolGap_ ( double  f_nlp,
double  f_feas 
)
protected

Calculate the gap between the NLP relaxation solution and integer feasible solution.

Parameters
[in]f_nlpnlp solution value.
[in]xconst pointer to integer feasible solution.
Returns
gap. gap is given by $ \frac{f(x)-f(x_nlp)}{|f(x)|+1e-6}$

◆ implementFP_()

void LinFeasPump::implementFP_ ( const double *  x,
SolutionPoolPtr  s_pool 
)
protectedvirtual

Fucntion to implement the linear feasibility pump.

Parameters
[in]s_poolPointer to solution pool
[in]xIs not required. Can be NULL.

Reimplemented from Minotaur::FeasibilityPump.

◆ prepareLP_()

bool LinFeasPump::prepareLP_ ( SolutionPool sp)
protected

A function to prepare the linear relaxation.

Returns
True if problem is infeasible else false

This function first initializes the Linear Handler and QG Handler which are then used to construct a linear relaxation from the original problem

◆ separatingCut_()

void LinFeasPump::separatingCut_ ( double  f_nlp,
SolutionPoolPtr  s_pool 
)
protected

This function makes a cut by including the objective as constraint.

Parameters
[in]f_nlpNLP solution value solution
[in]xconst pointer to the primal feasible solution

If a feasible solution is found we add an additional constraint to the problem to force the heuristic to find a better feasible fucntion. The constraint added is a linear relaxation of the objective at the feasible point, i.e. $ \nabla f(x^{LP}) + (x-x^{LP}) < 0 $

◆ shouldFP_()

bool LinFeasPump::shouldFP_ ( )
protectedvirtual

Function to decide whether to use Linear Feasibility Pump.

Returns
true if to be implemented else fasle

The linear feasibility pump is not implemented for problems with equality constraints for the form $ c(x) = 0 $

Reimplemented from Minotaur::FeasibilityPump.

◆ solve()

void LinFeasPump::solve ( NodePtr  node,
RelaxationPtr  rel,
SolutionPoolPtr  s_pool 
)
virtual

Call to the heuristic.

Reimplemented from Minotaur::FeasibilityPump.

◆ writeStats()

void LinFeasPump::writeStats ( std::ostream &  out) const
virtual

Write statistics to the logger.

Reimplemented from Minotaur::FeasibilityPump.

Member Data Documentation

◆ objVar_

VariablePtr Minotaur::LinFeasPump::objVar_
protected

The objective variable added by linearization of objective. If the objective is linear, it is NULL.


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