# Couenne::CouenneIterativeRounding Class Reference

An iterative rounding heuristic, tailored for nonconvex MINLPs. More...

`#include <CouenneIterativeRounding.hpp>`

List of all members.

## Public Member Functions
| CouenneIterativeRounding ()
| Default constructor.
| CouenneIterativeRounding (Bonmin::OsiTMINLPInterface *nlp, OsiSolverInterface *cinlp, CouenneProblem *couenne, Ipopt::SmartPtr< Ipopt::OptionsList > options)
| Constructor with model and Couenne problems.
| CouenneIterativeRounding (const CouenneIterativeRounding &other)
| Copy constructor.
virtual | ~CouenneIterativeRounding ()
| Destructor.
virtual CbcHeuristic * | clone () const
| Clone.
CouenneIterativeRounding & | operator= (const CouenneIterativeRounding &rhs)
| Assignment operator.
void | setNlp (Bonmin::OsiTMINLPInterface *nlp, OsiSolverInterface *cinlp)
| Set the minlp solver.
void | setCouenneProblem (CouenneProblem *couenne)
| Set the couenne problem to use.
void | resetModel (CbcModel *model)
| Does nothing.
int | solution (double &objectiveValue, double *newSolution)
| Run heuristic, return 1 if a better solution than the one passed is found and 0 otherwise.
void | setMaxRoundingIter (int value)
| Set maximum number of iterations for each rounding phase.
void | setMaxFirPoints (int value)
| Set maximum number of points that we try to round in F-IR.
void | setMaxTime (double value)
| Set maximum CPU time for the heuristic at each node.
void | setMaxTimeFirstCall (double value)
| Set maximum CPU time for the heuristic at the root node only.
void | setOmega (double value)
| Set the value for omega, the multiplicative factor for the minimum log-barrier parameter mu used by F-IR whenever we need to generate a new NLP feasible point (in the interior of the feasible region).
void | setBaseLbRhs (int value)
| Set the base value for the rhs of the local branching constraint in the I-IR heuristic.
void | setAggressiveness (int value)
| Set aggressiveness of heuristic.
## Static Public Member Functions
static void | registerOptions (Ipopt::SmartPtr< Bonmin::RegisteredOptions >)
| initialize options to be read later
## Private Member Functions
bool | areEqual (double a, double b)
| Check if two double precision numbers are equal, up to some tolerance.
int | feasibilityIR (double &objectiveValue, double *newSolution)
int | improvementIR (double &objectiveValue, double *newSolution, const double *startingSolution)
void | setMilp ()
| Set the milp solver at the root.
int | computeIntAtBound (const double *x)
| Compute number of integer variables at one of their bounds at a given point x.
int | computeIntAtBound (const double *x, double &avgBoundSize)
| Compute number of integer variables at one of their bounds at a given point x and average distance between the bounds of variables at one of their bounds.
void | writeLB (OsiRowCut &cut, const double *x, char sense, double rhs)
| Write down a local branching constraint, as an OsiRowCut.
int | branchToCut (const double *x, OsiSolverInterface *solver, std::vector< int > &previousBranches)
| Branch on a random variable to cut given solution; returns var index.
bool | solveMilp (OsiSolverInterface *milp, double maxTime)
| Solve the MILP contained in milp to feasibility, or report failure.
## Private Attributes
Bonmin::OsiTMINLPInterface * | nlp_
| Pointer to a dynamic nlp solver interface.
OsiSolverInterface * | cinlp_
| Pointer to the original NLP solver interface.
OsiClpSolverInterface * | milp_
| Pointer to a milp solver interface.
int | maxRoundingIter_
| Maximum number of iterations in the main loop.
int | maxFirPoints_
| Maximum number of iterations in the outer loop for feasibility.
double | maxTime_
| Max CPU time to run the heuristic.
double | maxTimeFirstCall_
| Max CPU time to run the heuristic when no other solution is known.
int | numInitialRows_
| Number of rows in the original convexification.
int | numSol_
| Number of solutions last time the heuristic was called.
int | numIntegers_
| Number of integer variables in the original model.
double * | colLower_
| Pointer to original column lower and upper bounds of the reformulated problem, i.e.
double * | colUpper_
double * | colLowerNlp_
| Pointer to column lower and upper bounds of the original problem, i.e.
double * | colUpperNlp_
CbcHeuristic ** | heuristics_
| Heuristics for the MILP.
int | numHeuristics_
double | startTime_
| Starting time for the heuristics.
double | endTime_
| Maximum allowed time for current run.
double | omega_
| Multiplication factor for log barrier parameter in F-IR; see in the paper.
int | baseLbRhs_
| Base value for the rhs of the local branching constraint it I-IR.
CouenneProblem * | couenne_
| Pointer to a couenne representation of the problem.

## Detailed Description

An iterative rounding heuristic, tailored for nonconvex MINLPs.

It solves a sequence of MILPs and NLPs for a given number of iterations, or until a better solution is found.

Definition at line 36 of file CouenneIterativeRounding.hpp.

## Constructor & Destructor Documentation

Couenne::CouenneIterativeRounding::CouenneIterativeRounding | ( |  | ) |

Default constructor.

Couenne::CouenneIterativeRounding::CouenneIterativeRounding | ( | Bonmin::OsiTMINLPInterface * | nlp,
|  | OsiSolverInterface * | cinlp,
|  | CouenneProblem * | couenne,
|  | Ipopt::SmartPtr< Ipopt::OptionsList > | options |
| ) |  |  |

Constructor with model and Couenne problems.

Couenne::CouenneIterativeRounding::CouenneIterativeRounding | ( | const CouenneIterativeRounding & | other | ) |

Copy constructor.

virtual Couenne::CouenneIterativeRounding::~CouenneIterativeRounding | ( |  | ) | `[virtual]`

Destructor.

## Member Function Documentation

virtual CbcHeuristic* Couenne::CouenneIterativeRounding::clone | ( |  | ) | const`[virtual]`

Clone.

CouenneIterativeRounding& Couenne::CouenneIterativeRounding::operator= | ( | const CouenneIterativeRounding & | rhs | ) |

Assignment operator.

void Couenne::CouenneIterativeRounding::setNlp | ( | Bonmin::OsiTMINLPInterface * | nlp,
|  | OsiSolverInterface * | cinlp |
| ) |  |  |

Set the minlp solver.

void Couenne::CouenneIterativeRounding::setCouenneProblem | ( | CouenneProblem * | couenne | ) | `[inline]`

Set the couenne problem to use.

Definition at line 62 of file CouenneIterativeRounding.hpp.

References couenne_.

void Couenne::CouenneIterativeRounding::resetModel | ( | CbcModel * | model | ) | `[inline]`

Does nothing.

Definition at line 67 of file CouenneIterativeRounding.hpp.

int Couenne::CouenneIterativeRounding::solution | ( | double & | objectiveValue,
|  | double * | newSolution |
| ) |  |  |

Run heuristic, return 1 if a better solution than the one passed is found and 0 otherwise.

objectiveValue Best known solution in input and value of solution found in output newSolution Solution found by heuristic.

void Couenne::CouenneIterativeRounding::setMaxRoundingIter | ( | int | value | ) | `[inline]`

Set maximum number of iterations for each rounding phase.

Definition at line 79 of file CouenneIterativeRounding.hpp.

References maxRoundingIter_.

void Couenne::CouenneIterativeRounding::setMaxFirPoints | ( | int | value | ) | `[inline]`

Set maximum number of points that we try to round in F-IR.

Definition at line 84 of file CouenneIterativeRounding.hpp.

References maxFirPoints_.

void Couenne::CouenneIterativeRounding::setMaxTime | ( | double | value | ) | `[inline]`

Set maximum CPU time for the heuristic at each node.

Definition at line 89 of file CouenneIterativeRounding.hpp.

References maxTime_.

void Couenne::CouenneIterativeRounding::setMaxTimeFirstCall | ( | double | value | ) | `[inline]`

Set maximum CPU time for the heuristic at the root node only.

Definition at line 94 of file CouenneIterativeRounding.hpp.

References maxTimeFirstCall_.

void Couenne::CouenneIterativeRounding::setOmega | ( | double | value | ) | `[inline]`

Set the value for omega, the multiplicative factor for the minimum log-barrier parameter mu used by F-IR whenever we need to generate a new NLP feasible point (in the interior of the feasible region).

Definition at line 102 of file CouenneIterativeRounding.hpp.

References omega_.

void Couenne::CouenneIterativeRounding::setBaseLbRhs | ( | int | value | ) | `[inline]`

Set the base value for the rhs of the local branching constraint in the I-IR heuristic.

The actual rhs is then computed depending on current variable bounds

Definition at line 109 of file CouenneIterativeRounding.hpp.

References baseLbRhs_.

void Couenne::CouenneIterativeRounding::setAggressiveness | ( | int | value | ) |

Set aggressiveness of heuristic.

Three levels, that sets various parameters accordingly.

The levels are: 0: maxRoundingIter = 5, maxTimeFirstCall = 300, maxFirPoints = 5, maxTime = 60 1: maxRoundingIter = 10, maxTimeFirstCall = 300, maxFirPoints = 5, maxTime = 120 2: maxRoundingIter = 20, maxTimeFirstCall = 1000, maxFirPoints = 5, maxTime = 300

static void Couenne::CouenneIterativeRounding::registerOptions | ( | Ipopt::SmartPtr< Bonmin::RegisteredOptions > |  | ) | `[static]`

initialize options to be read later

bool Couenne::CouenneIterativeRounding::areEqual | ( | double | a,
|  | double | b |
| ) |  |  | `[inline, private]`

Check if two double precision numbers are equal, up to some tolerance.

Definition at line 181 of file CouenneIterativeRounding.hpp.

References COUENNE_EPS.

int Couenne::CouenneIterativeRounding::feasibilityIR | ( | double & | objectiveValue,
|  | double * | newSolution |
| ) |  |  | `[private]`

int Couenne::CouenneIterativeRounding::improvementIR | ( | double & | objectiveValue,
|  | double * | newSolution,
|  | const double * | startingSolution |
| ) |  |  | `[private]`

void Couenne::CouenneIterativeRounding::setMilp | ( |  | ) | `[private]`

Set the milp solver at the root.

int Couenne::CouenneIterativeRounding::computeIntAtBound | ( | const double * | x | ) | `[private]`

Compute number of integer variables at one of their bounds at a given point x.

int Couenne::CouenneIterativeRounding::computeIntAtBound | ( | const double * | x,
|  | double & | avgBoundSize |
| ) |  |  | `[private]`

Compute number of integer variables at one of their bounds at a given point x and average distance between the bounds of variables at one of their bounds.

void Couenne::CouenneIterativeRounding::writeLB | ( | OsiRowCut & | cut,
|  | const double * | x,
|  | char | sense,
|  | double | rhs |
| ) |  |  | `[private]`

Write down a local branching constraint, as an OsiRowCut.

int Couenne::CouenneIterativeRounding::branchToCut | ( | const double * | x,
|  | OsiSolverInterface * | solver,
|  | std::vector< int > & | previousBranches |
| ) |  |  | `[private]`

Branch on a random variable to cut given solution; returns var index.

bool Couenne::CouenneIterativeRounding::solveMilp | ( | OsiSolverInterface * | milp,
|  | double | maxTime |
| ) |  |  | `[private]`

Solve the MILP contained in milp to feasibility, or report failure.

## Member Data Documentation

Bonmin::OsiTMINLPInterface* Couenne::CouenneIterativeRounding::nlp_`[private]`

Pointer to a dynamic nlp solver interface.

Definition at line 131 of file CouenneIterativeRounding.hpp.

OsiSolverInterface* Couenne::CouenneIterativeRounding::cinlp_`[private]`

Pointer to the original NLP solver interface.

Definition at line 133 of file CouenneIterativeRounding.hpp.

OsiClpSolverInterface* Couenne::CouenneIterativeRounding::milp_`[private]`

Pointer to a milp solver interface.

Definition at line 138 of file CouenneIterativeRounding.hpp.

int Couenne::CouenneIterativeRounding::maxRoundingIter_`[private]`

Maximum number of iterations in the main loop.

Definition at line 141 of file CouenneIterativeRounding.hpp.

Referenced by setMaxRoundingIter().

int Couenne::CouenneIterativeRounding::maxFirPoints_`[private]`

Maximum number of iterations in the outer loop for feasibility.

Definition at line 143 of file CouenneIterativeRounding.hpp.

Referenced by setMaxFirPoints().

double Couenne::CouenneIterativeRounding::maxTime_`[private]`

Max CPU time to run the heuristic.

Definition at line 145 of file CouenneIterativeRounding.hpp.

Referenced by setMaxTime().

double Couenne::CouenneIterativeRounding::maxTimeFirstCall_`[private]`

Max CPU time to run the heuristic when no other solution is known.

Definition at line 147 of file CouenneIterativeRounding.hpp.

Referenced by setMaxTimeFirstCall().

int Couenne::CouenneIterativeRounding::numInitialRows_`[private]`

Number of rows in the original convexification.

Definition at line 149 of file CouenneIterativeRounding.hpp.

int Couenne::CouenneIterativeRounding::numSol_`[private]`

Number of solutions last time the heuristic was called.

Definition at line 151 of file CouenneIterativeRounding.hpp.

int Couenne::CouenneIterativeRounding::numIntegers_`[private]`

Number of integer variables in the original model.

Definition at line 153 of file CouenneIterativeRounding.hpp.

double* Couenne::CouenneIterativeRounding::colLower_`[private]`

Pointer to original column lower and upper bounds of the reformulated problem, i.e.

the linearization

Definition at line 156 of file CouenneIterativeRounding.hpp.

double* Couenne::CouenneIterativeRounding::colUpper_`[private]`

Definition at line 157 of file CouenneIterativeRounding.hpp.

double* Couenne::CouenneIterativeRounding::colLowerNlp_`[private]`

Pointer to column lower and upper bounds of the original problem, i.e.

the MINLP

Definition at line 160 of file CouenneIterativeRounding.hpp.

double* Couenne::CouenneIterativeRounding::colUpperNlp_`[private]`

Definition at line 161 of file CouenneIterativeRounding.hpp.

CbcHeuristic** Couenne::CouenneIterativeRounding::heuristics_`[private]`

Heuristics for the MILP.

Definition at line 164 of file CouenneIterativeRounding.hpp.

int Couenne::CouenneIterativeRounding::numHeuristics_`[private]`

Definition at line 165 of file CouenneIterativeRounding.hpp.

double Couenne::CouenneIterativeRounding::startTime_`[private]`

Starting time for the heuristics.

Definition at line 168 of file CouenneIterativeRounding.hpp.

double Couenne::CouenneIterativeRounding::endTime_`[private]`

Maximum allowed time for current run.

Definition at line 170 of file CouenneIterativeRounding.hpp.

double Couenne::CouenneIterativeRounding::omega_`[private]`

Multiplication factor for log barrier parameter in F-IR; see in the paper.

Definition at line 173 of file CouenneIterativeRounding.hpp.

Referenced by setOmega().

int Couenne::CouenneIterativeRounding::baseLbRhs_`[private]`

Base value for the rhs of the local branching constraint it I-IR.

Definition at line 175 of file CouenneIterativeRounding.hpp.

Referenced by setBaseLbRhs().

CouenneProblem* Couenne::CouenneIterativeRounding::couenne_`[private]`

Pointer to a couenne representation of the problem.

Definition at line 178 of file CouenneIterativeRounding.hpp.

Referenced by setCouenneProblem().

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

- CouenneIterativeRounding.hpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines