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 TMINLP2OsiLP;
00031 class TNLP2FPNLP;
00032 class TNLPSolver;
00033 class RegisteredOptions;
00034 class StrongBranchingSolver;
00035
00037 enum Solver{
00038 EIpopt=0 ,
00039 EFilterSQP ,
00040 EAll
00041 };
00048 class OsiTMINLPInterface : public OsiSolverInterface
00049 {
00050 friend class BonminParam;
00051
00052 public:
00053
00054
00055
00060 class SimpleError : public CoinError
00061 {
00062 private:
00063 SimpleError();
00064
00065 public:
00067 SimpleError(std::string message,
00068 std::string methodName,
00069 std::string f = std::string(),
00070 int l = -1)
00071 :
00072 CoinError(message,methodName,std::string("OsiTMINLPInterface"), f, l)
00073 {}
00074 }
00075 ;
00076
00077 #ifdef __LINE__
00078 #define SimpleError(x, y) SimpleError((x), (y), __FILE__, __LINE__)
00079 #endif
00080
00081
00082 TNLPSolver::UnsolvedError * newUnsolvedError(int num, Ipopt::SmartPtr<TMINLP2TNLP> problem, std::string name){
00083 return app_->newUnsolvedError(num, problem, name);
00084 }
00085
00086
00087 enum WarmStartModes{
00088 None,
00089 FakeBasis,
00090 Optimum,
00091 InteriorPoint};
00092
00094 enum MessagesTypes{
00095 SOLUTION_FOUND,
00096 INFEASIBLE_SOLUTION_FOUND,
00097 UNSOLVED_PROBLEM_FOUND,
00098 WARNING_RESOLVING ,
00099 WARN_SUCCESS_WS,
00100 WARN_SUCCESS_RANDOM,
00101 WARN_CONTINUING_ON_FAILURE,
00102 SUSPECT_PROBLEM,
00103 SUSPECT_PROBLEM2,
00104 IPOPT_SUMMARY ,
00105 BETTER_SOL ,
00106 LOG_HEAD,
00107 LOG_FIRST_LINE,
00108 LOG_LINE,
00109 ALTERNATE_OBJECTIVE,
00110 WARN_RESOLVE_BEFORE_INITIAL_SOLVE ,
00113 ERROR_NO_TNLPSOLVER ,
00114 WARNING_NON_CONVEX_OA ,
00115 SOLVER_DISAGREE_STATUS ,
00116 SOLVER_DISAGREE_VALUE ,
00117 OSITMINLPINTERFACE_DUMMY_END
00118 };
00119
00120
00121
00122
00124 class Messages : public CoinMessages
00125 {
00126 public:
00128 Messages();
00129 };
00130
00131
00132
00133
00134
00137
00138 OsiTMINLPInterface();
00139
00141 void initialize(Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions,
00142 Ipopt::SmartPtr<Ipopt::OptionsList> options,
00143 Ipopt::SmartPtr<Ipopt::Journalist> journalist,
00144 const std::string & prefix,
00145 Ipopt::SmartPtr<TMINLP> tminlp);
00146
00148 void initialize(Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions,
00149 Ipopt::SmartPtr<Ipopt::OptionsList> options,
00150 Ipopt::SmartPtr<Ipopt::Journalist> journalist,
00151 Ipopt::SmartPtr<TMINLP> tminlp){
00152 initialize(roptions, options, journalist, "bonmin.", tminlp);
00153 }
00154
00156 void setModel(Ipopt::SmartPtr<TMINLP> tminlp);
00158 void setSolver(Ipopt::SmartPtr<TNLPSolver> app);
00160 void use(Ipopt::SmartPtr<TMINLP2TNLP> tminlp2tnlp);
00163 OsiTMINLPInterface (const OsiTMINLPInterface &);
00164
00166 OsiSolverInterface * clone(bool copyData = true) const;
00167
00169 OsiTMINLPInterface & operator=(const OsiTMINLPInterface& rhs);
00170
00172 virtual ~OsiTMINLPInterface ();
00173
00174
00176 void readOptionFile(const std::string & fileName);
00177
00179 const Ipopt::SmartPtr<Ipopt::OptionsList> options() const;
00181 Ipopt::SmartPtr<Ipopt::OptionsList> options();
00182
00183 const char * prefix() const{
00184 if(!IsValid(app_)) {
00185 messageHandler()->message(ERROR_NO_TNLPSOLVER, messages_)<<CoinMessageEol;
00186 return NULL;
00187 }
00188 else
00189 return app_->prefix();
00190 }
00192
00195
00196 virtual void initialSolve();
00197
00199 virtual void initialSolve(const char * whereFrom);
00200
00206 virtual void resolve();
00207
00213 virtual void resolve(const char * whereFrom);
00214
00217 virtual void resolveForCost(int numretry, bool keepWs);
00218
00222 virtual void resolveForRobustness(int numretry);
00223
00225 virtual void branchAndBound()
00226 {
00227 throw SimpleError("Function not implemented for OsiTMINLPInterface","branchAndBound()");
00228 }
00230
00231
00232
00233
00235
00236
00237 virtual bool isAbandoned() const;
00239 virtual bool isProvenOptimal() const;
00241 virtual bool isProvenPrimalInfeasible() const;
00243 virtual bool isProvenDualInfeasible() const;
00245 virtual bool isPrimalObjectiveLimitReached() const;
00247 virtual bool isDualObjectiveLimitReached() const;
00249 virtual bool isIterationLimitReached() const;
00250
00252 void continuingOnAFailure()
00253 {
00254 hasContinuedAfterNlpFailure_ = true;
00255 }
00256
00257
00258
00259
00260 double getNewCutoffDecr()
00261 {
00262 return newCutoffDecr;
00263 }
00264
00265 void setNewCutoffDecr(double d)
00266 {
00267 newCutoffDecr = d;
00268 }
00269
00270
00272 bool hasContinuedOnAFailure()
00273 {
00274 return hasContinuedAfterNlpFailure_;
00275 }
00277 void ignoreFailures()
00278 {
00279 pretendFailIsInfeasible_ = 2;
00280 }
00282 void forceInfeasible()
00283 {
00284 problem_->set_obj_value(1e200);
00285 }
00287 void forceBranchable()
00288 {
00289 problem_->set_obj_value(-1e200);
00290 problem_->force_fractionnal_sol();
00291 }
00293
00294
00295
00311
00312 bool setIntParam(OsiIntParam key, int value);
00313
00314 bool setDblParam(OsiDblParam key, double value);
00315
00316 bool setStrParam(OsiStrParam key, const std::string & value);
00317
00318 bool getIntParam(OsiIntParam key, int& value) const;
00319
00320 bool getDblParam(OsiDblParam key, double& value) const;
00321
00322 bool getStrParam(OsiStrParam key, std::string& value) const;
00323
00324
00325 inline double getPushFact() const
00326 {
00327 return pushValue_;
00328 }
00329
00331
00332
00333
00346
00347 virtual int getNumCols() const;
00348
00350 virtual int getNumRows() const;
00351
00353 const OsiSolverInterface::OsiNameVec& getVarNames() ;
00355 virtual const double * getColLower() const;
00356
00358 virtual const double * getColUpper() const;
00359
00369 virtual const char * getRowSense() const;
00370
00379 virtual const double * getRightHandSide() const;
00380
00389 virtual const double * getRowRange() const;
00390
00392 virtual const double * getRowLower() const;
00393
00395 virtual const double * getRowUpper() const;
00396
00399 virtual double getObjSense() const
00400 {
00401 return 1;
00402 }
00403
00405 virtual bool isContinuous(int colNumber) const;
00406
00408 virtual bool isBinary(int columnNumber) const;
00409
00414 virtual bool isInteger(int columnNumber) const;
00415
00417 virtual bool isIntegerNonBinary(int columnNumber) const;
00418
00420 virtual bool isFreeBinary(int columnNumber) const;
00421
00423 virtual double getInfinity() const;
00424
00426 const int * getPriorities() const
00427 {
00428 const TMINLP::BranchingInfo * branch = tminlp_->branchingInfo();
00429 if(branch)
00430 return branch->priorities;
00431 else return NULL;
00432 }
00434 const int * getBranchingDirections() const
00435 {
00436 const TMINLP::BranchingInfo * branch = tminlp_->branchingInfo();
00437 if(branch)
00438 return branch->branchingDirections;
00439 else return NULL;
00440 }
00441 const double * getUpPsCosts() const
00442 {
00443 const TMINLP::BranchingInfo * branch = tminlp_->branchingInfo();
00444 if(branch)
00445 return branch->upPsCosts;
00446 else return NULL;
00447 }
00448 const double * getDownPsCosts() const
00449 {
00450 const TMINLP::BranchingInfo * branch = tminlp_->branchingInfo();
00451 if(branch)
00452 return branch->downPsCosts;
00453 else return NULL;
00454 }
00455
00456
00458
00461
00462 virtual const double * getColSolution() const;
00463
00465 virtual const double * getRowPrice() const;
00466
00468 virtual const double * getReducedCost() const;
00469
00472 virtual const double * getRowActivity() const;
00473
00474
00479 virtual int getIterationCount() const;
00480
00482 int nCallOptimizeTNLP()
00483 {
00484 return nCallOptimizeTNLP_;
00485 }
00487 double totalNlpSolveTime()
00488 {
00489 return totalNlpSolveTime_;
00490 }
00492 int totalIterations()
00493 {
00494 return totalIterations_;
00495 }
00496
00497
00499
00503
00506 virtual void setColLower( int elementIndex, double elementValue );
00507
00510 virtual void setColUpper( int elementIndex, double elementValue );
00511
00515 virtual void setColLower(const double * array);
00516
00520 virtual void setColUpper(const double * array);
00521
00522
00525 virtual void setRowLower( int elementIndex, double elementValue );
00526
00529 virtual void setRowUpper( int elementIndex, double elementValue );
00530
00532 virtual void setRowType(int index, char sense, double rightHandSide,
00533 double range);
00534
00535
00540 virtual void setObjSense(double s);
00541
00546 virtual void setColSolution(const double *colsol);
00547
00552 virtual void setRowPrice(const double * rowprice);
00553
00555
00556
00557
00560
00567 virtual CoinWarmStart *getEmptyWarmStart () const;
00568
00570 virtual CoinWarmStart* getWarmStart() const;
00571
00574 virtual bool setWarmStart(const CoinWarmStart* warmstart);
00575
00576 void setWarmStartMode(int mode) {
00577 warmStartMode_ = (WarmStartModes) mode;
00578 }
00579 WarmStartModes getWarmStartMode() {
00580 return warmStartMode_;
00581 }
00582
00583 void randomStartingPoint();
00584
00585
00586 virtual bool basisIsAvailable() const
00587 {
00588
00589 throw SimpleError("Needs coding for this interface", "basisIsAvailable");
00590 }
00591
00592
00594
00595
00599 virtual void setContinuous(int index);
00601 virtual void setInteger(int index);
00603
00604
00605 void setNumIterationSuspect(int value)
00606 {
00607 numIterationSuspect_ = value;
00608 }
00609
00615
00618 virtual int getNumElements() const
00619 {
00620 return -1;
00621 }
00622
00623
00628 virtual const double * getObjCoefficients() const;
00629
00632 virtual const CoinPackedMatrix * getMatrixByRow() const
00633 {
00634 return NULL;
00635 }
00636
00637
00640 virtual const CoinPackedMatrix * getMatrixByCol() const
00641 {
00642 return NULL;
00643 }
00644
00647 virtual void setObjCoeff( int elementIndex, double elementValue )
00648 {
00649 throw SimpleError("OsiTMINLPInterface does not implement this function.",
00650 "setObjCoeff");
00651 }
00652
00655 virtual void addCol(const CoinPackedVectorBase& vec,
00656 const double collb, const double colub,
00657 const double obj)
00658 {
00659 throw SimpleError("OsiTMINLPInterface does not implement this function.",
00660 "addCol");
00661 }
00664 virtual void deleteCols(const int num, const int * colIndices)
00665 {
00666 throw SimpleError("OsiTMINLPInterface does not implement this function.",
00667 "deleteCols");
00668 }
00669
00672 virtual void addRow(const CoinPackedVectorBase& vec,
00673 const double rowlb, const double rowub)
00674 {
00675 throw SimpleError("OsiTMINLPInterface does not implement this function.",
00676 "addRow");
00677 }
00680 virtual void addRow(const CoinPackedVectorBase& vec,
00681 const char rowsen, const double rowrhs,
00682 const double rowrng)
00683 {
00684 throw SimpleError("OsiTMINLPInterface model does not implement this function.",
00685 "addRow");
00686 }
00689 virtual void deleteRows(const int num, const int * rowIndices)
00690 {
00691 if(num)
00692 freeCachedRowRim();
00693 problem_->removeCuts(num, rowIndices);
00694 }
00695
00696
00699 virtual void loadProblem(const CoinPackedMatrix& matrix,
00700 const double* collb, const double* colub,
00701 const double* obj,
00702 const double* rowlb, const double* rowub)
00703 {
00704 throw SimpleError("OsiTMINLPInterface does not implement this function.",
00705 "loadProblem");
00706 }
00707
00708
00711 virtual void assignProblem(CoinPackedMatrix*& matrix,
00712 double*& collb, double*& colub, double*& obj,
00713 double*& rowlb, double*& rowub)
00714 {
00715 throw SimpleError("OsiTMINLPInterface does not implement this function.",
00716 "assignProblem");
00717 }
00718
00721 virtual void loadProblem(const CoinPackedMatrix& matrix,
00722 const double* collb, const double* colub,
00723 const double* obj,
00724 const char* rowsen, const double* rowrhs,
00725 const double* rowrng)
00726 {
00727 throw SimpleError("OsiTMINLPInterface does not implement this function.",
00728 "loadProblem");
00729 }
00730
00733 virtual void assignProblem(CoinPackedMatrix*& matrix,
00734 double*& collb, double*& colub, double*& obj,
00735 char*& rowsen, double*& rowrhs,
00736 double*& rowrng)
00737 {
00738 throw SimpleError("OsiTMINLPInterface does not implement this function.",
00739 "assignProblem");
00740 }
00741
00742
00745 virtual void loadProblem(const int numcols, const int numrows,
00746 const int* start, const int* index,
00747 const double* value,
00748 const double* collb, const double* colub,
00749 const double* obj,
00750 const double* rowlb, const double* rowub)
00751 {
00752 throw SimpleError("OsiTMINLPInterface does not implement this function.",
00753 "loadProblem");
00754 }
00755
00758 virtual void loadProblem(const int numcols, const int numrows,
00759 const int* start, const int* index,
00760 const double* value,
00761 const double* collb, const double* colub,
00762 const double* obj,
00763 const char* rowsen, const double* rowrhs,
00764 const double* rowrng)
00765 {
00766 throw SimpleError("OsiTMINLPInterface model does not implement this function.",
00767 "loadProblem");
00768 }
00769
00772 virtual int readMps(const char *filename,
00773 const char *extension = "mps")
00774 {
00775 throw SimpleError("OsiTMINLPInterface does not implement this function.",
00776 "readMps");
00777 }
00778
00779
00782 virtual void writeMps(const char *filename,
00783 const char *extension = "mps",
00784 double objSense=0.0) const
00785 {
00786 throw SimpleError("OsiTMINLPInterface does not implement this function.",
00787 "writeMps");
00788 }
00789
00791 virtual std::vector<double*> getDualRays(int maxNumRays, bool fullRay = false) const
00792 {
00793 throw SimpleError("OsiTMINLPInterface does not implement this function.",
00794 "getDualRays");
00795 }
00796
00798 virtual std::vector<double*> getPrimalRays(int maxNumRays) const
00799 {
00800 throw SimpleError("OsiTMINLPInterface does not implement this function.",
00801 "getPrimalRays");
00802 }
00803
00805
00806
00807
00808
00809
00810
00811
00815 void setSolverOutputToDefault(){
00816 app_->setOutputToDefault();}
00817 void forceSolverOutput(int log_level){
00818 app_->forceSolverOutput(log_level);}
00820
00823
00824 virtual double getObjValue() const;
00825
00827
00829 const TMINLP2TNLP * problem() const
00830 {
00831 return GetRawPtr(problem_);
00832 }
00833
00834 TMINLP2TNLP * problem()
00835 {
00836 return GetRawPtr(problem_);
00837 }
00838
00839 const TMINLP * model() const
00840 {
00841 return GetRawPtr(tminlp_);
00842 }
00843
00844 Bonmin::TMINLP * model()
00845 {
00846 return GetRawPtr(tminlp_);
00847 }
00848
00849 const Bonmin::TNLPSolver * solver() const
00850 {
00851 return GetRawPtr(app_);
00852 }
00853
00854 const std::list<Ipopt::SmartPtr<TNLPSolver> >& debug_apps() const{
00855 return debug_apps_;
00856 }
00857
00858 TNLPSolver * solver()
00859 {
00860 return GetRawPtr(app_);
00861 }
00870 virtual void extractLinearRelaxation(OsiSolverInterface &si, const double *x,
00871 bool getObj = 1);
00872
00874 virtual void addObjectiveFunction(OsiSolverInterface &si, const double * x);
00875 #if 1
00876
00880 virtual void extractLinearRelaxation(OsiSolverInterface &si, bool getObj = 1,
00881 bool solveNlp = 1){
00882 if(solveNlp)
00883 initialSolve("build initial OA");
00884 extractLinearRelaxation(si, getColSolution(), getObj);
00885 if(solveNlp){
00886 app_->enableWarmStart();
00887 setColSolution(problem()->x_sol());
00888 setRowPrice(problem()->duals_sol());
00889 }
00890 }
00891 #endif
00892
00895 void getOuterApproximation(OsiCuts &cs, int getObj, const double * x2, bool global)
00896 {
00897 getOuterApproximation(cs, getColSolution(), getObj, x2, global);
00898 }
00899
00903 void getOuterApproximation(OsiCuts &cs, const double * x, int getObj, const double * x2, bool global){
00904 getOuterApproximation(cs, x, getObj, x2, 0., global);}
00905
00909 virtual void getOuterApproximation(OsiCuts &cs, const double * x, int getObj, const double * x2,
00910 double theta, bool global);
00911
00913 virtual void getConstraintOuterApproximation(OsiCuts & cs, int constraintNumber,
00914 const double * x,
00915 const double * x2, bool global);
00916
00918 void getConstraintOuterApproximation(OsiCuts & cs, int constraintNumber,
00919 const double * x2, bool global){
00920 getConstraintOuterApproximation(cs, constraintNumber, getColSolution(),x2,global);
00921 }
00922
00923
00925 void getBendersCut(OsiCuts &cs, bool global);
00926
00936 double solveFeasibilityProblem(size_t n, const double * x_bar, const int* ind, double a, double s, int L);
00937
00946 double solveFeasibilityProblem(size_t n, const double * x_bar, const int* ind, int L, double cutoff);
00947
00950 void switchToFeasibilityProblem(size_t n, const double * x_bar, const int* ind, double a, double s, int L);
00951
00954 void switchToFeasibilityProblem(size_t n, const double * x_bar, const int* ind,
00955 double rhs_local_branching_constraint);
00956
00958 void switchToOriginalProblem();
00959
00961 void round_and_check(double tolerance,
00962 OsiObject ** objects = 0, int nObjects = -1){
00963 if(!problem_->check_solution(objects, nObjects)){
00964 optimizationStatus_ = TNLPSolver::provenInfeasible;
00965 }
00966 }
00968
00973 enum OaMessagesTypes {
00974 CUT_NOT_VIOLATED_ENOUGH = 0,
00975 VIOLATED_OA_CUT_GENERATED,
00976 OA_CUT_GENERATED,
00977 OA_MESSAGES_DUMMY_END};
00979 class OaMessages :public CoinMessages{
00980 public:
00982 OaMessages();
00983 };
00985 class OaMessageHandler : public CoinMessageHandler{
00986 public:
00988 OaMessageHandler():CoinMessageHandler(){
00989 }
00991 OaMessageHandler(FILE * fp):CoinMessageHandler(fp){
00992 }
00994 virtual ~OaMessageHandler(){
00995 }
00997 OaMessageHandler(const OaMessageHandler &other):
00998 CoinMessageHandler(other){}
01000 OaMessageHandler(const CoinMessageHandler &other):
01001 CoinMessageHandler(other){}
01003 OaMessageHandler & operator=(const OaMessageHandler &rhs){
01004 CoinMessageHandler::operator=(rhs);
01005 return *this;}
01007 virtual CoinMessageHandler* clone() const{
01008 return new OaMessageHandler(*this);}
01010 void print(OsiRowCut &row);
01011 };
01012 void setOaMessageHandler(const CoinMessageHandler &handler){
01013 delete oaHandler_;
01014 oaHandler_ = new OaMessageHandler(handler);
01015 }
01017
01018
01021 virtual ApplyCutsReturnCode applyCuts(const OsiCuts & cs,
01022 double effectivenessLb = 0.0){
01023 freeCachedRowRim();
01024 problem_->addCuts(cs);
01025 ApplyCutsReturnCode rc;
01026 return rc;}
01027
01029 virtual void applyRowCuts(int numberCuts, const OsiRowCut * cuts);
01030
01031
01033 virtual void applyRowCuts(int numberCuts, const OsiRowCut ** cuts)
01034 {
01035 if(numberCuts)
01036 freeCachedRowRim();
01037 problem_->addCuts(numberCuts, cuts);
01038 }
01039
01042 double getConstraintsViolation(const double * x, double & obj);
01043
01046 double getNonLinearitiesViolation(const double *x, const double obj);
01047
01048
01049
01050 void extractInterfaceParams();
01051
01052
01054 virtual void setAppDefaultOptions(Ipopt::SmartPtr<Ipopt::OptionsList> Options);
01055
01057 static void registerOptions (Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions);
01058
01059 Ipopt::SmartPtr<Bonmin::RegisteredOptions> regOptions(){
01060 if(IsValid(app_))
01061 return app_->roptions();
01062 else
01063 return NULL;
01064 }
01065
01068
01069 void SetStrongBrachingSolver(Ipopt::SmartPtr<StrongBranchingSolver> strong_branching_solver);
01072 virtual void markHotStart();
01076 virtual void solveFromHotStart();
01079 virtual void unmarkHotStart();
01081
01083 void get_tolerances(double &tiny, double&very_tiny, double &rhsRelax, double &infty){
01084 tiny = tiny_;
01085 very_tiny = veryTiny_;
01086 rhsRelax = rhsRelax_;
01087 infty = infty_;
01088 }
01089
01090 void set_linearizer(Ipopt::SmartPtr<TMINLP2OsiLP> linearizer);
01091
01092 Ipopt::SmartPtr<TMINLP2OsiLP> linearizer();
01093 protected:
01094
01096
01097 enum RandomGenerationType{
01098 uniform =0, perturb=1, perturb_suffix=2};
01100 int initializeJacobianArrays();
01101
01103
01104 virtual std::string appName()
01105 {
01106 return "bonmin";
01107 }
01109
01110
01111
01113 void solveAndCheckErrors(bool doResolve, bool throwOnFailure,
01114 const char * whereFrom);
01115
01116
01119 virtual void applyRowCut( const OsiRowCut & rc )
01120 {
01121 const OsiRowCut * cut = &rc;
01122 problem_->addCuts(1, &cut);
01123 }
01126 virtual void applyColCut( const OsiColCut & cc )
01127 {
01128 throw SimpleError("Ipopt model does not implement this function.",
01129 "applyColCut");
01130 }
01131
01132
01133
01134
01136
01140 Ipopt::SmartPtr<TMINLP> tminlp_;
01142 Ipopt::SmartPtr<TMINLP2TNLP> problem_;
01144 Ipopt::SmartPtr<Ipopt::TNLP> problem_to_optimize_;
01146 bool feasibility_mode_;
01148 Ipopt::SmartPtr<TNLPSolver> app_;
01149
01151 std::list<Ipopt::SmartPtr<TNLPSolver> > debug_apps_;
01153 bool testOthers_;
01155
01157 CoinWarmStart* warmstart_;
01158
01162 void freeCachedColRim();
01164 void freeCachedRowRim();
01166 void freeCachedData();
01169 void extractSenseRhsAndRange() const;
01171 mutable char *rowsense_;
01172
01174 mutable double *rhs_;
01175
01177 mutable double *rowrange_;
01180 mutable double *reducedCosts_;
01182 double OsiDualObjectiveLimit_;
01184 mutable bool hasVarNamesFile_;
01186
01187 int nCallOptimizeTNLP_;
01189 double totalNlpSolveTime_;
01191 int totalIterations_;
01193 double maxRandomRadius_;
01195 int randomGenerationType_;
01197 double max_perturbation_;
01199 double pushValue_;
01201 int numRetryInitial_;
01203 int numRetryResolve_;
01205 int numRetryInfeasibles_;
01207 int numRetryUnsolved_;
01209 double infeasibility_epsilon_;
01210
01211
01212
01214 int dynamicCutOff_;
01216 double coeff_var_threshold_;
01218 double first_perc_for_cutoff_decr_;
01220 double second_perc_for_cutoff_decr_;
01221
01222
01224 Messages messages_;
01228 int pretendFailIsInfeasible_;
01229
01230 mutable int pretendSucceededNext_;
01231
01233 bool hasContinuedAfterNlpFailure_;
01236 int numIterationSuspect_ ;
01240 bool hasBeenOptimized_;
01244 mutable double * obj_;
01246 static bool hasPrintedOptions;
01247
01249 Ipopt::SmartPtr<TNLP2FPNLP> feasibilityProblem_;
01250
01252 Ipopt::SmartPtr<TMINLP2OsiLP> linearizer_;
01253
01257 int * jRow_;
01259 int * jCol_;
01261 double * jValues_;
01263 int nnz_jac;
01265
01267 Ipopt::TNLP::LinearityType * constTypes_;
01270 int nNonLinear_;
01272 double tiny_;
01274 double veryTiny_;
01276 double rhsRelax_;
01278 double infty_;
01280 TNLPSolver::ReturnStatus optimizationStatus_;
01282 WarmStartModes warmStartMode_;
01284 bool firstSolve_;
01286 Ipopt::SmartPtr<CutStrengthener> cutStrengthener_;
01287
01292 OaMessages oaMessages_;
01294 OaMessageHandler * oaHandler_;
01296
01297 double newCutoffDecr;
01298 protected:
01300 void createApplication(Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions,
01301 Ipopt::SmartPtr<Ipopt::OptionsList> options,
01302 Ipopt::SmartPtr<Ipopt::Journalist> journalist,
01303 const std::string & prefix);
01305 OsiTMINLPInterface(Ipopt::SmartPtr<TNLPSolver> app);
01306
01308 bool internal_setWarmStart(const CoinWarmStart* ws);
01309
01311 CoinWarmStart* internal_getWarmStart() const;
01312
01314 CoinWarmStart* build_fake_basis() const;
01315 private:
01316
01318 Ipopt::SmartPtr<StrongBranchingSolver> strong_branching_solver_;
01320 TNLPSolver::ReturnStatus optimizationStatusBeforeHotStart_;
01321 static const char * OPT_SYMB;
01322 static const char * FAILED_SYMB;
01323 static const char * INFEAS_SYMB;
01324 static const char * TIME_SYMB;
01325 static const char * UNBOUND_SYMB;
01327 const char * statusAsString(TNLPSolver::ReturnStatus r){
01328 if(r == TNLPSolver::solvedOptimal || r == TNLPSolver::solvedOptimalTol){
01329 return OPT_SYMB;}
01330 else if(r == TNLPSolver::provenInfeasible){
01331 return INFEAS_SYMB;}
01332 else if(r == TNLPSolver::unbounded){
01333 return UNBOUND_SYMB;}
01334 else if(r == TNLPSolver::timeLimit){
01335 return TIME_SYMB;}
01336 else return FAILED_SYMB;
01337 }
01338 const char * statusAsString(){
01339 return statusAsString(optimizationStatus_);}
01340 };
01341 }
01342 #endif