MAiNGO
maingo::ubp Namespace Reference

namespace holding all essentials of the upper bounding solvers More...

Classes

struct  DagObj
 Struct for storing all needed Directed acyclic Graph objects for the upper bounding solver. More...
 
class  IpoptProblem
 Class for representing problems to be solved by IpOpt, providing an interface to the problem definition in problem.h used by MC++. More...
 
class  KnitroProblem
 Class for representing problems to be solved by Knitro, providing an interface to the problem definition in problem.h. More...
 
class  UbpClp
 Wrapper for handling the upper bounding problems by interfacing CLP. More...
 
class  UbpCplex
 Wrapper for handling the upper bounding problems by interfacing CPLEX. More...
 
class  UbpIpopt
 Wrapper for handling the upper bounding problems by interfacing Ipopt. More...
 
class  UbpKnitro
 Wrapper for handling the upper bounding problems by interfacing Knitro. More...
 
class  UbpNLopt
 Wrapper for handling the upper bounding problems by interfacing NLopt. More...
 
struct  UbpQuadExpr
 Struct used to compute coefficients of linear and quadratic/bilinear terms in (MIQ)Ps. This struct is used to avoid the need of propagating the IloExpr object resulting in HUGE RAM usage. More...
 
struct  UbpStructure
 Struct for storing structure information for the upper bounding solver. More...
 
class  UpperBoundingSolver
 Base class for wrappers for handling the upper bounding problems. More...
 

Enumerations

enum  UBP_SOLVER {
  SOLVER_EVAL = 0, SOLVER_COBYLA, SOLVER_BOBYQA, SOLVER_LBFGS,
  SOLVER_SLSQP, SOLVER_IPOPT, SOLVER_KNITRO, SOLVER_CPLEX = 42,
  SOLVER_CLP
}
 Enum for selecting the STRATegy so be used for solving the upper bounding problems. More...
 

Functions

std::shared_ptr< UpperBoundingSolvermake_ubp_solver (mc::FFGraph &DAG, const std::vector< mc::FFVar > &DAGvars, const std::vector< mc::FFVar > &DAGfunctions, const std::vector< babBase::OptimizationVariable > &variables, const unsigned nineqIn, const unsigned neqIn, const unsigned nineqSquashIn, Settings *settingsIn, Logger *loggerIn, std::vector< Constraint > *constraintPropertiesIn, UpperBoundingSolver::UBS_USE useIn)
 Factory function for initializing different upper bounding solver wrappers. More...
 
double evaluate_objective (const double *currentPoint, const unsigned nvar, const bool computeGradient, double *gradient, std::shared_ptr< DagObj > dagObj)
 Function for evaluating objective function at a given point. More...
 
void evaluate_inequalities (const double *currentPoint, const unsigned nvar, const unsigned nineq, const bool computeGradient, double *result, double *gradient, std::shared_ptr< DagObj > dagObj)
 Function for evaluating residuals of inequality constraints at a given point. More...
 
void evaluate_equalities (const double *currentPoint, const unsigned nvar, const unsigned neq, const bool computeGradient, double *result, double *gradient, std::shared_ptr< DagObj > dagObj)
 Function for evaluating residuals of equality constraints at a given point. More...
 
void evaluate_constraints (const double *currentPoint, const unsigned nvar, const unsigned ncon, const bool computeGradient, double *result, double *gradient, std::shared_ptr< DagObj > dagObj)
 Function for evaluating residuals of inequality and equality constraints at a given point. More...
 
void evaluate_problem (const double *currentPoint, const unsigned nvar, const unsigned ncon, const bool computeGradient, double *result, double *gradient, std::shared_ptr< DagObj > dagObj)
 Function for evaluating the objective function along with the residuals of inequality and equality constraints at a given point. More...
 
void evaluate_hessian (const double *currentPoint, const unsigned nvar, const unsigned ncon, double *hessian, std::shared_ptr< DagObj > dagObj)
 Function for evaluating the Hessian of the Lagrangian at a given point. More...
 
std::vector< double > operator- (const std::vector< double > &in)
 Operator- for a double vector. More...
 
std::vector< std::vector< double > > operator- (const std::vector< std::vector< double >> &in)
 Operator- for a double matrix. More...
 
std::vector< double > operator+ (const std::vector< double > &in1, const std::vector< double > &in2)
 Operator+ for addition of two double vectors. More...
 
std::vector< std::vector< double > > operator+ (const std::vector< std::vector< double >> &in1, const std::vector< std::vector< double >> &in2)
 Operator+ for addition of two double matrices. More...
 
std::vector< double > operator- (const std::vector< double > &in1, const std::vector< double > &in2)
 Operator- for subtraction of two double vectors. More...
 
std::vector< std::vector< double > > operator- (const std::vector< std::vector< double >> &in1, const std::vector< std::vector< double >> &in2)
 Operator- for subtraction of two double matrices. More...
 
std::vector< double > operator * (const std::vector< double > &in1, const double in2)
 Operator* for multiplication of a double vector with a double constant. More...
 
std::vector< std::vector< double > > operator * (const std::vector< std::vector< double >> &in1, const double in2)
 Operator* for multiplication of a double matrix with a double constant. More...
 
UbpQuadExpr operator+ (const UbpQuadExpr &in)
 Operator+ for UbpQuadExpr. More...
 
UbpQuadExpr operator+ (const UbpQuadExpr &in1, const UbpQuadExpr &in2)
 Operator+ for two UbpQuadExpr objects. More...
 
UbpQuadExpr operator+ (const UbpQuadExpr &in1, const double &in2)
 Operator+ for addition of an UbpQuadExpr and a double. More...
 
UbpQuadExpr operator+ (const UbpQuadExpr &in1, const int &in2)
 Operator+ for addition of an UbpQuadExpr and an int. More...
 
UbpQuadExpr operator+ (const double &in1, const UbpQuadExpr &in2)
 Operator+ for addition of an UbpQuadExpr and a double. More...
 
UbpQuadExpr operator+ (const int &in1, const UbpQuadExpr &in2)
 Operator+ for addition of an UbpQuadExpr and an int. More...
 
UbpQuadExpr operator- (const UbpQuadExpr &in)
 Operator- for UbpQuadExpr. More...
 
UbpQuadExpr operator- (const UbpQuadExpr &in1, const UbpQuadExpr &in2)
 Operator- for two UbpQuadExpr objects. More...
 
UbpQuadExpr operator- (const UbpQuadExpr &in1, const double &in2)
 Operator- for subtraction of an UbpQuadExpr and a double. More...
 
UbpQuadExpr operator- (const UbpQuadExpr &in1, const int &in2)
 Operator- for subtraction of an UbpQuadExpr and an int. More...
 
UbpQuadExpr operator- (const double &in1, const UbpQuadExpr &in2)
 Operator- for subtraction of an UbpQuadExpr and a double. More...
 
UbpQuadExpr operator- (const int &in1, const UbpQuadExpr &in2)
 Operator- for subtraction of an UbpQuadExpr and an int. More...
 
UbpQuadExpr operator * (const UbpQuadExpr &in1, const UbpQuadExpr &in2)
 Operator* for two UbpQuadExpr objects. More...
 
UbpQuadExpr operator * (const UbpQuadExpr &in1, const double in2)
 Operator* for multiplication of an UbpQuadExpr and a double. More...
 
UbpQuadExpr operator * (const UbpQuadExpr &in1, const int in2)
 Operator* for subtraction of an UbpQuadExpr and an int. More...
 
UbpQuadExpr operator * (const double in1, const UbpQuadExpr &in2)
 Operator* for multiplication of an UbpQuadExpr and a double. More...
 
UbpQuadExpr operator * (const int in1, const UbpQuadExpr &in2)
 Operator* for subtraction of an UbpQuadExpr and an int. More...
 
UbpQuadExpr operator/ (const UbpQuadExpr &in1, const UbpQuadExpr &in2)
 Operator/ for two UbpQuadExpr. More...
 
UbpQuadExpr operator/ (const UbpQuadExpr &in1, const double in2)
 Operator/ for division of an UbpQuadExpr by a double. More...
 
UbpQuadExpr operator/ (const UbpQuadExpr &in1, const int in2)
 Operator/ for division of an UbpQuadExpr by a double. More...
 
UbpQuadExpr operator/ (const double in1, const UbpQuadExpr &in2)
 Operator/ for division of a double by an UbpQuadExpr. More...
 
UbpQuadExpr operator/ (const int in1, const UbpQuadExpr &in2)
 Operator/ for division of an int by an UbpQuadExpr. More...
 

Detailed Description

namespace holding all essentials of the upper bounding solvers

Enumeration Type Documentation

◆ UBP_SOLVER

Enum for selecting the STRATegy so be used for solving the upper bounding problems.

Enumerator
SOLVER_EVAL 

(=0): no optimization, simple function evaluation at solution point of LBP

SOLVER_COBYLA 

(=1): local optimization using COBYLA (derivative free solver within NLopt, uses linear approximations via simplex of nvar+1 points)

SOLVER_BOBYQA 

(=2): local optimization using BOBYQA (derivative free unconstrained solver in NLopt, constructs quadratic approximations; constraints are moved to the objective via augmented Lagrangian method)

SOLVER_LBFGS 

(=3): local optimization using LBFGS (lower-storage BFGS algorithm (i.e., gradient-based) for unconstrained optimization within NLopt; constraints are moved to the objective via augmented Lagrangian method)

SOLVER_SLSQP 

(=4): local optimization using SLSQP (SQP solver within NLopt)

SOLVER_IPOPT 

(=5): local optimization using Ipopt (using the exact Hessian for problems with at most 50 variables, else using L-BFGS)

SOLVER_KNITRO 

(=6): local optimization using Knitro (using the exact Hessian)

SOLVER_CPLEX 

(=42): optimization using CPLEX. Called only for (MI)LPs and (MI)QCPs.

SOLVER_CLP 

(=43): optimization using CLP. Called only for LPs.

Function Documentation

◆ evaluate_constraints()

void maingo::ubp::evaluate_constraints ( const double *  currentPoint,
const unsigned  nvar,
const unsigned  ncon,
const bool  computeGradient,
double *  result,
double *  gradient,
std::shared_ptr< DagObj dagObj 
)

Function for evaluating residuals of inequality and equality constraints at a given point.

Parameters
[in]currentPointis the point to be checked
[in]nvaris the number of variables
[in]nconis the number of constraints
[in]computeGradientis a flag indicating whether the gradient of the equality constraints should be computed as well
[out]resultis an array containing the residuals of the constraints at currentPoint
[out]gradientis a vector containing the gradients of the constraints at currentPoint
[in]dagObjis a pointer to the struct holding the DAG to be evaluated

◆ evaluate_equalities()

void maingo::ubp::evaluate_equalities ( const double *  currentPoint,
const unsigned  nvar,
const unsigned  neq,
const bool  computeGradient,
double *  result,
double *  gradient,
std::shared_ptr< DagObj dagObj 
)

Function for evaluating residuals of equality constraints at a given point.

Parameters
[in]currentPointis the point to be checked
[in]nvaris the number of variables
[in]neqis the number of equality constraints
[in]computeGradientis a flag indicating whether the gradient of the equality constraints should be computed as well
[out]resultis an array containing the residuals of the inequality constraints at currentPoint
[out]gradientis a vector containing the gradients of the equality constraints at currentPoint
[in]dagObjis a pointer to the struct holding the DAG to be evaluated

◆ evaluate_hessian()

void maingo::ubp::evaluate_hessian ( const double *  currentPoint,
const unsigned  nvar,
const unsigned  ncon,
double *  hessian,
std::shared_ptr< DagObj dagObj 
)

Function for evaluating the Hessian of the Lagrangian at a given point.

Parameters
[in]currentPointis the point to be checked
[in]nvaris the number of variables
[in]nconis the number of constraints
[out]hessianis an array containing the Hessian of the Lagrangian at currentPoint
[in]dagObjis a pointer to the struct holding the DAG to be evaluated

◆ evaluate_inequalities()

void maingo::ubp::evaluate_inequalities ( const double *  currentPoint,
const unsigned  nvar,
const unsigned  nineq,
const bool  computeGradient,
double *  result,
double *  gradient,
std::shared_ptr< DagObj dagObj 
)

Function for evaluating residuals of inequality constraints at a given point.

Parameters
[in]currentPointis the point to be checked
[in]nvaris the number of variables
[in]nineqis the number of inequality constraints
[in]computeGradientis a flag indicating whether the gradient of the inequality constraints should be computed as well
[out]resultis an array containing the residuals of the inequality constraints at currentPoint
[out]gradientis an array containing the gradients of the inequality constraints at currentPoint
[in]dagObjis a pointer to the struct holding the DAG to be evaluated

◆ evaluate_objective()

double maingo::ubp::evaluate_objective ( const double *  currentPoint,
const unsigned  nvar,
const bool  computeGradient,
double *  gradient,
std::shared_ptr< DagObj dagObj 
)

Function for evaluating objective function at a given point.

Parameters
[in]currentPointis the point to be checked
[in]nvaris the number of variables
[in]computeGradientis a flag indicating whether the gradient of the objective function should be computed as well
[out]gradientis the gradient of the objective function at currentPoint
[in]dagObjis a pointer to the struct holding the DAG to be evaluated
Returns
Objective function value at currentPoint

◆ evaluate_problem()

void maingo::ubp::evaluate_problem ( const double *  currentPoint,
const unsigned  nvar,
const unsigned  ncon,
const bool  computeGradient,
double *  result,
double *  gradient,
std::shared_ptr< DagObj dagObj 
)

Function for evaluating the objective function along with the residuals of inequality and equality constraints at a given point.

Parameters
[in]currentPointis the point to be checked
[in]nvaris the number of variables
[in]nconis the number of constraints
[in]computeGradientis a flag indicating whether the gradient of the equality constraints should be computed as well
[out]resultis an array containing the objective function and the residuals of the constraints at currentPoint
[out]gradientis a vector containing the gradients of the objective function and the constraints at currentPoint
[in]dagObjis a pointer to the struct holding the DAG to be evaluated

◆ make_ubp_solver()

std::shared_ptr< UpperBoundingSolver > maingo::ubp::make_ubp_solver ( mc::FFGraph &  DAG,
const std::vector< mc::FFVar > &  DAGvars,
const std::vector< mc::FFVar > &  DAGfunctions,
const std::vector< babBase::OptimizationVariable > &  variables,
const unsigned  nineqIn,
const unsigned  neqIn,
const unsigned  nineqSquashIn,
Settings settingsIn,
Logger loggerIn,
std::vector< Constraint > *  constraintPropertiesIn,
UpperBoundingSolver::UBS_USE  useIn 
)

Factory function for initializing different upper bounding solver wrappers.

Parameters
[in]DAGis the directed acyclic graph constructed in MAiNGO.cpp needed to construct an own DAG for the lower bounding solver
[in]DAGvarsare the variables corresponding to the DAG
[in]DAGfunctionsare the functions corresponding to the DAG
[in]variablesis a vector containing the initial optimization variables defined in problem.h
[in]nineqInis the number of inequality constraints
[in]neqInis the number of equality
[in]nineqSquashInis the number of squash inequality constraints which are to be used only if the squash node has been used
[in]settingsInis a pointer to the MAiNGO settings
[in]loggerInis a pointer to the MAiNGO logger object
[in]constraintPropertiesInis a pointer to the constraint properties determined by MAiNGO
[in]useIncommunicates what the solver is to be used for

◆ operator *() [1/7]

std::vector<double> maingo::ubp::operator * ( const std::vector< double > &  in1,
const double  in2 
)
inline

Operator* for multiplication of a double vector with a double constant.

◆ operator *() [2/7]

std::vector<std::vector<double> > maingo::ubp::operator * ( const std::vector< std::vector< double >> &  in1,
const double  in2 
)
inline

Operator* for multiplication of a double matrix with a double constant.

◆ operator *() [3/7]

UbpQuadExpr maingo::ubp::operator * ( const UbpQuadExpr in1,
const UbpQuadExpr in2 
)
inline

Operator* for two UbpQuadExpr objects.

◆ operator *() [4/7]

UbpQuadExpr maingo::ubp::operator * ( const UbpQuadExpr in1,
const double  in2 
)
inline

Operator* for multiplication of an UbpQuadExpr and a double.

◆ operator *() [5/7]

UbpQuadExpr maingo::ubp::operator * ( const UbpQuadExpr in1,
const int  in2 
)
inline

Operator* for subtraction of an UbpQuadExpr and an int.

◆ operator *() [6/7]

UbpQuadExpr maingo::ubp::operator * ( const double  in1,
const UbpQuadExpr in2 
)
inline

Operator* for multiplication of an UbpQuadExpr and a double.

◆ operator *() [7/7]

UbpQuadExpr maingo::ubp::operator * ( const int  in1,
const UbpQuadExpr in2 
)
inline

Operator* for subtraction of an UbpQuadExpr and an int.

◆ operator+() [1/8]

std::vector<double> maingo::ubp::operator+ ( const std::vector< double > &  in1,
const std::vector< double > &  in2 
)
inline

Operator+ for addition of two double vectors.

◆ operator+() [2/8]

std::vector<std::vector<double> > maingo::ubp::operator+ ( const std::vector< std::vector< double >> &  in1,
const std::vector< std::vector< double >> &  in2 
)
inline

Operator+ for addition of two double matrices.

◆ operator+() [3/8]

UbpQuadExpr maingo::ubp::operator+ ( const UbpQuadExpr in)
inline

Operator+ for UbpQuadExpr.

◆ operator+() [4/8]

UbpQuadExpr maingo::ubp::operator+ ( const UbpQuadExpr in1,
const UbpQuadExpr in2 
)
inline

Operator+ for two UbpQuadExpr objects.

◆ operator+() [5/8]

UbpQuadExpr maingo::ubp::operator+ ( const UbpQuadExpr in1,
const double &  in2 
)
inline

Operator+ for addition of an UbpQuadExpr and a double.

◆ operator+() [6/8]

UbpQuadExpr maingo::ubp::operator+ ( const UbpQuadExpr in1,
const int &  in2 
)
inline

Operator+ for addition of an UbpQuadExpr and an int.

◆ operator+() [7/8]

UbpQuadExpr maingo::ubp::operator+ ( const double &  in1,
const UbpQuadExpr in2 
)
inline

Operator+ for addition of an UbpQuadExpr and a double.

◆ operator+() [8/8]

UbpQuadExpr maingo::ubp::operator+ ( const int &  in1,
const UbpQuadExpr in2 
)
inline

Operator+ for addition of an UbpQuadExpr and an int.

◆ operator-() [1/10]

std::vector<double> maingo::ubp::operator- ( const std::vector< double > &  in)
inline

Operator- for a double vector.

◆ operator-() [2/10]

std::vector<std::vector<double> > maingo::ubp::operator- ( const std::vector< std::vector< double >> &  in)
inline

Operator- for a double matrix.

◆ operator-() [3/10]

std::vector<double> maingo::ubp::operator- ( const std::vector< double > &  in1,
const std::vector< double > &  in2 
)
inline

Operator- for subtraction of two double vectors.

◆ operator-() [4/10]

std::vector<std::vector<double> > maingo::ubp::operator- ( const std::vector< std::vector< double >> &  in1,
const std::vector< std::vector< double >> &  in2 
)
inline

Operator- for subtraction of two double matrices.

◆ operator-() [5/10]

UbpQuadExpr maingo::ubp::operator- ( const UbpQuadExpr in)
inline

Operator- for UbpQuadExpr.

◆ operator-() [6/10]

UbpQuadExpr maingo::ubp::operator- ( const UbpQuadExpr in1,
const UbpQuadExpr in2 
)
inline

Operator- for two UbpQuadExpr objects.

◆ operator-() [7/10]

UbpQuadExpr maingo::ubp::operator- ( const UbpQuadExpr in1,
const double &  in2 
)
inline

Operator- for subtraction of an UbpQuadExpr and a double.

◆ operator-() [8/10]

UbpQuadExpr maingo::ubp::operator- ( const UbpQuadExpr in1,
const int &  in2 
)
inline

Operator- for subtraction of an UbpQuadExpr and an int.

◆ operator-() [9/10]

UbpQuadExpr maingo::ubp::operator- ( const double &  in1,
const UbpQuadExpr in2 
)
inline

Operator- for subtraction of an UbpQuadExpr and a double.

◆ operator-() [10/10]

UbpQuadExpr maingo::ubp::operator- ( const int &  in1,
const UbpQuadExpr in2 
)
inline

Operator- for subtraction of an UbpQuadExpr and an int.

◆ operator/() [1/5]

UbpQuadExpr maingo::ubp::operator/ ( const UbpQuadExpr in1,
const UbpQuadExpr in2 
)
inline

Operator/ for two UbpQuadExpr.

◆ operator/() [2/5]

UbpQuadExpr maingo::ubp::operator/ ( const UbpQuadExpr in1,
const double  in2 
)
inline

Operator/ for division of an UbpQuadExpr by a double.

◆ operator/() [3/5]

UbpQuadExpr maingo::ubp::operator/ ( const UbpQuadExpr in1,
const int  in2 
)
inline

Operator/ for division of an UbpQuadExpr by a double.

◆ operator/() [4/5]

UbpQuadExpr maingo::ubp::operator/ ( const double  in1,
const UbpQuadExpr in2 
)
inline

Operator/ for division of a double by an UbpQuadExpr.

◆ operator/() [5/5]

UbpQuadExpr maingo::ubp::operator/ ( const int  in1,
const UbpQuadExpr in2 
)
inline

Operator/ for division of an int by an UbpQuadExpr.