/home/coin/SVN-release/OS-2.0.0/Bonmin/src/Interfaces/BonOsiTMINLPInterface.hpp

Go to the documentation of this file.
00001 // (C) Copyright International Business Machines Corporation, Carnegie Mellon University 2004, 2007
00002 // All Rights Reserved.
00003 // This code is published under the Common Public License.
00004 //
00005 // Authors :
00006 // Pierre Bonami, Carnegie Mellon University,
00007 // Carl D. Laird, Carnegie Mellon University,
00008 // Andreas Waechter, International Business Machines Corporation
00009 //
00010 // Date : 12/01/2004
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 "BonTMINLP.hpp"
00025 #include "BonTMINLP2TNLP.hpp"
00026 #include "BonTNLP2FPNLP.hpp"
00027 #include "BonTNLPSolver.hpp"
00028 #include "BonCutStrengthener.hpp"
00029 //#include "BonRegisteredOptions.hpp"
00030 
00031 namespace Bonmin {
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   // Error when problem is not solved
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                   Ipopt::SmartPtr<TMINLP> tminlp);
00139 
00141   void setModel(Ipopt::SmartPtr<TMINLP> tminlp);
00143   void setSolver(Ipopt::SmartPtr<TNLPSolver> app);
00145   void use(Ipopt::SmartPtr<TMINLP2TNLP> tminlp2tnlp){
00146      problem_ = tminlp2tnlp;}
00149   OsiTMINLPInterface (const OsiTMINLPInterface &);
00150 
00152   OsiSolverInterface * clone(bool copyData = true) const;
00153 
00155   OsiTMINLPInterface & operator=(const OsiTMINLPInterface& rhs);
00156 
00158   virtual ~OsiTMINLPInterface ();
00159 
00160 
00162   void readOptionFile(const std::string & fileName);
00163 
00165   const Ipopt::SmartPtr<Ipopt::OptionsList> options() const;
00167   Ipopt::SmartPtr<Ipopt::OptionsList> options();
00168 
00169   //---------------------------------------------------------------------------
00172 
00173   virtual void initialSolve();
00174 
00180   virtual void resolve();
00181 
00184   virtual void resolveForCost(int numretry, bool keepWs);
00185 
00189   virtual void resolveForRobustness(int numretry);
00190 
00192   virtual void branchAndBound()
00193   {
00194     throw SimpleError("Function not implemented for OsiTMINLPInterface","branchAndBound()");
00195   }
00197 
00198 
00199 
00200   //---------------------------------------------------------------------------
00202 
00203 
00204   virtual bool isAbandoned() const;
00206   virtual bool isProvenOptimal() const;
00208   virtual bool isProvenPrimalInfeasible() const;
00210   virtual bool isProvenDualInfeasible() const;
00212   virtual bool isPrimalObjectiveLimitReached() const;
00214   virtual bool isDualObjectiveLimitReached() const;
00216   virtual bool isIterationLimitReached() const;
00217 
00219   void continuingOnAFailure()
00220   {
00221     hasContinuedAfterNlpFailure_ = true;
00222   }
00224   bool hasContinuedOnAFailure()
00225   {
00226     return hasContinuedAfterNlpFailure_;
00227   }
00229   void ignoreFailures()
00230   {
00231     pretendFailIsInfeasible_ = 2;
00232   }
00234   void forceInfeasible()
00235   {
00236     problem_->set_obj_value(1e200);
00237   }
00239   void forceBranchable()
00240   {
00241     problem_->set_obj_value(-1e200);
00242     problem_->force_fractionnal_sol();
00243   }
00245 
00246 
00247   //---------------------------------------------------------------------------
00263   // Set an integer parameter
00264   bool setIntParam(OsiIntParam key, int value);
00265   // Set an double parameter
00266   bool setDblParam(OsiDblParam key, double value);
00267   // Set a string parameter
00268   bool setStrParam(OsiStrParam key, const std::string & value);
00269   // Get an integer parameter
00270   bool getIntParam(OsiIntParam key, int& value) const;
00271   // Get an double parameter
00272   bool getDblParam(OsiDblParam key, double& value) const;
00273   // Get a string parameter
00274   bool getStrParam(OsiStrParam key, std::string& value) const;
00275 
00276   // Get the push values for starting point
00277   inline double getPushFact() const
00278   {
00279     return pushValue_;
00280   }
00281 
00283 
00284 
00285   //---------------------------------------------------------------------------
00300 
00301   virtual int getNumCols() const;
00302 
00304   virtual int getNumRows() const;
00305 
00307   const OsiSolverInterface::OsiNameVec& getVarNames() ;
00309   virtual const double * getColLower() const;
00310 
00312   virtual const double * getColUpper() const;
00313 
00323   virtual const char * getRowSense() const;
00324 
00333   virtual const double * getRightHandSide() const;
00334 
00343   virtual const double * getRowRange() const;
00344 
00346   virtual const double * getRowLower() const;
00347 
00349   virtual const double * getRowUpper() const;
00350 
00353   virtual double getObjSense() const
00354   {
00355     return 1;
00356   }
00357 
00359   virtual bool isContinuous(int colNumber) const;
00360 
00362   virtual bool isBinary(int columnNumber) const;
00363 
00368   virtual bool isInteger(int columnNumber) const;
00369 
00371   virtual bool isIntegerNonBinary(int columnNumber) const;
00372 
00374   virtual bool isFreeBinary(int columnNumber) const;
00375 
00377   virtual double getInfinity() const;
00378 
00380   const int * getPriorities() const
00381   {
00382     const TMINLP::BranchingInfo * branch = tminlp_->branchingInfo();
00383     if(branch)
00384       return branch->priorities;
00385     else return NULL;
00386   }
00388   const int * getBranchingDirections() const
00389   {
00390     const TMINLP::BranchingInfo * branch = tminlp_->branchingInfo();
00391     if(branch)
00392       return branch->branchingDirections;
00393     else return NULL;
00394   }
00395   const double * getUpPsCosts() const
00396   {
00397     const TMINLP::BranchingInfo * branch = tminlp_->branchingInfo();
00398     if(branch)
00399     return branch->upPsCosts;
00400     else return NULL;
00401   }
00402   const double * getDownPsCosts() const
00403   {
00404     const TMINLP::BranchingInfo * branch = tminlp_->branchingInfo();
00405     if(branch)
00406     return branch->downPsCosts;
00407     else return NULL;
00408   }
00409 
00410 
00412 
00415 
00416   virtual const double * getColSolution() const;
00417 
00419   virtual const double * getRowPrice() const;
00420 
00422   virtual const double * getReducedCost() const;
00423 
00426   virtual const double * getRowActivity() const;
00427 
00428 
00433   virtual int getIterationCount() const;
00434 
00436   int nCallOptimizeTNLP()
00437   {
00438     return nCallOptimizeTNLP_;
00439   }
00441   double totalNlpSolveTime()
00442   {
00443     return totalNlpSolveTime_;
00444   }
00446   int totalIterations()
00447   {
00448     return totalIterations_;
00449   }
00450 
00451 
00453   //-------------------------------------------------------------------------
00457 
00460   virtual void setColLower( int elementIndex, double elementValue );
00461 
00464   virtual void setColUpper( int elementIndex, double elementValue );
00465 
00469   virtual void setColLower(const double * array);
00470 
00474   virtual void setColUpper(const double * array);
00475 
00476 
00479   virtual void setRowLower( int elementIndex, double elementValue );
00480 
00483   virtual void setRowUpper( int elementIndex, double elementValue );
00484 
00486   virtual void setRowType(int index, char sense, double rightHandSide,
00487       double range);
00488 
00489 
00494   virtual void setObjSense(double s);
00495 
00500   virtual void setColSolution(const double *colsol);
00501 
00506   virtual void setRowPrice(const double * rowprice);
00507 
00509 
00510 
00511   //---------------------------------------------------------------------------
00514 
00521   virtual CoinWarmStart *getEmptyWarmStart () const;
00522 
00524   virtual CoinWarmStart* getWarmStart() const;
00525 
00528   virtual bool setWarmStart(const CoinWarmStart* warmstart);
00529 
00530   void setExposeWarmStart(bool value) {
00531     exposeWarmStart_ = value;
00532   }
00533 
00534   bool getExposeWarmStart() {
00535     return exposeWarmStart_;
00536   }
00537 
00538   void randomStartingPoint();
00539 
00540   //Returns true if a basis is available
00541   virtual bool basisIsAvailable() const
00542   {
00543     // Throw an exception
00544     throw SimpleError("Needs coding for this interface", "basisIsAvailable");
00545   }
00546 
00547 
00549 
00550   //-------------------------------------------------------------------------
00554   virtual void setContinuous(int index);
00556   virtual void setInteger(int index);
00558 
00559   //Set numIterationSuspect_
00560   void setNumIterationSuspect(int value)
00561   {
00562     numIterationSuspect_ = value;
00563   }
00564 
00570 
00573   virtual int getNumElements() const
00574   {
00575     return -1;
00576   }
00577 
00578 
00583   virtual const double * getObjCoefficients() const;
00584 
00587   virtual const CoinPackedMatrix * getMatrixByRow() const
00588   {
00589       return NULL;
00590   }
00591 
00592 
00595   virtual const CoinPackedMatrix * getMatrixByCol() const
00596   {
00597       return NULL;
00598   }
00599 
00602   virtual void setObjCoeff( int elementIndex, double elementValue )
00603   {
00604     throw SimpleError("OsiTMINLPInterface does not implement this function.",
00605         "setObjCoeff");
00606   }
00607 
00610   virtual void addCol(const CoinPackedVectorBase& vec,
00611       const double collb, const double colub,
00612       const double obj)
00613   {
00614     throw SimpleError("OsiTMINLPInterface does not implement this function.",
00615         "addCol");
00616   }
00619   virtual void deleteCols(const int num, const int * colIndices)
00620   {
00621     throw SimpleError("OsiTMINLPInterface does not implement this function.",
00622         "deleteCols");
00623   }
00624 
00627   virtual void addRow(const CoinPackedVectorBase& vec,
00628       const double rowlb, const double rowub)
00629   {
00630     throw SimpleError("OsiTMINLPInterface does not implement this function.",
00631         "addRow");
00632   }
00635   virtual void addRow(const CoinPackedVectorBase& vec,
00636       const char rowsen, const double rowrhs,
00637       const double rowrng)
00638   {
00639     throw SimpleError("OsiTMINLPInterface model does not implement this function.",
00640         "addRow");
00641   }
00644   virtual void deleteRows(const int num, const int * rowIndices)
00645   {
00646     if(num)
00647       freeCachedRowRim();
00648      problem_->removeCuts(num, rowIndices);
00649   }
00650 
00651 
00654   virtual void loadProblem(const CoinPackedMatrix& matrix,
00655       const double* collb, const double* colub,
00656       const double* obj,
00657       const double* rowlb, const double* rowub)
00658   {
00659     throw SimpleError("OsiTMINLPInterface does not implement this function.",
00660         "loadProblem");
00661   }
00662 
00663 
00666   virtual void assignProblem(CoinPackedMatrix*& matrix,
00667       double*& collb, double*& colub, double*& obj,
00668       double*& rowlb, double*& rowub)
00669   {
00670     throw SimpleError("OsiTMINLPInterface does not implement this function.",
00671         "assignProblem");
00672   }
00673 
00676   virtual void loadProblem(const CoinPackedMatrix& matrix,
00677       const double* collb, const double* colub,
00678       const double* obj,
00679       const char* rowsen, const double* rowrhs,
00680       const double* rowrng)
00681   {
00682     throw SimpleError("OsiTMINLPInterface does not implement this function.",
00683         "loadProblem");
00684   }
00685 
00688   virtual void assignProblem(CoinPackedMatrix*& matrix,
00689       double*& collb, double*& colub, double*& obj,
00690       char*& rowsen, double*& rowrhs,
00691       double*& rowrng)
00692   {
00693     throw SimpleError("OsiTMINLPInterface does not implement this function.",
00694         "assignProblem");
00695   }
00696 
00697 
00700   virtual void loadProblem(const int numcols, const int numrows,
00701       const int* start, const int* index,
00702       const double* value,
00703       const double* collb, const double* colub,
00704       const double* obj,
00705       const double* rowlb, const double* rowub)
00706   {
00707     throw SimpleError("OsiTMINLPInterface does not implement this function.",
00708         "loadProblem");
00709   }
00710 
00713   virtual void loadProblem(const int numcols, const int numrows,
00714       const int* start, const int* index,
00715       const double* value,
00716       const double* collb, const double* colub,
00717       const double* obj,
00718       const char* rowsen, const double* rowrhs,
00719       const double* rowrng)
00720   {
00721     throw SimpleError("OsiTMINLPInterface model does not implement this function.",
00722         "loadProblem");
00723   }
00724 
00727   virtual int readMps(const char *filename,
00728       const char *extension = "mps")
00729   {
00730     throw SimpleError("OsiTMINLPInterface does not implement this function.",
00731         "readMps");
00732   }
00733 
00734 
00737   virtual void writeMps(const char *filename,
00738       const char *extension = "mps",
00739       double objSense=0.0) const
00740   {
00741     throw SimpleError("OsiTMINLPInterface does not implement this function.",
00742         "writeMps");
00743   }
00744 
00746   virtual std::vector<double*> getDualRays(int maxNumRays) const
00747   {
00748     throw SimpleError("OsiTMINLPInterface does not implement this function.",
00749         "getDualRays");
00750   }
00751 
00753   virtual std::vector<double*> getPrimalRays(int maxNumRays) const
00754   {
00755     throw SimpleError("OsiTMINLPInterface does not implement this function.",
00756         "getPrimalRays");
00757   }
00758 
00760 
00761 
00762   
00763   //---------------------------------------------------------------------------
00764 
00765 
00766 
00770   void turnOffSolverOutput(){
00771   app_->turnOffOutput();}
00772   void turnOnSolverOutput(){
00773   app_->turnOnOutput();}
00775 
00778 
00779   virtual double getObjValue() const;
00780 
00782 
00784   const TMINLP2TNLP * problem() const
00785   {
00786     return GetRawPtr(problem_);
00787   }
00788 
00789   TMINLP2TNLP * problem()
00790   {
00791     return GetRawPtr(problem_);
00792   }
00793 
00794   const TMINLP * model() const
00795   {
00796     return GetRawPtr(tminlp_);
00797   }
00798   
00799   Bonmin::TMINLP * model()
00800   {
00801     return GetRawPtr(tminlp_);
00802   }
00803   
00804   const Bonmin::TNLPSolver * solver() const
00805   {
00806     return GetRawPtr(app_);
00807   } 
00808  
00809   TNLPSolver * solver()
00810   {
00811     return GetRawPtr(app_);
00812   } 
00821   virtual void extractLinearRelaxation(OsiSolverInterface &si, const double *x, 
00822                                        bool getObj = 1);
00823 
00828   virtual void extractLinearRelaxation(OsiSolverInterface &si, bool getObj = 1,
00829                                        bool solveNlp = 1){
00830      if(solveNlp)
00831        initialSolve();
00832      extractLinearRelaxation(si, getColSolution(), getObj); 
00833      if(solveNlp){
00834         app_->enableWarmStart();
00835         setColSolution(problem()->x_sol());
00836         setRowPrice(problem()->duals_sol());
00837      }
00838    }
00839 
00843   void getOuterApproximation(OsiCuts &cs, bool getObj, const double * x2, bool global)
00844 {
00845   getOuterApproximation(cs, getColSolution(), getObj, x2, global);
00846 }
00847 
00851   void getOuterApproximation(OsiCuts &cs, const double * x, bool getObj, const double * x2, bool global){
00852     getOuterApproximation(cs, x, getObj, x2, 0., global);}
00853 
00857   virtual void getOuterApproximation(OsiCuts &cs, const double * x, bool getObj, const double * x2,
00858                                      double theta, bool global);
00859 
00861   virtual void getConstraintOuterApproximation(OsiCuts & cs, int constraintNumber,
00862                                                const double * x, 
00863                                                const double * x2, bool global);
00864 
00866   void getConstraintOuterApproximation(OsiCuts & cs, int constraintNumber,
00867                                        const double * x2, bool global){
00868      getConstraintOuterApproximation(cs, constraintNumber, getColSolution(),x2,global);
00869   }
00870 
00872   void getBendersCut(OsiCuts &cs, const double * x, const double *lambda, bool getObj = 1);
00873 
00881   double getFeasibilityOuterApproximation(int n, const double * x_bar,const int *ind, OsiCuts &cs, bool addOnlyViolated, bool global);
00882 
00892   double solveFeasibilityProblem(int n, const double * x_bar, const int* ind, double a, double s, int L);
00893 
00902   double solveFeasibilityProblem(int n, const double * x_bar, const int* ind, int L, double cutoff);
00903 
00906   void switchToFeasibilityProblem(int n, const double * x_bar, const int* ind, double a, double s, int L);
00907 
00910   void switchToFeasibilityProblem(int n, const double * x_bar, const int* ind,
00911                                   double rhs_local_branching_constraint);
00912 
00914   void switchToOriginalProblem();
00916 
00921   enum OaMessagesTypes {
00922     CUT_NOT_VIOLATED_ENOUGH = 0,
00923     VIOLATED_OA_CUT_GENERATED,
00924     OA_CUT_GENERATED,
00925     OA_MESSAGES_DUMMY_END};
00927   class OaMessages :public CoinMessages{
00928      public:
00930      OaMessages();
00931   };
00933   class OaMessageHandler : public CoinMessageHandler{
00934     public:
00936     OaMessageHandler():CoinMessageHandler(){
00937     }
00939     OaMessageHandler(FILE * fp):CoinMessageHandler(fp){
00940     }
00942     virtual ~OaMessageHandler(){
00943     }
00945     OaMessageHandler(const OaMessageHandler &other):
00946     CoinMessageHandler(other){}
00948     OaMessageHandler(const CoinMessageHandler &other):
00949     CoinMessageHandler(other){}
00951     OaMessageHandler & operator=(const OaMessageHandler &rhs){
00952        CoinMessageHandler::operator=(rhs);
00953        return *this;}
00955     virtual CoinMessageHandler* clone() const{
00956       return new OaMessageHandler(*this);}
00958     void print(OsiRowCut &row);
00959   };
00960   void setOaMessageHandler(const CoinMessageHandler &handler){
00961     delete oaHandler_;
00962     oaHandler_ = new OaMessageHandler(handler);
00963   }
00965 
00966     //-----------------------------------------------------------------------
00969     virtual ApplyCutsReturnCode applyCuts(const OsiCuts & cs,
00970                                           double effectivenessLb = 0.0){
00971        freeCachedRowRim();
00972       problem_->addCuts(cs);
00973       ApplyCutsReturnCode rc;
00974       return rc;}
00975 
00977   virtual void applyRowCuts(int numberCuts, const OsiRowCut * cuts);
00978 
00979 
00981   virtual void applyRowCuts(int numberCuts, const OsiRowCut ** cuts)
00982   {
00983     if(numberCuts)
00984       freeCachedRowRim();
00985     problem_->addCuts(numberCuts, cuts);
00986   }
00987 
00990  double getConstraintsViolation(const double * x, double & obj);
00991 
00994   double getNonLinearitiesViolation(const double *x, const double obj);
00995 
00996 //---------------------------------------------------------------------------
00997 
00998   void extractInterfaceParams();
00999 
01000 
01002   virtual void setAppDefaultOptions(Ipopt::SmartPtr<Ipopt::OptionsList> Options);
01003 
01005   static void registerOptions (Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions);
01006   
01007   Ipopt::SmartPtr<Bonmin::RegisteredOptions> regOptions(){
01008     if(IsValid(app_))
01009       return app_->roptions();
01010     else
01011       return NULL;
01012   }
01013 
01016 
01017   void SetStrongBrachingSolver(Ipopt::SmartPtr<StrongBranchingSolver> strong_branching_solver);
01020   virtual void markHotStart();
01024   virtual void solveFromHotStart();
01027   virtual void unmarkHotStart();
01029 
01030 protected:
01031   
01033 
01034   enum RandomGenerationType{
01035     uniform =0, perturb=1, perturb_suffix=2};
01037   int initializeJacobianArrays();
01038 
01040 
01041   virtual std::string  appName()
01042   {
01043     return "bonmin";
01044   }
01046 
01047 
01048 
01050   void solveAndCheckErrors(bool doResolve, bool throwOnFailure,
01051       const char * whereFrom);
01052 
01053 
01056   virtual void applyRowCut( const OsiRowCut & rc )
01057   {
01058     const OsiRowCut * cut = &rc;
01059     problem_->addCuts(1, &cut);
01060   }
01063   virtual void applyColCut( const OsiColCut & cc )
01064   {
01065     throw SimpleError("Ipopt model does not implement this function.",
01066         "applyColCut");
01067   }
01068 
01069 //  /** Read the name of the variables in an ampl .col file. */
01070 //  void readVarNames() const;
01071 
01073 
01077   Ipopt::SmartPtr<TMINLP> tminlp_;
01079   Ipopt::SmartPtr<TMINLP2TNLP> problem_;
01081   Ipopt::SmartPtr<Ipopt::TNLP> problem_to_optimize_;
01083   bool feasibility_mode_;
01085   Ipopt::SmartPtr<TNLPSolver> app_;
01086 
01088   std::list<Ipopt::SmartPtr<TNLPSolver> > debug_apps_;
01090   bool testOthers_;
01092 
01094   CoinWarmStart* warmstart_;
01095 
01099   void freeCachedColRim();
01101   void freeCachedRowRim();
01103   void freeCachedData();
01106   void extractSenseRhsAndRange() const;
01108   mutable char    *rowsense_;
01109 
01111   mutable double  *rhs_;
01112 
01114   mutable double  *rowrange_;
01117   mutable double  *reducedCosts_;
01119   double OsiDualObjectiveLimit_;
01121   mutable bool hasVarNamesFile_;
01123 
01124   int nCallOptimizeTNLP_;
01126   double totalNlpSolveTime_;
01128   int totalIterations_;
01130   double maxRandomRadius_;
01132   int randomGenerationType_;
01134   double max_perturbation_;
01136   double pushValue_;
01138   int numRetryInitial_;
01140   int numRetryResolve_;
01142   int numRetryInfeasibles_;
01144   int numRetryUnsolved_;
01146   Messages messages_;
01150   int pretendFailIsInfeasible_;
01152   bool hasContinuedAfterNlpFailure_;
01155   int numIterationSuspect_ ;
01159   bool hasBeenOptimized_;
01163   mutable double * obj_;
01165   static bool hasPrintedOptions;
01166 
01168   Ipopt::SmartPtr<TNLP2FPNLP> feasibilityProblem_;
01169 
01170 
01174   int * jRow_;
01176   int * jCol_;
01178   double * jValues_;
01180   int nnz_jac;
01182 
01184   Ipopt::TNLP::LinearityType * constTypes_;
01187   int nNonLinear_;
01189   double tiny_;
01191   double veryTiny_;
01193   double infty_;
01195   TNLPSolver::ReturnStatus optimizationStatus_;
01197   bool exposeWarmStart_;
01199   bool firstSolve_;
01201   SmartPtr<CutStrengthener> cutStrengthener_;
01202 
01207   OaMessages oaMessages_;
01209   OaMessageHandler * oaHandler_;
01211 protected:
01213   void createApplication(Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions,
01214                          Ipopt::SmartPtr<Ipopt::OptionsList> options,
01215                          Ipopt::SmartPtr<Ipopt::Journalist> journalist);
01217   OsiTMINLPInterface(Ipopt::SmartPtr<TNLPSolver> app);
01218 
01220   bool internal_setWarmStart(const CoinWarmStart* ws);
01221 
01223   CoinWarmStart* internal_getWarmStart() const; 
01224 private:
01226   SmartPtr<StrongBranchingSolver> strong_branching_solver_;
01228   TNLPSolver::ReturnStatus optimizationStatusBeforeHotStart_;
01229 static const char * OPT_SYMB;
01230 static const char * FAILED_SYMB;
01231 static const char * INFEAS_SYMB;
01232 static const char * UNBOUND_SYMB;
01234   const char * statusAsString(TNLPSolver::ReturnStatus r){
01235     if(r == TNLPSolver::solvedOptimal || r == TNLPSolver::solvedOptimalTol){
01236       return OPT_SYMB;} 
01237     else if(r == TNLPSolver::provenInfeasible){
01238       return INFEAS_SYMB;}
01239     else if(r == TNLPSolver::unbounded){
01240       return UNBOUND_SYMB;}
01241     else return FAILED_SYMB;
01242   }
01243   const char * statusAsString(){
01244     return statusAsString(optimizationStatus_);}
01245 };
01246 }
01247 #endif

Generated on Mon Aug 3 03:02:18 2009 by  doxygen 1.4.7