src/lemon/lp_skeleton.h
changeset 1435 8e85e6bbefdf
parent 1431 ad44b1dd8013
equal deleted inserted replaced
8:858360e8dbd4 -1:000000000000
     1 /* -*- C++ -*-
       
     2  * src/lemon/lp_skeleton.h
       
     3  * - Part of LEMON, a generic C++ optimization library
       
     4  *
       
     5  * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
       
     6  * (Egervary Research Group on Combinatorial Optimization, EGRES).
       
     7  *
       
     8  * Permission to use, modify and distribute this software is granted
       
     9  * provided that this copyright notice appears in all copies. For
       
    10  * precise terms see the accompanying LICENSE file.
       
    11  *
       
    12  * This software is provided "AS IS" with no warranty of any kind,
       
    13  * express or implied, and with no claim as to its suitability for any
       
    14  * purpose.
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef LEMON_LP_SKELETON
       
    19 #define LEMON_LP_SKELETON
       
    20 
       
    21 #include <lemon/lp_base.h>
       
    22 
       
    23 ///\file
       
    24 ///\brief A skeleton file to implement LP solver interfaces
       
    25 namespace lemon {
       
    26   
       
    27   ///A skeleton class to implement LP solver interfaces
       
    28   class LpSkeleton :public LpSolverBase {
       
    29     int col_num,row_num;
       
    30     
       
    31   protected:
       
    32     ///\e
       
    33     virtual LpSolverBase &_newLp();
       
    34     ///\e
       
    35     virtual LpSolverBase &_copyLp();
       
    36     /// \e
       
    37     virtual int _addCol();
       
    38     /// \e
       
    39     virtual int _addRow();
       
    40     /// \e
       
    41     virtual void _eraseCol(int i);
       
    42     /// \e
       
    43     virtual void _eraseRow(int i);
       
    44     /// \e
       
    45 
       
    46     /// \warning Arrays are indexed from 1 (datum at index 0 is ignored)
       
    47     ///
       
    48     virtual void _setRowCoeffs(int i, 
       
    49 			       int length,
       
    50                                int  const * indices, 
       
    51                                Value  const * values );
       
    52     /// \e
       
    53 
       
    54     /// \warning Arrays are indexed from 1 (datum at index 0 is ignored)
       
    55     ///
       
    56     virtual void _setColCoeffs(int i, 
       
    57 			       int length,
       
    58                                int  const * indices, 
       
    59                                Value  const * values );
       
    60     
       
    61     /// Set one element of the coefficient matrix
       
    62     virtual void _setCoeff(int row, int col, Value value);
       
    63 
       
    64     /// The lower bound of a variable (column) have to be given by an 
       
    65     /// extended number of type Value, i.e. a finite number of type 
       
    66     /// Value or -\ref INF.
       
    67     virtual void _setColLowerBound(int i, Value value);
       
    68     /// \e
       
    69 
       
    70     /// The upper bound of a variable (column) have to be given by an 
       
    71     /// extended number of type Value, i.e. a finite number of type 
       
    72     /// Value or \ref INF.
       
    73     virtual void _setColUpperBound(int i, Value value);
       
    74     /// \e
       
    75 
       
    76 //     /// The lower bound of a linear expression (row) have to be given by an 
       
    77 //     /// extended number of type Value, i.e. a finite number of type 
       
    78 //     /// Value or -\ref INF.
       
    79 //     virtual void _setRowLowerBound(int i, Value value);
       
    80 //     /// \e
       
    81 
       
    82 //     /// The upper bound of a linear expression (row) have to be given by an 
       
    83 //     /// extended number of type Value, i.e. a finite number of type 
       
    84 //     /// Value or \ref INF.
       
    85 //     virtual void _setRowUpperBound(int i, Value value);
       
    86 
       
    87     /// The lower and upper bound of a linear expression (row) have to be 
       
    88     /// given by an 
       
    89     /// extended number of type Value, i.e. a finite number of type 
       
    90     /// Value or +/-\ref INF.
       
    91     virtual void _setRowBounds(int i, Value lb, Value ub);
       
    92     /// \e
       
    93 
       
    94 
       
    95     /// \e
       
    96     virtual void _clearObj();
       
    97     /// \e
       
    98     virtual void _setObjCoeff(int i, Value obj_coef);
       
    99 
       
   100     ///\e
       
   101     
       
   102     ///\bug Wrong interface
       
   103     ///
       
   104     virtual SolveExitStatus _solve();
       
   105 
       
   106     ///\e
       
   107 
       
   108     ///\bug Wrong interface
       
   109     ///
       
   110     virtual Value _getPrimal(int i);
       
   111     ///\e
       
   112 
       
   113     ///\bug Wrong interface
       
   114     ///
       
   115     virtual Value _getPrimalValue();
       
   116     ///\e
       
   117 
       
   118     ///\bug Wrong interface
       
   119     ///
       
   120     virtual SolutionStatus _getPrimalStatus();
       
   121 
       
   122     ///\e
       
   123     virtual void _setMax();
       
   124     ///\e
       
   125     virtual void _setMin();
       
   126     
       
   127 
       
   128   public:
       
   129     LpSkeleton() : LpSolverBase(), col_num(0), row_num(0) {}
       
   130   };  
       
   131 
       
   132 } //namespace lemon
       
   133 
       
   134 #endif // LEMON_LP_SKELETON