lemon/lp_skeleton.h
author alpar
Fri, 19 Jan 2007 17:27:22 +0000
changeset 2347 0aaa7ada5395
parent 2324 18fc834761d9
child 2363 2aabce558574
permissions -rw-r--r--
Spellcheck
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:
alpar@1364
    33
    ///\e
alpar@1364
    34
    virtual LpSolverBase &_newLp();
alpar@1364
    35
    ///\e
alpar@1364
    36
    virtual LpSolverBase &_copyLp();
alpar@1294
    37
    /// \e
alpar@1254
    38
    virtual int _addCol();
alpar@1294
    39
    /// \e
alpar@1254
    40
    virtual int _addRow();
alpar@1294
    41
    /// \e
athos@1432
    42
    virtual void _eraseCol(int i);
athos@1432
    43
    /// \e
athos@1432
    44
    virtual void _eraseRow(int i);
athos@1432
    45
    /// \e
deba@2312
    46
    virtual void _getColName(int col, std::string & name);
alpar@1895
    47
    /// \e
alpar@1895
    48
    virtual void _setColName(int col, const std::string & name);
alpar@1895
    49
alpar@1895
    50
    /// \e
deba@2312
    51
    virtual void _setRowCoeffs(int i, LpRowIterator b, LpRowIterator e);
alpar@1294
    52
    /// \e
deba@2312
    53
    virtual void _setColCoeffs(int i, LpColIterator b, LpColIterator e);
alpar@1294
    54
    
athos@1431
    55
    /// Set one element of the coefficient matrix
athos@1431
    56
    virtual void _setCoeff(int row, int col, Value value);
alpar@1294
    57
athos@2324
    58
    /// Get one element of the coefficient matrix
athos@2324
    59
    virtual Value _getCoeff(int row, int col);
athos@2324
    60
alpar@1294
    61
    /// The lower bound of a variable (column) have to be given by an 
alpar@1294
    62
    /// extended number of type Value, i.e. a finite number of type 
alpar@1294
    63
    /// Value or -\ref INF.
alpar@1254
    64
    virtual void _setColLowerBound(int i, Value value);
alpar@1294
    65
    /// \e
alpar@1294
    66
athos@2328
    67
    /// The lower bound of a variable (column) is an 
athos@2328
    68
    /// extended number of type Value, i.e. a finite number of type 
athos@2328
    69
    /// Value or -\ref INF.
athos@2328
    70
    virtual Value _getColLowerBound(int i);
athos@2328
    71
alpar@1294
    72
    /// The upper bound of a variable (column) have to be given by an 
alpar@1294
    73
    /// extended number of type Value, i.e. a finite number of type 
alpar@1294
    74
    /// Value or \ref INF.
alpar@1254
    75
    virtual void _setColUpperBound(int i, Value value);
alpar@1294
    76
    /// \e
alpar@1294
    77
athos@2328
    78
    /// The upper bound of a variable (column) is an 
athos@2328
    79
    /// extended number of type Value, i.e. a finite number of type 
athos@2328
    80
    /// Value or \ref INF.
athos@2328
    81
    virtual Value _getColUpperBound(int i);
athos@2328
    82
athos@1405
    83
//     /// The lower bound of a linear expression (row) have to be given by an 
athos@1405
    84
//     /// extended number of type Value, i.e. a finite number of type 
athos@1405
    85
//     /// Value or -\ref INF.
athos@1405
    86
//     virtual void _setRowLowerBound(int i, Value value);
athos@1405
    87
//     /// \e
athos@1405
    88
athos@1405
    89
//     /// The upper bound of a linear expression (row) have to be given by an 
athos@1405
    90
//     /// extended number of type Value, i.e. a finite number of type 
athos@1405
    91
//     /// Value or \ref INF.
athos@1405
    92
//     virtual void _setRowUpperBound(int i, Value value);
athos@1405
    93
athos@1405
    94
    /// The lower and upper bound of a linear expression (row) have to be 
athos@1405
    95
    /// given by an 
alpar@1294
    96
    /// extended number of type Value, i.e. a finite number of type 
athos@1405
    97
    /// Value or +/-\ref INF.
athos@1389
    98
    virtual void _setRowBounds(int i, Value lb, Value ub);
athos@1389
    99
    /// \e
athos@1389
   100
alpar@1294
   101
athos@2328
   102
    /// The lower and the upper bound of
athos@2328
   103
    /// a constraint (row) are  
athos@2328
   104
    /// extended numbers of type Value, i.e.  finite numbers of type 
athos@2328
   105
    /// Value, -\ref INF or \ref INF. 
athos@2328
   106
    virtual void _getRowBounds(int i, Value &lb, Value &ub);
athos@2328
   107
    /// \e
athos@2328
   108
athos@2328
   109
alpar@1294
   110
    /// \e
alpar@1390
   111
    virtual void _clearObj();
alpar@1390
   112
    /// \e
alpar@1254
   113
    virtual void _setObjCoeff(int i, Value obj_coef);
alpar@1294
   114
athos@2324
   115
    /// \e
athos@2324
   116
    virtual Value _getObjCoeff(int i);
athos@2324
   117
alpar@1294
   118
    ///\e
alpar@1294
   119
    
alpar@1294
   120
    ///\bug Wrong interface
alpar@1294
   121
    ///
alpar@1303
   122
    virtual SolveExitStatus _solve();
alpar@1294
   123
alpar@1294
   124
    ///\e
alpar@1294
   125
alpar@1294
   126
    ///\bug Wrong interface
alpar@1294
   127
    ///
alpar@1293
   128
    virtual Value _getPrimal(int i);
klao@1796
   129
klao@1796
   130
    ///\e
klao@1796
   131
klao@1796
   132
    ///\bug Wrong interface
klao@1796
   133
    ///
klao@1796
   134
    virtual Value _getDual(int i);
klao@1796
   135
alpar@1294
   136
    ///\e
alpar@1294
   137
alpar@1294
   138
    ///\bug Wrong interface
alpar@1294
   139
    ///
alpar@1312
   140
    virtual Value _getPrimalValue();
klao@1796
   141
alpar@1312
   142
    ///\e
alpar@1312
   143
alpar@1312
   144
    ///\bug Wrong interface
alpar@1312
   145
    ///
alpar@1312
   146
    virtual SolutionStatus _getPrimalStatus();
alpar@1312
   147
athos@1460
   148
    ////e
athos@1460
   149
    virtual SolutionStatus _getDualStatus();
athos@1460
   150
athos@1460
   151
athos@1460
   152
    ///\e
athos@1460
   153
    virtual ProblemTypes _getProblemType();
athos@1460
   154
alpar@1312
   155
    ///\e
alpar@1312
   156
    virtual void _setMax();
alpar@1312
   157
    ///\e
alpar@1312
   158
    virtual void _setMin();
alpar@1843
   159
alpar@1843
   160
    ///\e
athos@2324
   161
    virtual bool _isMax();
athos@2324
   162
athos@2324
   163
athos@2324
   164
athos@2324
   165
    ///\e
alpar@1843
   166
    virtual bool _isBasicCol(int i);
alpar@1843
   167
alpar@1312
   168
    
alpar@1294
   169
alpar@1273
   170
  public:
alpar@1313
   171
    LpSkeleton() : LpSolverBase(), col_num(0), row_num(0) {}
alpar@1254
   172
  };  
alpar@1254
   173
alpar@1254
   174
} //namespace lemon
alpar@1254
   175
alpar@1313
   176
#endif // LEMON_LP_SKELETON