Class for providing an Osi interface to Ipopt with an ampl nl file as input. More...
#include <BonAmplInterface.hpp>
Public Member Functions | |
AmplInterface () | |
Default constructor. More... | |
AmplInterface (const AmplInterface &other) | |
Copy constructor. More... | |
virtual OsiSolverInterface * | clone (bool CopyData=true) |
Clone. More... | |
virtual | ~AmplInterface () |
Destructor. More... | |
const AmplTMINLP * | amplModel () const |
Fast access to AmplTMINLP. More... | |
virtual void | setAppDefaultOptions (Ipopt::SmartPtr< Ipopt::OptionsList > Options) |
To set some application specific defaults. More... | |
Methods to input a problem | |
virtual void | readAmplNlFile (char **&argv, Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions, Ipopt::SmartPtr< Ipopt::OptionsList > options, Ipopt::SmartPtr< Ipopt::Journalist > journalist, std::string *nl_file_content=NULL) |
![]() | |
TNLPSolver::UnsolvedError * | newUnsolvedError (int num, Ipopt::SmartPtr< TMINLP2TNLP > problem, std::string name) |
void | setNumIterationSuspect (int value) |
const TMINLP2TNLP * | problem () const |
get pointer to the TMINLP2TNLP adapter More... | |
TMINLP2TNLP * | problem () |
const TMINLP * | model () const |
Bonmin::TMINLP * | model () |
const Bonmin::TNLPSolver * | solver () const |
const std::list < Ipopt::SmartPtr< TNLPSolver > > & | debug_apps () const |
TNLPSolver * | solver () |
OsiTMINLPInterface () | |
Default Constructor. More... | |
void | initialize (Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions, Ipopt::SmartPtr< Ipopt::OptionsList > options, Ipopt::SmartPtr< Ipopt::Journalist > journalist, const std::string &prefix, Ipopt::SmartPtr< TMINLP > tminlp) |
Facilitator to initialize interface. More... | |
void | initialize (Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions, Ipopt::SmartPtr< Ipopt::OptionsList > options, Ipopt::SmartPtr< Ipopt::Journalist > journalist, Ipopt::SmartPtr< TMINLP > tminlp) |
Facilitator to initialize interface. More... | |
void | setModel (Ipopt::SmartPtr< TMINLP > tminlp) |
Set the model to be solved by interface. More... | |
void | setSolver (Ipopt::SmartPtr< TNLPSolver > app) |
Set the solver to be used by interface. More... | |
void | use (Ipopt::SmartPtr< TMINLP2TNLP > tminlp2tnlp) |
Sets the TMINLP2TNLP to be used by the interface. More... | |
OsiTMINLPInterface (const OsiTMINLPInterface &) | |
Copy constructor. More... | |
OsiSolverInterface * | clone (bool copyData=true) const |
Virtual copy constructor. More... | |
OsiTMINLPInterface & | operator= (const OsiTMINLPInterface &rhs) |
Assignment operator. More... | |
virtual | ~OsiTMINLPInterface () |
Destructor. More... | |
void | readOptionFile (const std::string &fileName) |
Read parameter file. More... | |
const Ipopt::SmartPtr < Ipopt::OptionsList > | options () const |
Retrieve OsiTMINLPApplication option list. More... | |
Ipopt::SmartPtr < Ipopt::OptionsList > | options () |
Retrieve OsiTMINLPApplication option list. More... | |
const char * | prefix () const |
Default Constructor. More... | |
virtual void | initialSolve () |
Solve initial continuous relaxation. More... | |
virtual void | initialSolve (const char *whereFrom) |
Solve initial continuous relaxation (precising from where) More... | |
virtual void | resolve () |
Resolve the continuous relaxation after problem modification. More... | |
virtual void | resolve (const char *whereFrom) |
Resolve the continuous relaxation after problem modification. More... | |
virtual void | resolveForCost (int numretry, bool keepWs) |
Resolve the problem with different random starting points to try to find a better solution (only makes sense for a non-convex problem. More... | |
virtual void | resolveForRobustness (int numretry) |
Method to be called when a problem has failed to be solved. More... | |
virtual void | branchAndBound () |
Nescessary for compatibility with OsiSolverInterface but does nothing. More... | |
virtual bool | isAbandoned () const |
Are there a numerical difficulties? More... | |
virtual bool | isProvenOptimal () const |
Is optimality proven? More... | |
virtual bool | isProvenPrimalInfeasible () const |
Is primal infeasiblity proven? More... | |
virtual bool | isProvenDualInfeasible () const |
Is dual infeasiblity proven? More... | |
virtual bool | isPrimalObjectiveLimitReached () const |
Is the given primal objective limit reached? More... | |
virtual bool | isDualObjectiveLimitReached () const |
Is the given dual objective limit reached? More... | |
virtual bool | isIterationLimitReached () const |
Iteration limit reached? More... | |
void | continuingOnAFailure () |
Warn solver that branch-and-bound is continuing after a failure. More... | |
double | getNewCutoffDecr () |
Are there a numerical difficulties? More... | |
void | setNewCutoffDecr (double d) |
Are there a numerical difficulties? More... | |
bool | hasContinuedOnAFailure () |
Did we continue on a failure. More... | |
void | ignoreFailures () |
tell to ignore the failures (don't throw, don't fathom, don't report) More... | |
void | forceInfeasible () |
Force current solution to be infeasible. More... | |
void | forceBranchable () |
Force current solution to be branched on (make it fractionnal with small objective) More... | |
bool | setIntParam (OsiIntParam key, int value) |
bool | setDblParam (OsiDblParam key, double value) |
bool | setStrParam (OsiStrParam key, const std::string &value) |
bool | getIntParam (OsiIntParam key, int &value) const |
bool | getDblParam (OsiDblParam key, double &value) const |
bool | getStrParam (OsiStrParam key, std::string &value) const |
double | getPushFact () const |
virtual int | getNumCols () const |
Get number of columns. More... | |
virtual int | getNumRows () const |
Get number of rows. More... | |
const OsiSolverInterface::OsiNameVec & | getVarNames () |
get name of variables More... | |
virtual const double * | getColLower () const |
Get pointer to array[getNumCols()] of column lower bounds. More... | |
virtual const double * | getColUpper () const |
Get pointer to array[getNumCols()] of column upper bounds. More... | |
virtual const char * | getRowSense () const |
Get pointer to array[getNumRows()] of row constraint senses. More... | |
virtual const double * | getRightHandSide () const |
Get pointer to array[getNumRows()] of rows right-hand sides. More... | |
virtual const double * | getRowRange () const |
Get pointer to array[getNumRows()] of row ranges. More... | |
virtual const double * | getRowLower () const |
Get pointer to array[getNumRows()] of row lower bounds. More... | |
virtual const double * | getRowUpper () const |
Get pointer to array[getNumRows()] of row upper bounds. More... | |
virtual double | getObjSense () const |
Get objective function sense (1 for min (default), -1 for max) Always minimizes. More... | |
virtual bool | isContinuous (int colNumber) const |
Return true if column is continuous. More... | |
virtual bool | isBinary (int columnNumber) const |
Return true if column is binary. More... | |
virtual bool | isInteger (int columnNumber) const |
Return true if column is integer. More... | |
virtual bool | isIntegerNonBinary (int columnNumber) const |
Return true if column is general integer. More... | |
virtual bool | isFreeBinary (int columnNumber) const |
Return true if column is binary and not fixed at either bound. More... | |
virtual double | getInfinity () const |
Get solver's value for infinity. More... | |
const int * | getPriorities () const |
Get priorities on integer variables. More... | |
const int * | getBranchingDirections () const |
get prefered branching directions More... | |
const double * | getUpPsCosts () const |
Get number of columns. More... | |
const double * | getDownPsCosts () const |
Get number of columns. More... | |
virtual const double * | getColSolution () const |
Get pointer to array[getNumCols()] of primal solution vector. More... | |
virtual const double * | getRowPrice () const |
Get pointer to array[getNumRows()] of dual prices. More... | |
virtual const double * | getReducedCost () const |
Get a pointer to array[getNumCols()] of reduced costs. More... | |
virtual const double * | getRowActivity () const |
Get pointer to array[getNumRows()] of row activity levels (constraint matrix times the solution vector. More... | |
virtual int | getIterationCount () const |
Get how many iterations it took to solve the problem (whatever "iteration" mean to the solver. More... | |
int | nCallOptimizeTNLP () |
get total number of calls to solve. More... | |
double | totalNlpSolveTime () |
get total time taken to solve NLP's. More... | |
int | totalIterations () |
get total number of iterations More... | |
virtual void | setColLower (int elementIndex, double elementValue) |
Set a single column lower bound. More... | |
virtual void | setColUpper (int elementIndex, double elementValue) |
Set a single column upper bound. More... | |
virtual void | setColLower (const double *array) |
Set the lower bounds for all columns array [getNumCols()] is an array of values for the objective. More... | |
virtual void | setColUpper (const double *array) |
Set the upper bounds for all columns array [getNumCols()] is an array of values for the objective. More... | |
virtual void | setRowLower (int elementIndex, double elementValue) |
Set a single row lower bound. More... | |
virtual void | setRowUpper (int elementIndex, double elementValue) |
Set a single row upper bound. More... | |
virtual void | setRowType (int index, char sense, double rightHandSide, double range) |
Set the type of a single row. More... | |
virtual void | setObjSense (double s) |
Set the objective function sense (disabled). More... | |
virtual void | setColSolution (const double *colsol) |
Set the primal solution variable values Set the values for the starting point. More... | |
virtual void | setRowPrice (const double *rowprice) |
Set dual solution variable values. More... | |
virtual CoinWarmStart * | getEmptyWarmStart () const |
Get an empty warm start object. More... | |
virtual CoinWarmStart * | getWarmStart () const |
Get warmstarting information. More... | |
virtual bool | setWarmStart (const CoinWarmStart *warmstart) |
Set warmstarting information. More... | |
void | setWarmStartMode (int mode) |
Get an empty warm start object. More... | |
WarmStartModes | getWarmStartMode () |
Get an empty warm start object. More... | |
void | randomStartingPoint () |
Get an empty warm start object. More... | |
virtual bool | basisIsAvailable () const |
Get an empty warm start object. More... | |
virtual void | setContinuous (int index) |
Set the index-th variable to be a continuous variable. More... | |
virtual void | setInteger (int index) |
Set the index-th variable to be an integer variable. More... | |
virtual int | getNumElements () const |
Cbc will understand that no matrix exsits if return -1. More... | |
virtual const double * | getObjCoefficients () const |
This returns the objective function gradient at the current point. More... | |
virtual const CoinPackedMatrix * | getMatrixByRow () const |
We have to keep this but it will return NULL. More... | |
virtual const CoinPackedMatrix * | getMatrixByCol () const |
We have to keep this but it will return NULL. More... | |
virtual void | setObjCoeff (int elementIndex, double elementValue) |
We have to keep this but it will throw an error. More... | |
virtual void | addCol (const CoinPackedVectorBase &vec, const double collb, const double colub, const double obj) |
We have to keep this but it will throw an error. More... | |
virtual void | deleteCols (const int num, const int *colIndices) |
We have to keep this but it will throw an error. More... | |
virtual void | addRow (const CoinPackedVectorBase &vec, const double rowlb, const double rowub) |
We have to keep this but it will throw an error. More... | |
virtual void | addRow (const CoinPackedVectorBase &vec, const char rowsen, const double rowrhs, const double rowrng) |
We have to keep this but it will throw an error. More... | |
virtual void | deleteRows (const int num, const int *rowIndices) |
We have to keep this but it will throw an error. More... | |
virtual void | loadProblem (const CoinPackedMatrix &matrix, const double *collb, const double *colub, const double *obj, const double *rowlb, const double *rowub) |
We have to keep this but it will throw an error. More... | |
virtual void | assignProblem (CoinPackedMatrix *&matrix, double *&collb, double *&colub, double *&obj, double *&rowlb, double *&rowub) |
We have to keep this but it will throw an error. More... | |
virtual void | loadProblem (const CoinPackedMatrix &matrix, const double *collb, const double *colub, const double *obj, const char *rowsen, const double *rowrhs, const double *rowrng) |
We have to keep this but it will throw an error. More... | |
virtual void | assignProblem (CoinPackedMatrix *&matrix, double *&collb, double *&colub, double *&obj, char *&rowsen, double *&rowrhs, double *&rowrng) |
We have to keep this but it will throw an error. More... | |
virtual void | loadProblem (const int numcols, const int numrows, const int *start, const int *index, const double *value, const double *collb, const double *colub, const double *obj, const double *rowlb, const double *rowub) |
We have to keep this but it will throw an error. More... | |
virtual void | loadProblem (const int numcols, const int numrows, const int *start, const int *index, const double *value, const double *collb, const double *colub, const double *obj, const char *rowsen, const double *rowrhs, const double *rowrng) |
We have to keep this but it will throw an error. More... | |
virtual int | readMps (const char *filename, const char *extension="mps") |
We have to keep this but it will throw an error. More... | |
virtual void | writeMps (const char *filename, const char *extension="mps", double objSense=0.0) const |
We have to keep this but it will throw an error. More... | |
virtual std::vector< double * > | getDualRays (int maxNumRays, bool fullRay=false) const |
Throws an error. More... | |
virtual std::vector< double * > | getPrimalRays (int maxNumRays) const |
Throws an error. More... | |
void | setSolverOutputToDefault () |
void | forceSolverOutput (int log_level) |
virtual double | getObjValue () const |
Get objective function value (can't use default) More... | |
virtual void | extractLinearRelaxation (OsiSolverInterface &si, const double *x, bool getObj=1) |
Extract a linear relaxation of the MINLP. More... | |
virtual void | addObjectiveFunction (OsiSolverInterface &si, const double *x) |
Add constraint corresponding to objective function. More... | |
virtual void | extractLinearRelaxation (OsiSolverInterface &si, bool getObj=1, bool solveNlp=1) |
Extract a linear relaxation of the MINLP. More... | |
void | getOuterApproximation (OsiCuts &cs, int getObj, const double *x2, bool global) |
Get the outer approximation constraints at the current optimal point. More... | |
void | getOuterApproximation (OsiCuts &cs, const double *x, int getObj, const double *x2, bool global) |
Get the outer approximation constraints at provided point. More... | |
virtual void | getOuterApproximation (OsiCuts &cs, const double *x, int getObj, const double *x2, double theta, bool global) |
Get the outer approximation constraints at provided point. More... | |
virtual void | getConstraintOuterApproximation (OsiCuts &cs, int constraintNumber, const double *x, const double *x2, bool global) |
Get the outer approximation at provided point for given constraint. More... | |
void | getConstraintOuterApproximation (OsiCuts &cs, int constraintNumber, const double *x2, bool global) |
Get the outer approximation at current optimal point for given constraint. More... | |
void | getBendersCut (OsiCuts &cs, bool global) |
Get a benders cut from solution. More... | |
double | solveFeasibilityProblem (size_t n, const double *x_bar, const int *ind, double a, double s, int L) |
Given a point x_bar this solves the problem of finding the point which minimize a convex combination between the distance to x_bar and the original objective function f(x): ![]() | |
Protected Member Functions | |
void | readNames () |
Read variables and row names in .col and .row files. More... | |
Protected Attributes | |
Ipopt::SmartPtr < Bonmin::AmplTMINLP > | amplTminlp_ |
TMINLP problem (the original problem usually an AmplTMINLP). More... | |
Private Attributes | |
int | writeAmplSolFile_ |
Write the ampl solution file or write a bonmin one? More... | |
Additional Inherited Members | |
![]() | |
enum | WarmStartModes { None, FakeBasis, Optimum, InteriorPoint } |
enum | MessagesTypes { SOLUTION_FOUND, INFEASIBLE_SOLUTION_FOUND, UNSOLVED_PROBLEM_FOUND, WARNING_RESOLVING, WARN_SUCCESS_WS, WARN_SUCCESS_RANDOM, WARN_CONTINUING_ON_FAILURE, SUSPECT_PROBLEM, SUSPECT_PROBLEM2, IPOPT_SUMMARY, BETTER_SOL, LOG_HEAD, LOG_FIRST_LINE, LOG_LINE, ALTERNATE_OBJECTIVE, WARN_RESOLVE_BEFORE_INITIAL_SOLVE, ERROR_NO_TNLPSOLVER, WARNING_NON_CONVEX_OA, SOLVER_DISAGREE_STATUS, SOLVER_DISAGREE_VALUE, OSITMINLPINTERFACE_DUMMY_END } |
Type of the messages specifically written by OsiTMINLPInterface. More... | |
Class for providing an Osi interface to Ipopt with an ampl nl file as input.
Definition at line 22 of file BonAmplInterface.hpp.
Bonmin::AmplInterface::AmplInterface | ( | ) |
Default constructor.
Default constructor no initialization.
Default constructor only available for Bonmin's friends and child classes.
Definition at line 29 of file BonAmplInterface.cpp.
Bonmin::AmplInterface::AmplInterface | ( | const AmplInterface & | other | ) |
Copy constructor.
Definition at line 34 of file BonAmplInterface.cpp.
|
virtual |
Destructor.
Definition at line 47 of file BonAmplInterface.cpp.
|
virtual |
Definition at line 53 of file BonAmplInterface.cpp.
|
virtual |
Clone.
Reimplemented in Couenne::CouenneInterface.
Definition at line 41 of file BonAmplInterface.cpp.
|
inline |
Fast access to AmplTMINLP.
Definition at line 45 of file BonAmplInterface.hpp.
|
virtual |
To set some application specific defaults.
Reimplemented in Couenne::CouenneInterface.
Definition at line 106 of file BonAmplInterface.cpp.
|
protected |
Read variables and row names in .col and .row files.
Definition at line 111 of file BonAmplInterface.cpp.
|
protected |
TMINLP problem (the original problem usually an AmplTMINLP).
Definition at line 57 of file BonAmplInterface.hpp.
|
private |
Write the ampl solution file or write a bonmin one?
Definition at line 61 of file BonAmplInterface.hpp.