14 #include "CoinPragma.hpp"
15 #include "CoinTime.hpp"
16 #include "CoinError.hpp"
29 int main (
int argc,
char *argv[])
31 WindowsErrorPopupBlocker();
33 using namespace Ipopt;
34 using namespace Bonmin;
38 FILE * fp = fopen(
"log.out",
"w");
39 CoinMessageHandler handler(fp);
46 bonmin.
roptions()->AddStringOption2(
"print_solution",
"Do we print the solution or not?",
48 "no",
"No, we don't.",
50 "A longer comment can be put here");
55 bonmin.
options()->SetNumericValue(
"bonmin.time_limit", 5);
56 bonmin.
options()->SetStringValue(
"mu_oracle",
"loqo");
67 bonmin.
options()->GetEnumValue(
"print_solution", printSolution,
"");
68 if(printSolution == 1){
69 tminlp->printSolutionAtEndOfAlgorithm();
86 std::cerr<<
"Ipopt has failed to solve a problem"<<std::endl;
89 std::cerr<<E.className()<<
"::"<<E.methodName()
91 <<E.message()<<std::endl;
94 std::cerr<<E.className()<<
"::"<<E.methodName()
96 <<E.message()<<std::endl;
Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions()
Access registered Options.
int main(int argc, char *argv[])
Error class to throw exceptions from OsiTMINLPInterface.
A C++ example for interfacing an MINLP with bonmin.
U * GetRawPtr(const OSSmartPtr< U > &smart_ptr)
void initializeOptionsAndJournalist()
Initialize the options and the journalist.
We will throw this error when a problem is not solved.
Ipopt::SmartPtr< Ipopt::OptionsList > options()
Acces list of Options.
virtual void readOptionsFile()
Get the options from default text file (bonmin.opt) if don't already have them.
void readOptionsString(std::string opt_string)
Get the options from long string containing all.
void initialize(Ipopt::SmartPtr< TMINLP > tminlp, bool createContinuousSolver=true)
Initialize, read options and create appropriate bonmin setup.