Bonmin 1.8.9
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | List of all members
Bonmin::TNLPSolver Class Referenceabstract

This is a generic class for calling an NLP solver to solve a TNLP. More...

#include <BonTNLPSolver.hpp>

+ Inheritance diagram for Bonmin::TNLPSolver:
+ Collaboration diagram for Bonmin::TNLPSolver:

Classes

class  UnsolvedError
 We will throw this error when a problem is not solved. More...
 

Public Types

enum  ReturnStatus {
  iterationLimit = -3 , timeLimit = 5 , doesNotConverge = -8 , computationError = -2 ,
  notEnoughFreedom = -1 , illDefinedProblem = -4 , illegalOption =-5 , externalException =-6 ,
  exception =-7 , solvedOptimal = 1 , solvedOptimalTol =2 , provenInfeasible =3 ,
  unbounded = 4 , numReturnCodes
}
 Standard return statuses for a solver. More...
 

Public Member Functions

virtual UnsolvedErrornewUnsolvedError (int num, Ipopt::SmartPtr< TMINLP2TNLP > problem, std::string name)=0
 
 TNLPSolver ()
 default Constructor
 
 TNLPSolver (Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions, Ipopt::SmartPtr< Ipopt::OptionsList > options, Ipopt::SmartPtr< Ipopt::Journalist > journalist, const std::string &prefix)
 Constructor with options initialization.
 
virtual Ipopt::SmartPtr< TNLPSolverclone ()=0
 virtual copy constructor
 
virtual ~TNLPSolver ()
 Virtual destructor.
 
virtual bool Initialize (std::string params_file)=0
 Initialize the TNLPSolver (read options from params_file)
 
virtual bool Initialize (std::istream &is)=0
 Initialize the TNLPSolver (read options from istream is)
 
- Public Member Functions inherited from Ipopt::ReferencedObject
 ReferencedObject ()
 
virtual ~ReferencedObject ()
 
Index ReferenceCount () const
 
void AddRef (const Referencer *referencer) const
 
void ReleaseRef (const Referencer *referencer) const
 

Solve methods

Ipopt::SmartPtr< Ipopt::Journalistjournalist_
 Storage of Journalist for output.
 
Ipopt::SmartPtr< Ipopt::OptionsListoptions_
 List of Options.
 
Ipopt::SmartPtr< Bonmin::RegisteredOptionsroptions_
 Registered Options.
 
std::string prefix_
 Prefix to use for reading bonmin's options.
 
double start_time_
 Global start time.
 
double time_limit_
 Global time limit.
 
int default_log_level_
 To record default log level.
 
virtual ReturnStatus OptimizeTNLP (const Ipopt::SmartPtr< Ipopt::TNLP > &tnlp)=0
 Solves a problem expresses as a TNLP.
 
virtual ReturnStatus ReOptimizeTNLP (const Ipopt::SmartPtr< Ipopt::TNLP > &tnlp)=0
 Resolves a problem expresses as a TNLP.
 
virtual bool setWarmStart (const CoinWarmStart *warm, Ipopt::SmartPtr< TMINLP2TNLP > tnlp)=0
 Set the warm start in the solver.
 
virtual CoinWarmStartgetUsedWarmStart (Ipopt::SmartPtr< TMINLP2TNLP > tnlp) const =0
 Get warm start used in last optimization.
 
virtual CoinWarmStartgetWarmStart (Ipopt::SmartPtr< TMINLP2TNLP > tnlp) const =0
 Get the warm start form the solver.
 
virtual CoinWarmStartgetEmptyWarmStart () const =0
 
virtual bool warmStartIsValid (const CoinWarmStart *ws) const =0
 Check that warm start object is valid.
 
virtual void enableWarmStart ()=0
 Enable the warm start options in the solver.
 
virtual void disableWarmStart ()=0
 Disable the warm start options in the solver.
 
Ipopt::SmartPtr< Ipopt::Journalistjournalist ()
 Get a pointer to a journalist.
 
Ipopt::SmartPtr< Bonmin::RegisteredOptionsroptions ()
 Get a pointer to RegisteredOptions (generally used to add new ones)
 
Ipopt::SmartPtr< const Ipopt::OptionsListoptions () const
 Get the options (for getting their values).
 
Ipopt::SmartPtr< Ipopt::OptionsListoptions ()
 Get the options (for getting and setting their values).
 
const char * prefix ()
 Get the prefix.
 
virtual double CPUTime ()=0
 Get the CpuTime of the last optimization.
 
virtual int IterationCount ()=0
 Get the iteration count of the last optimization.
 
virtual void setOutputToDefault ()=0
 turn off all output from the solver
 
virtual void forceSolverOutput (int log_level)=0
 turn on all output from the solver
 
virtual std::string & solverName ()=0
 Get the solver name.
 
bool isRecoverable (ReturnStatus &r)
 Say if an optimization status for a problem which failed is recoverable (problem may be solvable).
 
void setup_global_time_limit (double time_limit)
 Setup for a global time limit for solver.
 
bool isError (ReturnStatus &r)
 Say if return status is an error.
 
virtual int errorCode () const =0
 Error code (solver specific).
 
static void RegisterOptions (Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions)
 Register this solver options into passed roptions.
 
bool zeroDimension (const Ipopt::SmartPtr< Ipopt::TNLP > &tnlp, ReturnStatus &optimization_status)
 Determine if problem is of dimension zero and if it is check if solution is feasible.
 
void initializeOptionsAndJournalist ()
 Initializes options and journalist.
 
 TNLPSolver (const TNLPSolver &other)
 Copy Constructor.
 

Detailed Description

This is a generic class for calling an NLP solver to solve a TNLP.

A TNLPSolver is able to solve and resolve a problem, it has some options (stored with Ipopt OptionList structure and registeredOptions) it produces some statistics (in SolveStatisctics and sometimes some errorCodes.

Definition at line 26 of file BonTNLPSolver.hpp.

Member Enumeration Documentation

◆ ReturnStatus

Standard return statuses for a solver.

Enumerator
iterationLimit 
timeLimit 
doesNotConverge 
computationError 
notEnoughFreedom 
illDefinedProblem 
illegalOption 
externalException 
exception 
solvedOptimal 
solvedOptimalTol 
provenInfeasible 
unbounded 
numReturnCodes 

Fake member to know size.

Definition at line 29 of file BonTNLPSolver.hpp.

Constructor & Destructor Documentation

◆ TNLPSolver() [1/3]

Bonmin::TNLPSolver::TNLPSolver ( )

default Constructor

◆ TNLPSolver() [2/3]

Bonmin::TNLPSolver::TNLPSolver ( Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions,
Ipopt::SmartPtr< Ipopt::OptionsList > options,
Ipopt::SmartPtr< Ipopt::Journalist > journalist,
const std::string & prefix )

Constructor with options initialization.

◆ ~TNLPSolver()

virtual Bonmin::TNLPSolver::~TNLPSolver ( )
virtual

Virtual destructor.

◆ TNLPSolver() [3/3]

Bonmin::TNLPSolver::TNLPSolver ( const TNLPSolver & other)
protected

Copy Constructor.

Member Function Documentation

◆ newUnsolvedError()

virtual UnsolvedError * Bonmin::TNLPSolver::newUnsolvedError ( int num,
Ipopt::SmartPtr< TMINLP2TNLP > problem,
std::string name )
pure virtual

◆ clone()

virtual Ipopt::SmartPtr< TNLPSolver > Bonmin::TNLPSolver::clone ( )
pure virtual

virtual copy constructor

Implemented in Bonmin::BqpdSolver, Bonmin::FilterSolver, and Bonmin::IpoptSolver.

◆ Initialize() [1/2]

virtual bool Bonmin::TNLPSolver::Initialize ( std::string params_file)
pure virtual

Initialize the TNLPSolver (read options from params_file)

Implemented in Bonmin::BqpdSolver, Bonmin::FilterSolver, and Bonmin::IpoptSolver.

◆ Initialize() [2/2]

virtual bool Bonmin::TNLPSolver::Initialize ( std::istream & is)
pure virtual

Initialize the TNLPSolver (read options from istream is)

Implemented in Bonmin::BqpdSolver, Bonmin::FilterSolver, and Bonmin::IpoptSolver.

◆ OptimizeTNLP()

virtual ReturnStatus Bonmin::TNLPSolver::OptimizeTNLP ( const Ipopt::SmartPtr< Ipopt::TNLP > & tnlp)
pure virtual

Solves a problem expresses as a TNLP.

Implemented in Bonmin::BqpdSolver, Bonmin::FilterSolver, and Bonmin::IpoptSolver.

◆ ReOptimizeTNLP()

virtual ReturnStatus Bonmin::TNLPSolver::ReOptimizeTNLP ( const Ipopt::SmartPtr< Ipopt::TNLP > & tnlp)
pure virtual

Resolves a problem expresses as a TNLP.

Implemented in Bonmin::BqpdSolver, Bonmin::FilterSolver, and Bonmin::IpoptSolver.

◆ setWarmStart()

virtual bool Bonmin::TNLPSolver::setWarmStart ( const CoinWarmStart * warm,
Ipopt::SmartPtr< TMINLP2TNLP > tnlp )
pure virtual

Set the warm start in the solver.

Implemented in Bonmin::BqpdSolver, Bonmin::FilterSolver, and Bonmin::IpoptSolver.

◆ getUsedWarmStart()

virtual CoinWarmStart * Bonmin::TNLPSolver::getUsedWarmStart ( Ipopt::SmartPtr< TMINLP2TNLP > tnlp) const
pure virtual

Get warm start used in last optimization.

Implemented in Bonmin::BqpdSolver, Bonmin::FilterSolver, and Bonmin::IpoptSolver.

◆ getWarmStart()

virtual CoinWarmStart * Bonmin::TNLPSolver::getWarmStart ( Ipopt::SmartPtr< TMINLP2TNLP > tnlp) const
pure virtual

Get the warm start form the solver.

Implemented in Bonmin::IpoptSolver, Bonmin::BqpdSolver, and Bonmin::FilterSolver.

◆ getEmptyWarmStart()

virtual CoinWarmStart * Bonmin::TNLPSolver::getEmptyWarmStart ( ) const
pure virtual

◆ warmStartIsValid()

virtual bool Bonmin::TNLPSolver::warmStartIsValid ( const CoinWarmStart * ws) const
pure virtual

Check that warm start object is valid.

Implemented in Bonmin::BqpdSolver, Bonmin::FilterSolver, and Bonmin::IpoptSolver.

◆ enableWarmStart()

virtual void Bonmin::TNLPSolver::enableWarmStart ( )
pure virtual

Enable the warm start options in the solver.

Implemented in Bonmin::BqpdSolver, Bonmin::FilterSolver, and Bonmin::IpoptSolver.

◆ disableWarmStart()

virtual void Bonmin::TNLPSolver::disableWarmStart ( )
pure virtual

Disable the warm start options in the solver.

Implemented in Bonmin::BqpdSolver, Bonmin::FilterSolver, and Bonmin::IpoptSolver.

◆ journalist()

Ipopt::SmartPtr< Ipopt::Journalist > Bonmin::TNLPSolver::journalist ( )
inline

Get a pointer to a journalist.

Definition at line 155 of file BonTNLPSolver.hpp.

◆ roptions()

Ipopt::SmartPtr< Bonmin::RegisteredOptions > Bonmin::TNLPSolver::roptions ( )
inline

Get a pointer to RegisteredOptions (generally used to add new ones)

Definition at line 159 of file BonTNLPSolver.hpp.

◆ options() [1/2]

Ipopt::SmartPtr< const Ipopt::OptionsList > Bonmin::TNLPSolver::options ( ) const
inline

Get the options (for getting their values).

Definition at line 163 of file BonTNLPSolver.hpp.

◆ options() [2/2]

Ipopt::SmartPtr< Ipopt::OptionsList > Bonmin::TNLPSolver::options ( )
inline

Get the options (for getting and setting their values).

Definition at line 167 of file BonTNLPSolver.hpp.

◆ prefix()

const char * Bonmin::TNLPSolver::prefix ( )
inline

Get the prefix.

Definition at line 171 of file BonTNLPSolver.hpp.

◆ RegisterOptions()

static void Bonmin::TNLPSolver::RegisterOptions ( Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions)
inlinestatic

Register this solver options into passed roptions.

Definition at line 175 of file BonTNLPSolver.hpp.

◆ CPUTime()

virtual double Bonmin::TNLPSolver::CPUTime ( )
pure virtual

Get the CpuTime of the last optimization.

Implemented in Bonmin::BqpdSolver, Bonmin::FilterSolver, and Bonmin::IpoptSolver.

◆ IterationCount()

virtual int Bonmin::TNLPSolver::IterationCount ( )
pure virtual

Get the iteration count of the last optimization.

Implemented in Bonmin::BqpdSolver, Bonmin::FilterSolver, and Bonmin::IpoptSolver.

◆ setOutputToDefault()

virtual void Bonmin::TNLPSolver::setOutputToDefault ( )
pure virtual

turn off all output from the solver

Implemented in Bonmin::BqpdSolver, Bonmin::FilterSolver, and Bonmin::IpoptSolver.

◆ forceSolverOutput()

virtual void Bonmin::TNLPSolver::forceSolverOutput ( int log_level)
pure virtual

turn on all output from the solver

Implemented in Bonmin::BqpdSolver, Bonmin::FilterSolver, and Bonmin::IpoptSolver.

◆ solverName()

virtual std::string & Bonmin::TNLPSolver::solverName ( )
pure virtual

Get the solver name.

Implemented in Bonmin::BqpdSolver, Bonmin::FilterSolver, and Bonmin::IpoptSolver.

◆ isRecoverable()

bool Bonmin::TNLPSolver::isRecoverable ( ReturnStatus & r)

Say if an optimization status for a problem which failed is recoverable (problem may be solvable).

◆ setup_global_time_limit()

void Bonmin::TNLPSolver::setup_global_time_limit ( double time_limit)
inline

Setup for a global time limit for solver.

Definition at line 196 of file BonTNLPSolver.hpp.

◆ isError()

bool Bonmin::TNLPSolver::isError ( ReturnStatus & r)
inline

Say if return status is an error.

Definition at line 202 of file BonTNLPSolver.hpp.

◆ errorCode()

virtual int Bonmin::TNLPSolver::errorCode ( ) const
pure virtual

Error code (solver specific).

Implemented in Bonmin::BqpdSolver, Bonmin::FilterSolver, and Bonmin::IpoptSolver.

◆ zeroDimension()

bool Bonmin::TNLPSolver::zeroDimension ( const Ipopt::SmartPtr< Ipopt::TNLP > & tnlp,
ReturnStatus & optimization_status )
protected

Determine if problem is of dimension zero and if it is check if solution is feasible.

◆ initializeOptionsAndJournalist()

void Bonmin::TNLPSolver::initializeOptionsAndJournalist ( )
protected

Initializes options and journalist.

Member Data Documentation

◆ journalist_

Ipopt::SmartPtr<Ipopt::Journalist> Bonmin::TNLPSolver::journalist_
protected

Storage of Journalist for output.

Definition at line 216 of file BonTNLPSolver.hpp.

◆ options_

Ipopt::SmartPtr<Ipopt::OptionsList> Bonmin::TNLPSolver::options_
protected

List of Options.

Definition at line 219 of file BonTNLPSolver.hpp.

◆ roptions_

Ipopt::SmartPtr<Bonmin::RegisteredOptions> Bonmin::TNLPSolver::roptions_
protected

Registered Options.

Definition at line 222 of file BonTNLPSolver.hpp.

◆ prefix_

std::string Bonmin::TNLPSolver::prefix_
protected

Prefix to use for reading bonmin's options.

Definition at line 225 of file BonTNLPSolver.hpp.

◆ start_time_

double Bonmin::TNLPSolver::start_time_
protected

Global start time.

Definition at line 227 of file BonTNLPSolver.hpp.

◆ time_limit_

double Bonmin::TNLPSolver::time_limit_
protected

Global time limit.

Definition at line 230 of file BonTNLPSolver.hpp.

◆ default_log_level_

int Bonmin::TNLPSolver::default_log_level_
protected

To record default log level.

Definition at line 233 of file BonTNLPSolver.hpp.


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