lemon/lp_skeleton.h
author deba
Thu, 15 Feb 2007 19:15:14 +0000
changeset 2364 3a5e67bd42d2
parent 2363 2aabce558574
child 2366 bfbdded3763a
permissions -rw-r--r--
Lp row and col getter function
lp section reader and writer for lemon IO
alpar@1254
     1
/* -*- C++ -*-
alpar@1254
     2
 *
alpar@1956
     3
 * This file is a part of LEMON, a generic C++ optimization library
alpar@1956
     4
 *
alpar@1956
     5
 * Copyright (C) 2003-2006
alpar@1956
     6
 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
alpar@1359
     7
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
alpar@1254
     8
 *
alpar@1254
     9
 * Permission to use, modify and distribute this software is granted
alpar@1254
    10
 * provided that this copyright notice appears in all copies. For
alpar@1254
    11
 * precise terms see the accompanying LICENSE file.
alpar@1254
    12
 *
alpar@1254
    13
 * This software is provided "AS IS" with no warranty of any kind,
alpar@1254
    14
 * express or implied, and with no claim as to its suitability for any
alpar@1254
    15
 * purpose.
alpar@1254
    16
 *
alpar@1254
    17
 */
alpar@1254
    18
alpar@1313
    19
#ifndef LEMON_LP_SKELETON
alpar@1313
    20
#define LEMON_LP_SKELETON
alpar@1254
    21
ladanyi@1356
    22
#include <lemon/lp_base.h>
alpar@1254
    23
alpar@1254
    24
///\file
alpar@1254
    25
///\brief A skeleton file to implement LP solver interfaces
alpar@1254
    26
namespace lemon {
athos@1508
    27
alpar@1254
    28
  ///A skeleton class to implement LP solver interfaces
alpar@1313
    29
  class LpSkeleton :public LpSolverBase {
alpar@1273
    30
    int col_num,row_num;
alpar@1273
    31
    
alpar@1254
    32
  protected:
deba@2363
    33
alpar@1364
    34
    ///\e
alpar@1364
    35
    virtual LpSolverBase &_newLp();
alpar@1364
    36
    ///\e
alpar@1364
    37
    virtual LpSolverBase &_copyLp();
alpar@1294
    38
    /// \e
alpar@1254
    39
    virtual int _addCol();
alpar@1294
    40
    /// \e
alpar@1254
    41
    virtual int _addRow();
alpar@1294
    42
    /// \e
athos@1432
    43
    virtual void _eraseCol(int i);
athos@1432
    44
    /// \e
athos@1432
    45
    virtual void _eraseRow(int i);
athos@1432
    46
    /// \e
deba@2312
    47
    virtual void _getColName(int col, std::string & name);
alpar@1895
    48
    /// \e
alpar@1895
    49
    virtual void _setColName(int col, const std::string & name);
alpar@1895
    50
alpar@1895
    51
    /// \e
deba@2364
    52
    virtual void _setRowCoeffs(int i, ConstRowIterator b, ConstRowIterator e);
alpar@1294
    53
    /// \e
deba@2364
    54
    virtual void _getRowCoeffs(int i, RowIterator b);
deba@2364
    55
    /// \e
deba@2364
    56
    virtual void _setColCoeffs(int i, ConstColIterator b, ConstColIterator e);
deba@2364
    57
    /// \e
deba@2364
    58
    virtual void _getColCoeffs(int i, ColIterator b);
alpar@1294
    59
    
athos@1431
    60
    /// Set one element of the coefficient matrix
athos@1431
    61
    virtual void _setCoeff(int row, int col, Value value);
alpar@1294
    62
athos@2324
    63
    /// Get one element of the coefficient matrix
athos@2324
    64
    virtual Value _getCoeff(int row, int col);
athos@2324
    65
alpar@1294
    66
    /// The lower bound of a variable (column) have to be given by an 
alpar@1294
    67
    /// extended number of type Value, i.e. a finite number of type 
alpar@1294
    68
    /// Value or -\ref INF.
alpar@1254
    69
    virtual void _setColLowerBound(int i, Value value);
alpar@1294
    70
    /// \e
alpar@1294
    71
athos@2328
    72
    /// The lower bound of a variable (column) is an 
athos@2328
    73
    /// extended number of type Value, i.e. a finite number of type 
athos@2328
    74
    /// Value or -\ref INF.
athos@2328
    75
    virtual Value _getColLowerBound(int i);
athos@2328
    76
alpar@1294
    77
    /// The upper bound of a variable (column) have to be given by an 
alpar@1294
    78
    /// extended number of type Value, i.e. a finite number of type 
alpar@1294
    79
    /// Value or \ref INF.
alpar@1254
    80
    virtual void _setColUpperBound(int i, Value value);
alpar@1294
    81
    /// \e
alpar@1294
    82
athos@2328
    83
    /// The upper bound of a variable (column) is an 
athos@2328
    84
    /// extended number of type Value, i.e. a finite number of type 
athos@2328
    85
    /// Value or \ref INF.
athos@2328
    86
    virtual Value _getColUpperBound(int i);
athos@2328
    87
athos@1405
    88
//     /// The lower bound of a linear expression (row) have to be given by an 
athos@1405
    89
//     /// extended number of type Value, i.e. a finite number of type 
athos@1405
    90
//     /// Value or -\ref INF.
athos@1405
    91
//     virtual void _setRowLowerBound(int i, Value value);
athos@1405
    92
//     /// \e
athos@1405
    93
athos@1405
    94
//     /// The upper bound of a linear expression (row) have to be given by an 
athos@1405
    95
//     /// extended number of type Value, i.e. a finite number of type 
athos@1405
    96
//     /// Value or \ref INF.
athos@1405
    97
//     virtual void _setRowUpperBound(int i, Value value);
athos@1405
    98
athos@1405
    99
    /// The lower and upper bound of a linear expression (row) have to be 
athos@1405
   100
    /// given by an 
alpar@1294
   101
    /// extended number of type Value, i.e. a finite number of type 
athos@1405
   102
    /// Value or +/-\ref INF.
athos@1389
   103
    virtual void _setRowBounds(int i, Value lb, Value ub);
athos@1389
   104
    /// \e
athos@1389
   105
alpar@1294
   106
athos@2328
   107
    /// The lower and the upper bound of
athos@2328
   108
    /// a constraint (row) are  
athos@2328
   109
    /// extended numbers of type Value, i.e.  finite numbers of type 
athos@2328
   110
    /// Value, -\ref INF or \ref INF. 
athos@2328
   111
    virtual void _getRowBounds(int i, Value &lb, Value &ub);
athos@2328
   112
    /// \e
athos@2328
   113
athos@2328
   114
alpar@1294
   115
    /// \e
alpar@1390
   116
    virtual void _clearObj();
alpar@1390
   117
    /// \e
alpar@1254
   118
    virtual void _setObjCoeff(int i, Value obj_coef);
alpar@1294
   119
athos@2324
   120
    /// \e
athos@2324
   121
    virtual Value _getObjCoeff(int i);
athos@2324
   122
alpar@1294
   123
    ///\e
alpar@1294
   124
    
alpar@1294
   125
    ///\bug Wrong interface
alpar@1294
   126
    ///
alpar@1303
   127
    virtual SolveExitStatus _solve();
alpar@1294
   128
alpar@1294
   129
    ///\e
alpar@1294
   130
alpar@1294
   131
    ///\bug Wrong interface
alpar@1294
   132
    ///
alpar@1293
   133
    virtual Value _getPrimal(int i);
klao@1796
   134
klao@1796
   135
    ///\e
klao@1796
   136
klao@1796
   137
    ///\bug Wrong interface
klao@1796
   138
    ///
klao@1796
   139
    virtual Value _getDual(int i);
klao@1796
   140
alpar@1294
   141
    ///\e
alpar@1294
   142
alpar@1294
   143
    ///\bug Wrong interface
alpar@1294
   144
    ///
alpar@1312
   145
    virtual Value _getPrimalValue();
klao@1796
   146
alpar@1312
   147
    ///\e
alpar@1312
   148
alpar@1312
   149
    ///\bug Wrong interface
alpar@1312
   150
    ///
alpar@1312
   151
    virtual SolutionStatus _getPrimalStatus();
alpar@1312
   152
athos@1460
   153
    ////e
athos@1460
   154
    virtual SolutionStatus _getDualStatus();
athos@1460
   155
athos@1460
   156
athos@1460
   157
    ///\e
athos@1460
   158
    virtual ProblemTypes _getProblemType();
athos@1460
   159
alpar@1312
   160
    ///\e
alpar@1312
   161
    virtual void _setMax();
alpar@1312
   162
    ///\e
alpar@1312
   163
    virtual void _setMin();
alpar@1843
   164
alpar@1843
   165
    ///\e
athos@2324
   166
    virtual bool _isMax();
athos@2324
   167
athos@2324
   168
athos@2324
   169
athos@2324
   170
    ///\e
alpar@1843
   171
    virtual bool _isBasicCol(int i);
alpar@1843
   172
alpar@1312
   173
    
alpar@1294
   174
alpar@1273
   175
  public:
alpar@1313
   176
    LpSkeleton() : LpSolverBase(), col_num(0), row_num(0) {}
alpar@1254
   177
  };  
alpar@1254
   178
alpar@1254
   179
} //namespace lemon
alpar@1254
   180
alpar@1313
   181
#endif // LEMON_LP_SKELETON