lemon/lp_skeleton.h
changeset 1435 8e85e6bbefdf
parent 1432 46b088b01f88
child 1460 7c58aabb9eea
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/lemon/lp_skeleton.h	Mon May 23 04:48:14 2005 +0000
     1.3 @@ -0,0 +1,133 @@
     1.4 +/* -*- C++ -*-
     1.5 + * lemon/lp_skeleton.h - Part of LEMON, a generic C++ optimization library
     1.6 + *
     1.7 + * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     1.8 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
     1.9 + *
    1.10 + * Permission to use, modify and distribute this software is granted
    1.11 + * provided that this copyright notice appears in all copies. For
    1.12 + * precise terms see the accompanying LICENSE file.
    1.13 + *
    1.14 + * This software is provided "AS IS" with no warranty of any kind,
    1.15 + * express or implied, and with no claim as to its suitability for any
    1.16 + * purpose.
    1.17 + *
    1.18 + */
    1.19 +
    1.20 +#ifndef LEMON_LP_SKELETON
    1.21 +#define LEMON_LP_SKELETON
    1.22 +
    1.23 +#include <lemon/lp_base.h>
    1.24 +
    1.25 +///\file
    1.26 +///\brief A skeleton file to implement LP solver interfaces
    1.27 +namespace lemon {
    1.28 +  
    1.29 +  ///A skeleton class to implement LP solver interfaces
    1.30 +  class LpSkeleton :public LpSolverBase {
    1.31 +    int col_num,row_num;
    1.32 +    
    1.33 +  protected:
    1.34 +    ///\e
    1.35 +    virtual LpSolverBase &_newLp();
    1.36 +    ///\e
    1.37 +    virtual LpSolverBase &_copyLp();
    1.38 +    /// \e
    1.39 +    virtual int _addCol();
    1.40 +    /// \e
    1.41 +    virtual int _addRow();
    1.42 +    /// \e
    1.43 +    virtual void _eraseCol(int i);
    1.44 +    /// \e
    1.45 +    virtual void _eraseRow(int i);
    1.46 +    /// \e
    1.47 +
    1.48 +    /// \warning Arrays are indexed from 1 (datum at index 0 is ignored)
    1.49 +    ///
    1.50 +    virtual void _setRowCoeffs(int i, 
    1.51 +			       int length,
    1.52 +                               int  const * indices, 
    1.53 +                               Value  const * values );
    1.54 +    /// \e
    1.55 +
    1.56 +    /// \warning Arrays are indexed from 1 (datum at index 0 is ignored)
    1.57 +    ///
    1.58 +    virtual void _setColCoeffs(int i, 
    1.59 +			       int length,
    1.60 +                               int  const * indices, 
    1.61 +                               Value  const * values );
    1.62 +    
    1.63 +    /// Set one element of the coefficient matrix
    1.64 +    virtual void _setCoeff(int row, int col, Value value);
    1.65 +
    1.66 +    /// The lower bound of a variable (column) have to be given by an 
    1.67 +    /// extended number of type Value, i.e. a finite number of type 
    1.68 +    /// Value or -\ref INF.
    1.69 +    virtual void _setColLowerBound(int i, Value value);
    1.70 +    /// \e
    1.71 +
    1.72 +    /// The upper bound of a variable (column) have to be given by an 
    1.73 +    /// extended number of type Value, i.e. a finite number of type 
    1.74 +    /// Value or \ref INF.
    1.75 +    virtual void _setColUpperBound(int i, Value value);
    1.76 +    /// \e
    1.77 +
    1.78 +//     /// The lower bound of a linear expression (row) have to be given by an 
    1.79 +//     /// extended number of type Value, i.e. a finite number of type 
    1.80 +//     /// Value or -\ref INF.
    1.81 +//     virtual void _setRowLowerBound(int i, Value value);
    1.82 +//     /// \e
    1.83 +
    1.84 +//     /// The upper bound of a linear expression (row) have to be given by an 
    1.85 +//     /// extended number of type Value, i.e. a finite number of type 
    1.86 +//     /// Value or \ref INF.
    1.87 +//     virtual void _setRowUpperBound(int i, Value value);
    1.88 +
    1.89 +    /// The lower and upper bound of a linear expression (row) have to be 
    1.90 +    /// given by an 
    1.91 +    /// extended number of type Value, i.e. a finite number of type 
    1.92 +    /// Value or +/-\ref INF.
    1.93 +    virtual void _setRowBounds(int i, Value lb, Value ub);
    1.94 +    /// \e
    1.95 +
    1.96 +
    1.97 +    /// \e
    1.98 +    virtual void _clearObj();
    1.99 +    /// \e
   1.100 +    virtual void _setObjCoeff(int i, Value obj_coef);
   1.101 +
   1.102 +    ///\e
   1.103 +    
   1.104 +    ///\bug Wrong interface
   1.105 +    ///
   1.106 +    virtual SolveExitStatus _solve();
   1.107 +
   1.108 +    ///\e
   1.109 +
   1.110 +    ///\bug Wrong interface
   1.111 +    ///
   1.112 +    virtual Value _getPrimal(int i);
   1.113 +    ///\e
   1.114 +
   1.115 +    ///\bug Wrong interface
   1.116 +    ///
   1.117 +    virtual Value _getPrimalValue();
   1.118 +    ///\e
   1.119 +
   1.120 +    ///\bug Wrong interface
   1.121 +    ///
   1.122 +    virtual SolutionStatus _getPrimalStatus();
   1.123 +
   1.124 +    ///\e
   1.125 +    virtual void _setMax();
   1.126 +    ///\e
   1.127 +    virtual void _setMin();
   1.128 +    
   1.129 +
   1.130 +  public:
   1.131 +    LpSkeleton() : LpSolverBase(), col_num(0), row_num(0) {}
   1.132 +  };  
   1.133 +
   1.134 +} //namespace lemon
   1.135 +
   1.136 +#endif // LEMON_LP_SKELETON