Minotaur 0.4.1
Docs for developers
Public Member Functions | Protected Attributes | List of all members
Minotaur::LPRelaxation Class Reference
Inheritance diagram for Minotaur::LPRelaxation:
Inheritance graph
[legend]
Collaboration diagram for Minotaur::LPRelaxation:
Collaboration graph
[legend]

Public Member Functions

 LPRelaxation (EnvPtr env)
 
 LPRelaxation (ProblemPtr problem, EnvPtr env)
 
- Public Member Functions inherited from Minotaur::Relaxation
 Relaxation (EnvPtr env)
 Default constructor.
 
 Relaxation (ProblemPtr problem, EnvPtr env)
 
 ~Relaxation ()
 Destructor. No need yet. Use ~Problem().
 
VariablePtr getOriginalVar (VariablePtr r_var)
 
VariablePtr getRelaxationVar (VariablePtr p_var)
 
void setProblem (ProblemPtr p)
 
void setProblem (ConstProblemPtr p)
 
Relaxationclone (EnvPtr env)
 
- Public Member Functions inherited from Minotaur::Problem
 Problem (EnvPtr env)
 Default constructor.
 
virtual ~Problem ()
 Destroy.
 
virtual void addToCons (ConstraintPtr cons, double c)
 Add 'c' to both lb and ub of a constraint.
 
virtual void addToObj (LinearFunctionPtr lf)
 Add a linear function to the objective.
 
virtual void addToObj (double cb)
 Add a constant term to the objective.
 
virtual void calculateSize (bool shouldRedo=false)
 Fill up the statistics about the size of the problem into size_.
 
virtual void changeBoundByInd (UInt ind, BoundType lu, double new_val)
 Change a bound (lower or upper) on a variable with ID=id.
 
virtual void changeBoundByInd (UInt ind, double new_lb, double new_ub)
 Change both bounds (lower and upper) on a variable with ID=id.
 
virtual void changeBound (VariablePtr var, BoundType lu, double new_val)
 Change a bound (lower or upper) on a variable 'var'.
 
virtual void changeBound (VariablePtr var, double new_lb, double new_ub)
 Change lower and upper bounds on the variable 'var'.
 
virtual void changeBound (ConstraintPtr con, BoundType lu, double new_val)
 Change a bound (lower or upper) on a constraint 'con'.
 
virtual void changeBound (ConstraintPtr con, double new_lb, double new_ub)
 Change lower and upper bounds on the constraint 'con'.
 
virtual void changeConstraint (ConstraintPtr con, LinearFunctionPtr lf, double lb, double ub)
 Change the linear function, and the bounds of a constraint. More...
 
virtual void changeConstraint (ConstraintPtr con, NonlinearFunctionPtr nlf)
 Change the nonlinear function and bounds of a constraint. More...
 
virtual void changeObj (FunctionPtr f, double cb)
 Replace the objective function with a new function. More...
 
virtual int checkConVars () const
 Check whether variables used in the constraints belong to the problem or not. More...
 
virtual void classifyCon ()
 
ProblemPtr clone (EnvPtr env) const
 Clone the given Problem class. Jacobian and Hessian in the cloned problem are NULL. More...
 
ProblemPtr shuffle (bool varshuff, bool conshuff, EnvPtr env)
 shuffle variables and constraints while making a clone of the problem More...
 
void cg2qf ()
 Convert all quadratic forms that are stored as CGraph into QuadraticFunction. The order of constraints changes after this conversion.
 
virtual ConstraintConstIterator consBegin () const
 Iterate over constraints. Returns the 'begin' iterator.
 
virtual ConstraintConstIterator consEnd () const
 Iterate over constraints. Returns the 'end' iterator.
 
virtual void delMarkedCons ()
 Delete marked constraints.
 
virtual void delMarkedVars (bool keep=false)
 
virtual ProblemType findType ()
 Return what type of problem it is. May result in re-calculation of the problem size.
 
virtual ConstraintPtr getConstraint (UInt index) const
 Return a pointer to the constraint with a given index.
 
virtual DoubleVector * getDebugSol () const
 Give a pointer to the debug solution. More...
 
virtual HessianOfLagPtr getHessian () const
 Return the hessian of the lagrangean. Could be NULL.
 
virtual JacobianPtr getJacobian () const
 Return the jacobian. Could be NULL.
 
virtual UInt getNumCons () const
 Return the number of constraints.
 
virtual UInt getNumDCons () const
 Return the number of constraints marked for deletion.
 
virtual UInt getNumDVars () const
 Return the number of variables marked for deletion.
 
virtual UInt getNumHessNnzs () const
 Return the number of non-zeros in the hessian of the lagrangean of the problem. More...
 
virtual UInt getNumJacNnzs () const
 Return the number of non zerors in the jacobian of the constraints.
 
UInt getNumLinCons ()
 Return the number of linear constraints in the problem.
 
UInt getNumSOS1 ()
 Return the number of SOS Type 1 constraints.
 
UInt getNumSOS2 ()
 Return the number of SOS Type 2 constraints.
 
virtual UInt getNumVars () const
 Return the number of variables.
 
virtual ObjectivePtr getObjective () const
 Return a pointer to the objective Function.
 
double getObjValue (const double *x, int *err) const
 Return the value of objective function at given point x.
 
ConstProblemSizePtr getSize () const
 Fill up the statistics about the size of the problem into size_.
 
double getSizeEstimate ()
 Calculate and return a measure of the size of the problem.
 
virtual VariablePtr getVariable (UInt index) const
 Return a pointer to the variable with a given index.
 
virtual bool hasNativeDer () const
 Return true if the derivative is available through Minotaur's own routines for storing nonlinear functions.
 
virtual bool isDebugSolFeas (double atol, double rtol)
 Returns true if the debug solution is cut off by the constraints of the problem.
 
virtual bool isLinear ()
 Returns true if the problem has only linear constraints and linear objectives.
 
virtual bool isMarkedDel (ConstConstraintPtr con)
 Return true if a constraint is marked deleted.
 
virtual bool isMarkedDel (ConstVariablePtr var)
 Return true if a constraint is marked deleted.
 
virtual bool isQP ()
 Returns true if the problem has (1) linear or quadratic objective, and (2) linear constraints only.
 
virtual bool isQuadratic ()
 Returns true if the problem has only linear or quadratic constraints and linear or quadratic objectives. Returns false if a problem is linear. Returns false if problem is nonlinear.
 
virtual void markDelete (ConstraintPtr con)
 Mark a constraint for deleting. More...
 
bool checkQuadCond (const ConstraintStats &stats)
 
bool checkCoeffCond (const ConstraintStats &stats, bool positive)
 
virtual void markDelete (VariablePtr var)
 Mark a variable as deleted. More...
 
virtual void negateObj ()
 The objective is multiplied by -1.
 
virtual VariablePtr newBinaryVariable ()
 Add a new binary variable and return a pointer to it. A name is automatically generated by default.
 
virtual VariablePtr newBinaryVariable (std::string name)
 Add a new binary variable. More...
 
virtual ConstraintPtr newConstraint (FunctionPtr f, double lb, double ub)
 Add a new constraint and return a pointer to it. A name is automatically generated by default. More...
 
virtual ConstraintPtr newConstraint (FunctionPtr f, double lb, double ub, std::string name)
 Add a new constraint and return a pointer to it. More...
 
virtual ObjectivePtr newObjective (FunctionPtr f, double cb, ObjectiveType otyp)
 Add a new objective. A name is automatically generated by default. More...
 
virtual ObjectivePtr newObjective (double cb, ObjectiveType otyp)
 
virtual ObjectivePtr newObjective (FunctionPtr f, double cb, ObjectiveType otyp, std::string name)
 Add a new objective. More...
 
virtual SOSPtr newSOS (int n, SOSType type, const double *weights, const VarVector &vars, int priority, std::string name)
 Add a new SOS constraint with a name. More...
 
virtual SOSPtr newSOS (int n, SOSType type, const double *weights, const VarVector &vars, int priority)
 Add a new SOS constraint (name generated automatically). More...
 
virtual VariablePtr newVariable (VarSrcType stype=VarOrig)
 Add a new continuous, unbounded variable to the Problem. More...
 
virtual VariablePtr newVariable (double lb, double ub, VariableType vtype, VarSrcType=VarOrig)
 Add a new variable with bounds, type. A name is automatically generated by default. More...
 
virtual VariablePtr newVariable (double lb, double ub, VariableType vtype, std::string name, VarSrcType=VarOrig)
 Add a new variable. More...
 
virtual void newVariables (VariableConstIterator v_begin, VariableConstIterator v_end, VarSrcType stype=VarOrig)
 Clone the variables pointed by the iterators and add them. More...
 
virtual void prepareForSolve ()
 Setup problem data-structures for solving it. More...
 
virtual void objToCons ()
 
virtual void removeObjective ()
 Remove objective from the Problem.
 
virtual QuadraticFunctionPtr removeQuadFromObj ()
 Remove the quadratic part of objective and return it.
 
virtual NonlinearFunctionPtr removeNonlinFromObj ()
 
virtual void resetDer ()
 
virtual void resConTypCnt ()
 
virtual void reverseSense (ConstraintPtr cons)
 Reverse the sense of a constraint. More...
 
virtual void setDebugSol (const DoubleVector &x)
 Set a solution that can be checked for accidental cutting off by cuts, branching, reformulations etc. More...
 
virtual void setEngine (Engine *engine)
 Set the engine that is used to solve this problem. More...
 
virtual void setHessian (HessianOfLagPtr hessian)
 Add a pointer to the hessian of the Lagrangean. More...
 
virtual void setInitialPoint (const double *x)
 Set an initial point. More...
 
virtual void setInitialPoint (const double *x, size_t k)
 Set an initial point. More...
 
virtual void setInitVal (VariablePtr v, double val)
 
virtual void setInitValByInd (UInt ind, double val)
 
virtual void setJacobian (JacobianPtr jacobian)
 Set the jacobian of the constraints. More...
 
void setNativeDer ()
 Ask Problem to construct its own jacobian and hessian using Minotaur's native code for nonlinear functions.
 
virtual void setVarType (VariablePtr var, VariableType type)
 Change the variable type. More...
 
virtual SOSConstIterator sos1Begin () const
 
virtual SOSConstIterator sos1End () const
 
virtual SOSConstIterator sos2Begin () const
 
virtual SOSConstIterator sos2End () const
 
virtual void subst (VariablePtr out, VariablePtr in, double rat=1.0)
 Substitute a variable 'out' with the variable 'in' through out the problem. More...
 
virtual void unsetEngine ()
 Should be called in the Engine's destructor.
 
virtual VariableConstIterator varsBegin () const
 Iterate over variables.
 
virtual VariableConstIterator varsEnd () const
 Iterate over variables.
 
virtual void write (std::ostream &out, std::streamsize out_p=6) const
 only for debugging, developing etc.
 
virtual void writeSize (std::ostream &out) const
 Write the problem size to logger_.
 
void statistics (std::ostream &out) const
 

Protected Attributes

ConstProblemPtr originalProblem_
 
- Protected Attributes inherited from Minotaur::Relaxation
ConstProblemPtr p_
 Pointer to the original problem.
 
- Protected Attributes inherited from Minotaur::Problem
ConstraintVector cons_
 Vector of constraints.
 
bool consModed_
 Flag that is turned on if the constraints are added or modified. More...
 
DoubleVector * debugSol_
 A solution to be used for debugging against accidentally cutting of feasible points.
 
Engineengine_
 Engine that must be updated if problem is loaded to it, could be null.
 
HessianOfLagPtr hessian_
 Pointer to the hessian of the lagrangean. Could be NULL.
 
JacobianPtr jacobian_
 Pointer to the jacobian of constraints. Can be NULL.
 
LoggerPtr logger_
 Pointer to the log manager. All output messages are sent to it.
 
bool nativeDer_
 If true, set up our own Hessian and Jacobian.
 
UInt nextCId_
 ID of the next constraint.
 
int nextSId_
 ID of the next SOS constraint.
 
UInt nextVId_
 ID of the next variable.
 
UInt numDCons_
 Number of constraints marked for deletion.
 
UInt numDVars_
 Number of variables marked for deletion.
 
ObjectivePtr obj_
 Objective, could be NULL.
 
ProblemSizePtr size_
 Size statistics for this Problem.
 
SOSVector sos1_
 SOS1 constraints.
 
SOSVector sos2_
 SOS2 constraints.
 
VarVector vars_
 Vector of variables.
 
VarVector varsRem_
 Vector of variables removed from the problem but not yet freed from memory.
 
bool varsModed_
 True if variables delete, added or their bounds changed.
 

Additional Inherited Members

- Public Attributes inherited from Minotaur::Problem
const double INFTY = std::numeric_limits<double>::infinity()
 
- Protected Member Functions inherited from Minotaur::Problem
bool isAggregation_ (ConstraintPtr c)
 
bool isPrecedence_ (ConstraintPtr c, const ConstraintStats &stats)
 
bool isVariableBound_ (ConstraintPtr c, const ConstraintStats &stats)
 
bool isSetPartitioning_ (ConstraintPtr c, const ConstraintStats &stats)
 
bool isSetPacking_ (ConstraintPtr c, const ConstraintStats &stats)
 
bool isSetCovering_ (ConstraintPtr c, const ConstraintStats &stats)
 
bool isCardinality_ (ConstraintPtr c, const ConstraintStats &stats)
 
bool isInvariantKnapsack_ (ConstraintPtr c, const ConstraintStats &stats)
 
bool isEquationKnapsack_ (ConstraintPtr c, const ConstraintStats &stats)
 
bool isBinPacking_ (ConstraintPtr c, const ConstraintStats &stats)
 
bool isKnapsack_ (ConstraintPtr c, const ConstraintStats &stats)
 
bool isIntegerKnapsack_ (ConstraintPtr c, const ConstraintStats &stats)
 
bool isMixedBinary_ (ConstraintPtr c, const ConstraintStats &stats)
 
bool isNoSpecificStructure_ (ConstraintPtr c)
 
bool isDiagonalQuadratic_ (ConstraintPtr c, const ConstraintStats &stats)
 
bool isSimpleBall_ (ConstraintPtr c, const ConstraintStats &stats)
 
bool isEllipsoid_ (ConstraintPtr c, const ConstraintStats &stats)
 
bool isComplementEllipsoid_ (ConstraintPtr c, const ConstraintStats &stats)
 
bool isComplementSimpleBall_ (ConstraintPtr c, const ConstraintStats &stats)
 
bool isSocSimple_ (ConstraintPtr c, const ConstraintStats &stats)
 
bool isPureBilinear_ (ConstraintPtr c, const ConstraintStats &stats)
 
bool isOtherQuadType_ (ConstraintPtr c, const ConstraintStats &stats)
 
void printConstraintStatistics_ ()
 
void printConstraintStatisticsQuad_ ()
 
void lockNum_ ()
 
virtual void countConsTypes_ ()
 Count the types of constraints and fill the values in size_.
 
virtual void countObjTypes_ ()
 Count the types of objectives and fill the values in size_.
 
virtual void countVarTypes_ ()
 Fill up the size_ with number of variables of each type.
 
virtual void findVarFunTypes_ ()
 Update the function types of all variables based on whether they appear as linear, quadratic or nonlinear in each objective and constraint.
 
bool isPolyp_ ()
 
void setIndex_ (VariablePtr v, UInt i)
 
- Static Protected Attributes inherited from Minotaur::Problem
static const std::string me_ = "Problem: "
 For logging.
 

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