00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef OsiTMINLPInterface_H
00014 #define OsiTMINLPInterface_H
00015
00016 #define INT_BIAS 0e-8
00017
00018 #include <string>
00019 #include <iostream>
00020
00021 #include "OsiSolverInterface.hpp"
00022 #include "CoinWarmStartBasis.hpp"
00023
00024 #include "BonCutStrengthener.hpp"
00025
00026
00027 namespace Bonmin {
00028 class TMINLP;
00029 class TMINLP2TNLP;
00030 class TNLP2FPNLP;
00031 class TNLPSolver;
00032 class RegisteredOptions;
00033 class StrongBranchingSolver;
00034
00036 enum Solver{
00037 EIpopt=0 ,
00038 EFilterSQP ,
00039 EAll
00040 };
00047 class OsiTMINLPInterface : public OsiSolverInterface
00048 {
00049 friend class BonminParam;
00050
00051 public:
00052
00053
00054
00059 class SimpleError : public CoinError
00060 {
00061 private:
00062 SimpleError();
00063
00064 public:
00066 SimpleError(std::string message,
00067 std::string methodName,
00068 std::string f = std::string(),
00069 int l = -1)
00070 :
00071 CoinError(message,methodName,std::string("OsiTMINLPInterface"), f, l)
00072 {}
00073 }
00074 ;
00075
00076 #ifdef __LINE__
00077 #define SimpleError(x, y) SimpleError((x), (y), __FILE__, __LINE__)
00078 #endif
00079
00080
00081 TNLPSolver::UnsolvedError * newUnsolvedError(int num, Ipopt::SmartPtr<TMINLP2TNLP> problem, std::string name){
00082 return app_->newUnsolvedError(num, problem, name);
00083 }
00084
00085
00086
00088 enum MessagesTypes{
00089 SOLUTION_FOUND,
00090 INFEASIBLE_SOLUTION_FOUND,
00091 UNSOLVED_PROBLEM_FOUND,
00092 WARNING_RESOLVING ,
00093 WARN_SUCCESS_WS,
00094 WARN_SUCCESS_RANDOM,
00095 WARN_CONTINUING_ON_FAILURE,
00096 SUSPECT_PROBLEM,
00097 SUSPECT_PROBLEM2,
00098 IPOPT_SUMMARY ,
00099 BETTER_SOL ,
00100 LOG_HEAD,
00101 LOG_FIRST_LINE,
00102 LOG_LINE,
00103 ALTERNATE_OBJECTIVE,
00104 WARN_RESOLVE_BEFORE_INITIAL_SOLVE ,
00107 ERROR_NO_TNLPSOLVER ,
00108 WARNING_NON_CONVEX_OA ,
00109 SOLVER_DISAGREE_STATUS ,
00110 SOLVER_DISAGREE_VALUE ,
00111 OSITMINLPINTERFACE_DUMMY_END
00112 };
00113
00114
00115
00116
00118 class Messages : public CoinMessages
00119 {
00120 public:
00122 Messages();
00123 };
00124
00125
00126
00127
00128
00131
00132 OsiTMINLPInterface();
00133
00135 void initialize(Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions,
00136 Ipopt::SmartPtr<Ipopt::OptionsList> options,
00137 Ipopt::SmartPtr<Ipopt::Journalist> journalist,
00138 const std::string & prefix,
00139 Ipopt::SmartPtr<TMINLP> tminlp);
00140
00142 void initialize(Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions,
00143 Ipopt::SmartPtr<Ipopt::OptionsList> options,
00144 Ipopt::SmartPtr<Ipopt::Journalist> journalist,
00145 Ipopt::SmartPtr<TMINLP> tminlp){
00146 initialize(roptions, options, journalist, "bonmin.", tminlp);
00147 }
00148
00150 void setModel(Ipopt::SmartPtr<TMINLP> tminlp);
00152 void setSolver(Ipopt::SmartPtr<TNLPSolver> app);
00154 void use(Ipopt::SmartPtr<TMINLP2TNLP> tminlp2tnlp);
00157 OsiTMINLPInterface (const OsiTMINLPInterface &);
00158
00160 OsiSolverInterface * clone(bool copyData = true) const;
00161
00163 OsiTMINLPInterface & operator=(const OsiTMINLPInterface& rhs);
00164
00166 virtual ~OsiTMINLPInterface ();
00167
00168
00170 void readOptionFile(const std::string & fileName);
00171
00173 const Ipopt::SmartPtr<Ipopt::OptionsList> options() const;
00175 Ipopt::SmartPtr<Ipopt::OptionsList> options();
00176
00177 const char * prefix() const{
00178 if(!IsValid(app_)) {
00179 messageHandler()->message(ERROR_NO_TNLPSOLVER, messages_)<<CoinMessageEol;
00180 return NULL;
00181 }
00182 else
00183 return app_->prefix();
00184 }
00186
00189
00190 virtual void initialSolve();
00191
00193 virtual void initialSolve(const char * whereFrom);
00194
00200 virtual void resolve();
00201
00207 virtual void resolve(const char * whereFrom);
00208
00211 virtual void resolveForCost(int numretry, bool keepWs);
00212
00216 virtual void resolveForRobustness(int numretry);
00217
00219 virtual void branchAndBound()
00220 {
00221 throw SimpleError("Function not implemented for OsiTMINLPInterface","branchAndBound()");
00222 }
00224
00225
00226
00227
00229
00230
00231 virtual bool isAbandoned() const;
00233 virtual bool isProvenOptimal() const;
00235 virtual bool isProvenPrimalInfeasible() const;
00237 virtual bool isProvenDualInfeasible() const;
00239 virtual bool isPrimalObjectiveLimitReached() const;
00241 virtual bool isDualObjectiveLimitReached() const;
00243 virtual bool isIterationLimitReached() const;
00244
00246 void continuingOnAFailure()
00247 {
00248 hasContinuedAfterNlpFailure_ = true;
00249 }
00250
00251
00252
00253
00254 double getNewCutoffDecr()
00255 {
00256 return newCutoffDecr;
00257 }
00258
00259 void setNewCutoffDecr(double d)
00260 {
00261 newCutoffDecr = d;
00262 }
00263
00264
00266 bool hasContinuedOnAFailure()
00267 {
00268 return hasContinuedAfterNlpFailure_;
00269 }
00271 void ignoreFailures()
00272 {
00273 pretendFailIsInfeasible_ = 2;
00274 }
00276 void forceInfeasible()
00277 {
00278 problem_->set_obj_value(1e200);
00279 }
00281 void forceBranchable()
00282 {
00283 problem_->set_obj_value(-1e200);
00284 problem_->force_fractionnal_sol();
00285 }
00287
00288
00289
00305
00306 bool setIntParam(OsiIntParam key, int value);
00307
00308 bool setDblParam(OsiDblParam key, double value);
00309
00310 bool setStrParam(OsiStrParam key, const std::string & value);
00311
00312 bool getIntParam(OsiIntParam key, int& value) const;
00313
00314 bool getDblParam(OsiDblParam key, double& value) const;
00315
00316 bool getStrParam(OsiStrParam key, std::string& value) const;
00317
00318
00319 inline double getPushFact() const
00320 {
00321 return pushValue_;
00322 }
00323
00325
00326
00327
00340
00341 virtual int getNumCols() const;
00342
00344 virtual int getNumRows() const;
00345
00347 const OsiSolverInterface::OsiNameVec& getVarNames() ;
00349 virtual const double * getColLower() const;
00350
00352 virtual const double * getColUpper() const;
00353
00363 virtual const char * getRowSense() const;
00364
00373 virtual const double * getRightHandSide() const;
00374
00383 virtual const double * getRowRange() const;
00384
00386 virtual const double * getRowLower() const;
00387
00389 virtual const double * getRowUpper() const;
00390
00393 virtual double getObjSense() const
00394 {
00395 return 1;
00396 }
00397
00399 virtual bool isContinuous(int colNumber) const;
00400
00402 virtual bool isBinary(int columnNumber) const;
00403
00408 virtual bool isInteger(int columnNumber) const;
00409
00411 virtual bool isIntegerNonBinary(int columnNumber) const;
00412
00414 virtual bool isFreeBinary(int columnNumber) const;
00415
00417 virtual double getInfinity() const;
00418
00420 const int * getPriorities() const
00421 {
00422 const TMINLP::BranchingInfo * branch = tminlp_->branchingInfo();
00423 if(branch)
00424 return branch->priorities;
00425 else return NULL;
00426 }
00428 const int * getBranchingDirections() const
00429 {
00430 const TMINLP::BranchingInfo * branch = tminlp_->branchingInfo();
00431 if(branch)
00432 return branch->branchingDirections;
00433 else return NULL;
00434 }
00435 const double * getUpPsCosts() const
00436 {
00437 const TMINLP::BranchingInfo * branch = tminlp_->branchingInfo();
00438 if(branch)
00439 return branch->upPsCosts;
00440 else return NULL;
00441 }
00442 const double * getDownPsCosts() const
00443 {
00444 const TMINLP::BranchingInfo * branch = tminlp_->branchingInfo();
00445 if(branch)
00446 return branch->downPsCosts;
00447 else return NULL;
00448 }
00449
00450
00452
00455
00456 virtual const double * getColSolution() const;
00457
00459 virtual const double * getRowPrice() const;
00460
00462 virtual const double * getReducedCost() const;
00463
00466 virtual const double * getRowActivity() const;
00467
00468
00473 virtual int getIterationCount() const;
00474
00476 int nCallOptimizeTNLP()
00477 {
00478 return nCallOptimizeTNLP_;
00479 }
00481 double totalNlpSolveTime()
00482 {
00483 return totalNlpSolveTime_;
00484 }
00486 int totalIterations()
00487 {
00488 return totalIterations_;
00489 }
00490
00491
00493
00497
00500 virtual void setColLower( int elementIndex, double elementValue );
00501
00504 virtual void setColUpper( int elementIndex, double elementValue );
00505
00509 virtual void setColLower(const double * array);
00510
00514 virtual void setColUpper(const double * array);
00515
00516
00519 virtual void setRowLower( int elementIndex, double elementValue );
00520
00523 virtual void setRowUpper( int elementIndex, double elementValue );
00524
00526 virtual void setRowType(int index, char sense, double rightHandSide,
00527 double range);
00528
00529
00534 virtual void setObjSense(double s);
00535
00540 virtual void setColSolution(const double *colsol);
00541
00546 virtual void setRowPrice(const double * rowprice);
00547
00549
00550
00551
00554
00561 virtual CoinWarmStart *getEmptyWarmStart () const;
00562
00564 virtual CoinWarmStart* getWarmStart() const;
00565
00568 virtual bool setWarmStart(const CoinWarmStart* warmstart);
00569
00570 void setExposeWarmStart(bool value) {
00571 exposeWarmStart_ = value;
00572 }
00573
00574 bool getExposeWarmStart() {
00575 return exposeWarmStart_;
00576 }
00577
00578 void randomStartingPoint();
00579
00580
00581 virtual bool basisIsAvailable() const
00582 {
00583
00584 throw SimpleError("Needs coding for this interface", "basisIsAvailable");
00585 }
00586
00587
00589
00590
00594 virtual void setContinuous(int index);
00596 virtual void setInteger(int index);
00598
00599
00600 void setNumIterationSuspect(int value)
00601 {
00602 numIterationSuspect_ = value;
00603 }
00604
00610
00613 virtual int getNumElements() const
00614 {
00615 return -1;
00616 }
00617
00618
00623 virtual const double * getObjCoefficients() const;
00624
00627 virtual const CoinPackedMatrix * getMatrixByRow() const
00628 {
00629 return NULL;
00630 }
00631
00632
00635 virtual const CoinPackedMatrix * getMatrixByCol() const
00636 {
00637 return NULL;
00638 }
00639
00642 virtual void setObjCoeff( int elementIndex, double elementValue )
00643 {
00644 throw SimpleError("OsiTMINLPInterface does not implement this function.",
00645 "setObjCoeff");
00646 }
00647
00650 virtual void addCol(const CoinPackedVectorBase& vec,
00651 const double collb, const double colub,
00652 const double obj)
00653 {
00654 throw SimpleError("OsiTMINLPInterface does not implement this function.",
00655 "addCol");
00656 }
00659 virtual void deleteCols(const int num, const int * colIndices)
00660 {
00661 throw SimpleError("OsiTMINLPInterface does not implement this function.",
00662 "deleteCols");
00663 }
00664
00667 virtual void addRow(const CoinPackedVectorBase& vec,
00668 const double rowlb, const double rowub)
00669 {
00670 throw SimpleError("OsiTMINLPInterface does not implement this function.",
00671 "addRow");
00672 }
00675 virtual void addRow(const CoinPackedVectorBase& vec,
00676 const char rowsen, const double rowrhs,
00677 const double rowrng)
00678 {
00679 throw SimpleError("OsiTMINLPInterface model does not implement this function.",
00680 "addRow");
00681 }
00684 virtual void deleteRows(const int num, const int * rowIndices)
00685 {
00686 if(num)
00687 freeCachedRowRim();
00688 problem_->removeCuts(num, rowIndices);
00689 }
00690
00691
00694 virtual void loadProblem(const CoinPackedMatrix& matrix,
00695 const double* collb, const double* colub,
00696 const double* obj,
00697 const double* rowlb, const double* rowub)
00698 {
00699 throw SimpleError("OsiTMINLPInterface does not implement this function.",
00700 "loadProblem");
00701 }
00702
00703
00706 virtual void assignProblem(CoinPackedMatrix*& matrix,
00707 double*& collb, double*& colub, double*& obj,
00708 double*& rowlb, double*& rowub)
00709 {
00710 throw SimpleError("OsiTMINLPInterface does not implement this function.",
00711 "assignProblem");
00712 }
00713
00716 virtual void loadProblem(const CoinPackedMatrix& matrix,
00717 const double* collb, const double* colub,
00718 const double* obj,
00719 const char* rowsen, const double* rowrhs,
00720 const double* rowrng)
00721 {
00722 throw SimpleError("OsiTMINLPInterface does not implement this function.",
00723 "loadProblem");
00724 }
00725
00728 virtual void assignProblem(CoinPackedMatrix*& matrix,
00729 double*& collb, double*& colub, double*& obj,
00730 char*& rowsen, double*& rowrhs,
00731 double*& rowrng)
00732 {
00733 throw SimpleError("OsiTMINLPInterface does not implement this function.",
00734 "assignProblem");
00735 }
00736
00737
00740 virtual void loadProblem(const int numcols, const int numrows,
00741 const int* start, const int* index,
00742 const double* value,
00743 const double* collb, const double* colub,
00744 const double* obj,
00745 const double* rowlb, const double* rowub)
00746 {
00747 throw SimpleError("OsiTMINLPInterface does not implement this function.",
00748 "loadProblem");
00749 }
00750
00753 virtual void loadProblem(const int numcols, const int numrows,
00754 const int* start, const int* index,
00755 const double* value,
00756 const double* collb, const double* colub,
00757 const double* obj,
00758 const char* rowsen, const double* rowrhs,
00759 const double* rowrng)
00760 {
00761 throw SimpleError("OsiTMINLPInterface model does not implement this function.",
00762 "loadProblem");
00763 }
00764
00767 virtual int readMps(const char *filename,
00768 const char *extension = "mps")
00769 {
00770 throw SimpleError("OsiTMINLPInterface does not implement this function.",
00771 "readMps");
00772 }
00773
00774
00777 virtual void writeMps(const char *filename,
00778 const char *extension = "mps",
00779 double objSense=0.0) const
00780 {
00781 throw SimpleError("OsiTMINLPInterface does not implement this function.",
00782 "writeMps");
00783 }
00784
00786 virtual std::vector<double*> getDualRays(int maxNumRays) const
00787 {
00788 throw SimpleError("OsiTMINLPInterface does not implement this function.",
00789 "getDualRays");
00790 }
00791
00793 virtual std::vector<double*> getPrimalRays(int maxNumRays) const
00794 {
00795 throw SimpleError("OsiTMINLPInterface does not implement this function.",
00796 "getPrimalRays");
00797 }
00798
00800
00801
00802
00803
00804
00805
00806
00810 void setSolverOutputToDefault(){
00811 app_->setOutputToDefault();}
00812 void forceSolverOutput(int log_level){
00813 app_->forceSolverOutput(log_level);}
00815
00818
00819 virtual double getObjValue() const;
00820
00822
00824 const TMINLP2TNLP * problem() const
00825 {
00826 return GetRawPtr(problem_);
00827 }
00828
00829 TMINLP2TNLP * problem()
00830 {
00831 return GetRawPtr(problem_);
00832 }
00833
00834 const TMINLP * model() const
00835 {
00836 return GetRawPtr(tminlp_);
00837 }
00838
00839 Bonmin::TMINLP * model()
00840 {
00841 return GetRawPtr(tminlp_);
00842 }
00843
00844 const Bonmin::TNLPSolver * solver() const
00845 {
00846 return GetRawPtr(app_);
00847 }
00848
00849 TNLPSolver * solver()
00850 {
00851 return GetRawPtr(app_);
00852 }
00861 virtual void extractLinearRelaxation(OsiSolverInterface &si, const double *x,
00862 bool getObj = 1);
00863
00865 virtual void addObjectiveFunction(OsiSolverInterface &si, const double * x);
00866 #if 1
00867
00871 virtual void extractLinearRelaxation(OsiSolverInterface &si, bool getObj = 1,
00872 bool solveNlp = 1){
00873 if(solveNlp)
00874 initialSolve("build initial OA");
00875 extractLinearRelaxation(si, getColSolution(), getObj);
00876 if(solveNlp){
00877 app_->enableWarmStart();
00878 setColSolution(problem()->x_sol());
00879 setRowPrice(problem()->duals_sol());
00880 }
00881 }
00882 #endif
00883
00886 void getOuterApproximation(OsiCuts &cs, int getObj, const double * x2, bool global)
00887 {
00888 getOuterApproximation(cs, getColSolution(), getObj, x2, global);
00889 }
00890
00894 void getOuterApproximation(OsiCuts &cs, const double * x, int getObj, const double * x2, bool global){
00895 getOuterApproximation(cs, x, getObj, x2, 0., global);}
00896
00900 virtual void getOuterApproximation(OsiCuts &cs, const double * x, int getObj, const double * x2,
00901 double theta, bool global);
00902
00904 virtual void getConstraintOuterApproximation(OsiCuts & cs, int constraintNumber,
00905 const double * x,
00906 const double * x2, bool global);
00907
00909 void getConstraintOuterApproximation(OsiCuts & cs, int constraintNumber,
00910 const double * x2, bool global){
00911 getConstraintOuterApproximation(cs, constraintNumber, getColSolution(),x2,global);
00912 }
00913
00914
00916 void getBendersCut(OsiCuts &cs, bool global);
00917
00927 double solveFeasibilityProblem(int n, const double * x_bar, const int* ind, double a, double s, int L);
00928
00937 double solveFeasibilityProblem(int n, const double * x_bar, const int* ind, int L, double cutoff);
00938
00941 void switchToFeasibilityProblem(int n, const double * x_bar, const int* ind, double a, double s, int L);
00942
00945 void switchToFeasibilityProblem(int n, const double * x_bar, const int* ind,
00946 double rhs_local_branching_constraint);
00947
00949 void switchToOriginalProblem();
00950
00952 void round_and_check(double tolerance,
00953 OsiObject ** objects = 0, int nObjects = -1){
00954 if(!problem_->check_solution(objects, nObjects)){
00955 optimizationStatus_ = TNLPSolver::provenInfeasible;
00956 }
00957 }
00959
00964 enum OaMessagesTypes {
00965 CUT_NOT_VIOLATED_ENOUGH = 0,
00966 VIOLATED_OA_CUT_GENERATED,
00967 OA_CUT_GENERATED,
00968 OA_MESSAGES_DUMMY_END};
00970 class OaMessages :public CoinMessages{
00971 public:
00973 OaMessages();
00974 };
00976 class OaMessageHandler : public CoinMessageHandler{
00977 public:
00979 OaMessageHandler():CoinMessageHandler(){
00980 }
00982 OaMessageHandler(FILE * fp):CoinMessageHandler(fp){
00983 }
00985 virtual ~OaMessageHandler(){
00986 }
00988 OaMessageHandler(const OaMessageHandler &other):
00989 CoinMessageHandler(other){}
00991 OaMessageHandler(const CoinMessageHandler &other):
00992 CoinMessageHandler(other){}
00994 OaMessageHandler & operator=(const OaMessageHandler &rhs){
00995 CoinMessageHandler::operator=(rhs);
00996 return *this;}
00998 virtual CoinMessageHandler* clone() const{
00999 return new OaMessageHandler(*this);}
01001 void print(OsiRowCut &row);
01002 };
01003 void setOaMessageHandler(const CoinMessageHandler &handler){
01004 delete oaHandler_;
01005 oaHandler_ = new OaMessageHandler(handler);
01006 }
01008
01009
01012 virtual ApplyCutsReturnCode applyCuts(const OsiCuts & cs,
01013 double effectivenessLb = 0.0){
01014 freeCachedRowRim();
01015 problem_->addCuts(cs);
01016 ApplyCutsReturnCode rc;
01017 return rc;}
01018
01020 virtual void applyRowCuts(int numberCuts, const OsiRowCut * cuts);
01021
01022
01024 virtual void applyRowCuts(int numberCuts, const OsiRowCut ** cuts)
01025 {
01026 if(numberCuts)
01027 freeCachedRowRim();
01028 problem_->addCuts(numberCuts, cuts);
01029 }
01030
01033 double getConstraintsViolation(const double * x, double & obj);
01034
01037 double getNonLinearitiesViolation(const double *x, const double obj);
01038
01039
01040
01041 void extractInterfaceParams();
01042
01043
01045 virtual void setAppDefaultOptions(Ipopt::SmartPtr<Ipopt::OptionsList> Options);
01046
01048 static void registerOptions (Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions);
01049
01050 Ipopt::SmartPtr<Bonmin::RegisteredOptions> regOptions(){
01051 if(IsValid(app_))
01052 return app_->roptions();
01053 else
01054 return NULL;
01055 }
01056
01059
01060 void SetStrongBrachingSolver(Ipopt::SmartPtr<StrongBranchingSolver> strong_branching_solver);
01063 virtual void markHotStart();
01067 virtual void solveFromHotStart();
01070 virtual void unmarkHotStart();
01072
01073 protected:
01074
01076
01077 enum RandomGenerationType{
01078 uniform =0, perturb=1, perturb_suffix=2};
01080 int initializeJacobianArrays();
01081
01083
01084 virtual std::string appName()
01085 {
01086 return "bonmin";
01087 }
01089
01090
01091
01093 void solveAndCheckErrors(bool doResolve, bool throwOnFailure,
01094 const char * whereFrom);
01095
01096
01099 virtual void applyRowCut( const OsiRowCut & rc )
01100 {
01101 const OsiRowCut * cut = &rc;
01102 problem_->addCuts(1, &cut);
01103 }
01106 virtual void applyColCut( const OsiColCut & cc )
01107 {
01108 throw SimpleError("Ipopt model does not implement this function.",
01109 "applyColCut");
01110 }
01111
01112
01113
01114
01116
01120 Ipopt::SmartPtr<TMINLP> tminlp_;
01122 Ipopt::SmartPtr<TMINLP2TNLP> problem_;
01124 Ipopt::SmartPtr<Ipopt::TNLP> problem_to_optimize_;
01126 bool feasibility_mode_;
01128 Ipopt::SmartPtr<TNLPSolver> app_;
01129
01131 std::list<Ipopt::SmartPtr<TNLPSolver> > debug_apps_;
01133 bool testOthers_;
01135
01137 CoinWarmStart* warmstart_;
01138
01142 void freeCachedColRim();
01144 void freeCachedRowRim();
01146 void freeCachedData();
01149 void extractSenseRhsAndRange() const;
01151 mutable char *rowsense_;
01152
01154 mutable double *rhs_;
01155
01157 mutable double *rowrange_;
01160 mutable double *reducedCosts_;
01162 double OsiDualObjectiveLimit_;
01164 mutable bool hasVarNamesFile_;
01166
01167 int nCallOptimizeTNLP_;
01169 double totalNlpSolveTime_;
01171 int totalIterations_;
01173 double maxRandomRadius_;
01175 int randomGenerationType_;
01177 double max_perturbation_;
01179 double pushValue_;
01181 int numRetryInitial_;
01183 int numRetryResolve_;
01185 int numRetryInfeasibles_;
01187 int numRetryUnsolved_;
01188
01189
01190
01192 int dynamicCutOff_;
01194 double coeff_var_threshold_;
01196 double first_perc_for_cutoff_decr_;
01198 double second_perc_for_cutoff_decr_;
01199
01200
01202 Messages messages_;
01206 int pretendFailIsInfeasible_;
01208 bool hasContinuedAfterNlpFailure_;
01211 int numIterationSuspect_ ;
01215 bool hasBeenOptimized_;
01219 mutable double * obj_;
01221 static bool hasPrintedOptions;
01222
01224 Ipopt::SmartPtr<TNLP2FPNLP> feasibilityProblem_;
01225
01226
01230 int * jRow_;
01232 int * jCol_;
01234 double * jValues_;
01236 int nnz_jac;
01238
01240 Ipopt::TNLP::LinearityType * constTypes_;
01243 int nNonLinear_;
01245 double tiny_;
01247 double veryTiny_;
01249 double infty_;
01251 TNLPSolver::ReturnStatus optimizationStatus_;
01253 bool exposeWarmStart_;
01255 bool firstSolve_;
01257 SmartPtr<CutStrengthener> cutStrengthener_;
01258
01263 OaMessages oaMessages_;
01265 OaMessageHandler * oaHandler_;
01267
01268 double newCutoffDecr;
01269 protected:
01271 void createApplication(Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions,
01272 Ipopt::SmartPtr<Ipopt::OptionsList> options,
01273 Ipopt::SmartPtr<Ipopt::Journalist> journalist,
01274 const std::string & prefix);
01276 OsiTMINLPInterface(Ipopt::SmartPtr<TNLPSolver> app);
01277
01279 bool internal_setWarmStart(const CoinWarmStart* ws);
01280
01282 CoinWarmStart* internal_getWarmStart() const;
01283 private:
01285 SmartPtr<StrongBranchingSolver> strong_branching_solver_;
01287 TNLPSolver::ReturnStatus optimizationStatusBeforeHotStart_;
01288 static const char * OPT_SYMB;
01289 static const char * FAILED_SYMB;
01290 static const char * INFEAS_SYMB;
01291 static const char * TIME_SYMB;
01292 static const char * UNBOUND_SYMB;
01294 const char * statusAsString(TNLPSolver::ReturnStatus r){
01295 if(r == TNLPSolver::solvedOptimal || r == TNLPSolver::solvedOptimalTol){
01296 return OPT_SYMB;}
01297 else if(r == TNLPSolver::provenInfeasible){
01298 return INFEAS_SYMB;}
01299 else if(r == TNLPSolver::unbounded){
01300 return UNBOUND_SYMB;}
01301 else if(r == TNLPSolver::timeLimit){
01302 return TIME_SYMB;}
01303 else return FAILED_SYMB;
01304 }
01305 const char * statusAsString(){
01306 return statusAsString(optimizationStatus_);}
01307 };
01308 }
01309 #endif