lemon/lp_skeleton.h
changeset 587 9db62975c32b
parent 576 f5bc148f7e1f
child 588 89e29e22d479
equal deleted inserted replaced
2:a6eebaa25465 3:0a22e9e9ae96
    20 #define LEMON_LP_SKELETON_H
    20 #define LEMON_LP_SKELETON_H
    21 
    21 
    22 #include <lemon/lp_base.h>
    22 #include <lemon/lp_base.h>
    23 
    23 
    24 ///\file
    24 ///\file
    25 ///\brief A skeleton file to implement LP solver interfaces
    25 ///\brief Skeleton file to implement LP/MIP solver interfaces
       
    26 ///  
       
    27 ///The classes in this file do nothing, but they can serve as skeletons when
       
    28 ///implementing an interface to new solvers.
    26 namespace lemon {
    29 namespace lemon {
    27 
    30 
    28   ///A skeleton class to implement LP solver interfaces
    31   ///A skeleton class to implement LP/MIP solver base interface
       
    32   
       
    33   ///This class does nothing, but it can serve as a skeleton when
       
    34   ///implementing an interface to new solvers.
    29   class SkeletonSolverBase : public virtual LpBase {
    35   class SkeletonSolverBase : public virtual LpBase {
    30     int col_num,row_num;
    36     int col_num,row_num;
    31 
    37 
    32   protected:
    38   protected:
    33 
    39 
   134     ///\e
   140     ///\e
   135     virtual void _clear();
   141     virtual void _clear();
   136 
   142 
   137   };
   143   };
   138 
   144 
   139   /// \brief Interface for a skeleton LP solver
   145   /// \brief Skeleton class for an LP solver interface
   140   ///
   146   ///
   141   /// This class implements an interface for a skeleton LP solver.
   147   ///This class does nothing, but it can serve as a skeleton when
       
   148   ///implementing an interface to new solvers.
       
   149 
   142   ///\ingroup lp_group
   150   ///\ingroup lp_group
   143   class LpSkeleton : public SkeletonSolverBase, public LpSolver {
   151   class LpSkeleton : public LpSolver, public SkeletonSolverBase {
   144   public:
   152   public:
   145     LpSkeleton() : SkeletonSolverBase(), LpSolver() {}
   153     ///\e
   146 
   154     LpSkeleton() : LpSolver(), SkeletonSolverBase() {}
       
   155     ///\e
       
   156     virtual LpSkeleton* newSolver() const;
       
   157     ///\e
       
   158     virtual LpSkeleton* cloneSolver() const;
   147   protected:
   159   protected:
   148 
   160 
   149     ///\e
   161     ///\e
   150     virtual SolveExitStatus _solve();
   162     virtual SolveExitStatus _solve();
   151 
   163 
   171     virtual VarStatus _getColStatus(int i) const;
   183     virtual VarStatus _getColStatus(int i) const;
   172     ///\e
   184     ///\e
   173     virtual VarStatus _getRowStatus(int i) const;
   185     virtual VarStatus _getRowStatus(int i) const;
   174 
   186 
   175     ///\e
   187     ///\e
   176     virtual LpSkeleton* _newSolver() const;
       
   177     ///\e
       
   178     virtual LpSkeleton* _cloneSolver() const;
       
   179     ///\e
       
   180     virtual const char* _solverName() const;
   188     virtual const char* _solverName() const;
   181 
   189 
   182   };
   190   };
   183 
   191 
   184   /// \brief Interface for a skeleton MIP solver
   192   /// \brief Skeleton class for a MIP solver interface
   185   ///
   193   ///
   186   /// This class implements an interface for a skeleton MIP solver.
   194   ///This class does nothing, but it can serve as a skeleton when
       
   195   ///implementing an interface to new solvers.
   187   ///\ingroup lp_group
   196   ///\ingroup lp_group
   188   class MipSkeleton : public SkeletonSolverBase, public MipSolver {
   197   class MipSkeleton : public MipSolver, public SkeletonSolverBase {
   189   public:
   198   public:
   190     MipSkeleton() : SkeletonSolverBase(), MipSolver() {}
   199     ///\e
       
   200     MipSkeleton() : MipSolver(), SkeletonSolverBase() {}
       
   201     ///\e
       
   202     virtual MipSkeleton* newSolver() const;
       
   203     ///\e
       
   204     virtual MipSkeleton* cloneSolver() const;
   191 
   205 
   192   protected:
   206   protected:
   193     ///\e
   207     ///\e
   194 
   208 
   195     ///\bug Wrong interface
   209     ///\bug Wrong interface
   213     ///\bug Wrong interface
   227     ///\bug Wrong interface
   214     ///
   228     ///
   215     virtual ProblemType _getType() const;
   229     virtual ProblemType _getType() const;
   216 
   230 
   217     ///\e
   231     ///\e
   218     virtual MipSkeleton* _newSolver() const;
       
   219 
       
   220     ///\e
       
   221     virtual MipSkeleton* _cloneSolver() const;
       
   222     ///\e
       
   223     virtual const char* _solverName() const;
   232     virtual const char* _solverName() const;
   224 
       
   225   };
   233   };
   226 
   234 
   227 } //namespace lemon
   235 } //namespace lemon
   228 
   236 
   229 #endif
   237 #endif