Osi  trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
OsiSolverBranch.hpp
Go to the documentation of this file.
00001 // Copyright (C) 2005, International Business Machines
00002 // Corporation and others.  All Rights Reserved.
00003 // This code is licensed under the terms of the Eclipse Public License (EPL).
00004 
00005 #ifndef OsiSolverBranch_H
00006 #define OsiSolverBranch_H
00007 
00008 class OsiSolverInterface;
00009 #include "CoinWarmStartBasis.hpp"
00010 
00011 //#############################################################################
00012 
00018 class OsiSolverBranch  {
00019   
00020 public:
00022 
00023 
00024   void addBranch(int iColumn, double value); 
00025   
00027   void addBranch(int way,int numberTighterLower, const int * whichLower, const double * newLower,
00028                  int numberTighterUpper, const int * whichUpper, const double * newUpper);
00030   void addBranch(int way,int numberColumns,const double * oldLower, const double * newLower,
00031                  const double * oldUpper, const double * newUpper);
00032   
00034   void applyBounds(OsiSolverInterface & solver,int way) const;
00036   bool feasibleOneWay(const OsiSolverInterface & solver) const;
00038   inline const int * starts() const
00039   { return start_;}
00041   inline const int * which() const
00042   { return indices_;}
00044   inline const double * bounds() const
00045   { return bound_;}
00047   
00048   
00050 
00051 
00052   OsiSolverBranch(); 
00053   
00055   OsiSolverBranch(const OsiSolverBranch & rhs);
00056   
00058   OsiSolverBranch & operator=(const OsiSolverBranch & rhs);
00059   
00061   ~OsiSolverBranch ();
00062   
00064   
00065 private:
00067 
00068 
00069   int start_[5];
00071   int * indices_;
00073   double * bound_;
00075 };
00076 //#############################################################################
00077 
00083 class OsiSolverResult  {
00084   
00085 public:
00087 
00088 
00089   void createResult(const OsiSolverInterface & solver,const double * lowerBefore,
00090                     const double * upperBefore);
00091   
00093   void restoreResult(OsiSolverInterface & solver) const;
00094   
00096   inline const CoinWarmStartBasis & basis() const
00097   { return basis_;}
00098   
00100   inline double objectiveValue() const
00101   { return objectiveValue_;}
00102 
00104   inline const double * primalSolution() const
00105   { return primalSolution_;}
00106 
00108   inline const double * dualSolution() const
00109   { return dualSolution_;}
00110 
00112   inline const OsiSolverBranch & fixed() const
00113   { return fixed_;}
00115   
00116   
00118 
00119 
00120   OsiSolverResult(); 
00121   
00123   OsiSolverResult(const OsiSolverInterface & solver,const double * lowerBefore,
00124                   const double * upperBefore); 
00125   
00127   OsiSolverResult(const OsiSolverResult & rhs);
00128   
00130   OsiSolverResult & operator=(const OsiSolverResult & rhs);
00131   
00133   ~OsiSolverResult ();
00134   
00136   
00137 private:
00139 
00140 
00141   double objectiveValue_;
00143   CoinWarmStartBasis basis_;
00145   double * primalSolution_;
00147   double * dualSolution_;
00149   OsiSolverBranch fixed_;
00151 };
00152 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines