lemon/lp_skeleton.h
author deba
Tue, 20 Nov 2007 15:06:03 +0000
changeset 2516 6a30e13a1c79
parent 2366 bfbdded3763a
child 2553 bfced05fa852
permissions -rw-r--r--
Nauty graph6 reader
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@2391
     5
 * Copyright (C) 2003-2007
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@2366
    47
    virtual void _getColName(int col, std::string & name) const;
alpar@1895
    48
    /// \e
alpar@1895
    49
    virtual void _setColName(int col, const std::string & name);
deba@2366
    50
    /// \e
deba@2366
    51
    virtual int _colByName(const std::string& name) const;
alpar@1895
    52
alpar@1895
    53
    /// \e
deba@2364
    54
    virtual void _setRowCoeffs(int i, ConstRowIterator b, ConstRowIterator e);
alpar@1294
    55
    /// \e
deba@2366
    56
    virtual void _getRowCoeffs(int i, RowIterator b) const;
deba@2364
    57
    /// \e
deba@2364
    58
    virtual void _setColCoeffs(int i, ConstColIterator b, ConstColIterator e);
deba@2364
    59
    /// \e
deba@2366
    60
    virtual void _getColCoeffs(int i, ColIterator b) const;
alpar@1294
    61
    
athos@1431
    62
    /// Set one element of the coefficient matrix
athos@1431
    63
    virtual void _setCoeff(int row, int col, Value value);
alpar@1294
    64
athos@2324
    65
    /// Get one element of the coefficient matrix
deba@2366
    66
    virtual Value _getCoeff(int row, int col) const;
athos@2324
    67
alpar@1294
    68
    /// The lower bound of a variable (column) have to be given by an 
alpar@1294
    69
    /// extended number of type Value, i.e. a finite number of type 
alpar@1294
    70
    /// Value or -\ref INF.
alpar@1254
    71
    virtual void _setColLowerBound(int i, Value value);
alpar@1294
    72
    /// \e
alpar@1294
    73
athos@2328
    74
    /// The lower bound of a variable (column) is an 
athos@2328
    75
    /// extended number of type Value, i.e. a finite number of type 
athos@2328
    76
    /// Value or -\ref INF.
deba@2366
    77
    virtual Value _getColLowerBound(int i) const;
athos@2328
    78
alpar@1294
    79
    /// The upper bound of a variable (column) have to be given by an 
alpar@1294
    80
    /// extended number of type Value, i.e. a finite number of type 
alpar@1294
    81
    /// Value or \ref INF.
alpar@1254
    82
    virtual void _setColUpperBound(int i, Value value);
alpar@1294
    83
    /// \e
alpar@1294
    84
athos@2328
    85
    /// The upper bound of a variable (column) is an 
athos@2328
    86
    /// extended number of type Value, i.e. a finite number of type 
athos@2328
    87
    /// Value or \ref INF.
deba@2366
    88
    virtual Value _getColUpperBound(int i) const;
athos@2328
    89
athos@1405
    90
//     /// The lower bound of a linear expression (row) have to be given by an 
athos@1405
    91
//     /// extended number of type Value, i.e. a finite number of type 
athos@1405
    92
//     /// Value or -\ref INF.
athos@1405
    93
//     virtual void _setRowLowerBound(int i, Value value);
athos@1405
    94
//     /// \e
athos@1405
    95
athos@1405
    96
//     /// The upper bound of a linear expression (row) have to be given by an 
athos@1405
    97
//     /// extended number of type Value, i.e. a finite number of type 
athos@1405
    98
//     /// Value or \ref INF.
athos@1405
    99
//     virtual void _setRowUpperBound(int i, Value value);
athos@1405
   100
athos@1405
   101
    /// The lower and upper bound of a linear expression (row) have to be 
athos@1405
   102
    /// given by an 
alpar@1294
   103
    /// extended number of type Value, i.e. a finite number of type 
athos@1405
   104
    /// Value or +/-\ref INF.
athos@1389
   105
    virtual void _setRowBounds(int i, Value lb, Value ub);
athos@1389
   106
    /// \e
athos@1389
   107
alpar@1294
   108
athos@2328
   109
    /// The lower and the upper bound of
athos@2328
   110
    /// a constraint (row) are  
athos@2328
   111
    /// extended numbers of type Value, i.e.  finite numbers of type 
athos@2328
   112
    /// Value, -\ref INF or \ref INF. 
deba@2366
   113
    virtual void _getRowBounds(int i, Value &lb, Value &ub) const;
athos@2328
   114
    /// \e
athos@2328
   115
athos@2328
   116
alpar@1294
   117
    /// \e
alpar@1390
   118
    virtual void _clearObj();
alpar@1390
   119
    /// \e
alpar@1254
   120
    virtual void _setObjCoeff(int i, Value obj_coef);
alpar@1294
   121
athos@2324
   122
    /// \e
deba@2366
   123
    virtual Value _getObjCoeff(int i) const;
athos@2324
   124
alpar@1294
   125
    ///\e
alpar@1294
   126
    
alpar@1294
   127
    ///\bug Wrong interface
alpar@1294
   128
    ///
alpar@1303
   129
    virtual SolveExitStatus _solve();
alpar@1294
   130
alpar@1294
   131
    ///\e
alpar@1294
   132
alpar@1294
   133
    ///\bug Wrong interface
alpar@1294
   134
    ///
deba@2366
   135
    virtual Value _getPrimal(int i) const;
klao@1796
   136
klao@1796
   137
    ///\e
klao@1796
   138
klao@1796
   139
    ///\bug Wrong interface
klao@1796
   140
    ///
deba@2366
   141
    virtual Value _getDual(int i) const;
klao@1796
   142
alpar@1294
   143
    ///\e
alpar@1294
   144
alpar@1294
   145
    ///\bug Wrong interface
alpar@1294
   146
    ///
deba@2366
   147
    virtual Value _getPrimalValue() const;
klao@1796
   148
alpar@1312
   149
    ///\e
alpar@1312
   150
alpar@1312
   151
    ///\bug Wrong interface
alpar@1312
   152
    ///
deba@2366
   153
    virtual SolutionStatus _getPrimalStatus() const;
alpar@1312
   154
athos@1460
   155
    ////e
deba@2366
   156
    virtual SolutionStatus _getDualStatus() const;
athos@1460
   157
athos@1460
   158
athos@1460
   159
    ///\e
deba@2366
   160
    virtual ProblemTypes _getProblemType() const;
athos@1460
   161
alpar@1312
   162
    ///\e
alpar@1312
   163
    virtual void _setMax();
alpar@1312
   164
    ///\e
alpar@1312
   165
    virtual void _setMin();
alpar@1843
   166
alpar@1843
   167
    ///\e
deba@2366
   168
    virtual bool _isMax() const;
athos@2324
   169
athos@2324
   170
athos@2324
   171
athos@2324
   172
    ///\e
deba@2366
   173
    virtual bool _isBasicCol(int i) const;
alpar@1843
   174
alpar@1312
   175
    
alpar@1294
   176
alpar@1273
   177
  public:
alpar@1313
   178
    LpSkeleton() : LpSolverBase(), col_num(0), row_num(0) {}
alpar@1254
   179
  };  
alpar@1254
   180
alpar@1254
   181
} //namespace lemon
alpar@1254
   182
alpar@1313
   183
#endif // LEMON_LP_SKELETON