lemon/lp_skeleton.h
author athos
Mon, 04 Dec 2006 16:48:13 +0000
changeset 2324 18fc834761d9
parent 2312 07e46cbb7d85
child 2328 b4931ae52069
permissions -rw-r--r--
Some query functions got implemented, but only for GLPK.
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
alpar@1294
    67
    /// The upper bound of a variable (column) have to be given by an 
alpar@1294
    68
    /// extended number of type Value, i.e. a finite number of type 
alpar@1294
    69
    /// Value or \ref INF.
alpar@1254
    70
    virtual void _setColUpperBound(int i, Value value);
alpar@1294
    71
    /// \e
alpar@1294
    72
athos@1405
    73
//     /// The lower bound of a linear expression (row) have to be given by an 
athos@1405
    74
//     /// extended number of type Value, i.e. a finite number of type 
athos@1405
    75
//     /// Value or -\ref INF.
athos@1405
    76
//     virtual void _setRowLowerBound(int i, Value value);
athos@1405
    77
//     /// \e
athos@1405
    78
athos@1405
    79
//     /// The upper bound of a linear expression (row) have to be given by an 
athos@1405
    80
//     /// extended number of type Value, i.e. a finite number of type 
athos@1405
    81
//     /// Value or \ref INF.
athos@1405
    82
//     virtual void _setRowUpperBound(int i, Value value);
athos@1405
    83
athos@1405
    84
    /// The lower and upper bound of a linear expression (row) have to be 
athos@1405
    85
    /// given by an 
alpar@1294
    86
    /// extended number of type Value, i.e. a finite number of type 
athos@1405
    87
    /// Value or +/-\ref INF.
athos@1389
    88
    virtual void _setRowBounds(int i, Value lb, Value ub);
athos@1389
    89
    /// \e
athos@1389
    90
alpar@1294
    91
alpar@1294
    92
    /// \e
alpar@1390
    93
    virtual void _clearObj();
alpar@1390
    94
    /// \e
alpar@1254
    95
    virtual void _setObjCoeff(int i, Value obj_coef);
alpar@1294
    96
athos@2324
    97
    /// \e
athos@2324
    98
    virtual Value _getObjCoeff(int i);
athos@2324
    99
alpar@1294
   100
    ///\e
alpar@1294
   101
    
alpar@1294
   102
    ///\bug Wrong interface
alpar@1294
   103
    ///
alpar@1303
   104
    virtual SolveExitStatus _solve();
alpar@1294
   105
alpar@1294
   106
    ///\e
alpar@1294
   107
alpar@1294
   108
    ///\bug Wrong interface
alpar@1294
   109
    ///
alpar@1293
   110
    virtual Value _getPrimal(int i);
klao@1796
   111
klao@1796
   112
    ///\e
klao@1796
   113
klao@1796
   114
    ///\bug Wrong interface
klao@1796
   115
    ///
klao@1796
   116
    virtual Value _getDual(int i);
klao@1796
   117
alpar@1294
   118
    ///\e
alpar@1294
   119
alpar@1294
   120
    ///\bug Wrong interface
alpar@1294
   121
    ///
alpar@1312
   122
    virtual Value _getPrimalValue();
klao@1796
   123
alpar@1312
   124
    ///\e
alpar@1312
   125
alpar@1312
   126
    ///\bug Wrong interface
alpar@1312
   127
    ///
alpar@1312
   128
    virtual SolutionStatus _getPrimalStatus();
alpar@1312
   129
athos@1460
   130
    ////e
athos@1460
   131
    virtual SolutionStatus _getDualStatus();
athos@1460
   132
athos@1460
   133
athos@1460
   134
    ///\e
athos@1460
   135
    virtual ProblemTypes _getProblemType();
athos@1460
   136
alpar@1312
   137
    ///\e
alpar@1312
   138
    virtual void _setMax();
alpar@1312
   139
    ///\e
alpar@1312
   140
    virtual void _setMin();
alpar@1843
   141
alpar@1843
   142
    ///\e
athos@2324
   143
    virtual bool _isMax();
athos@2324
   144
athos@2324
   145
athos@2324
   146
athos@2324
   147
    ///\e
alpar@1843
   148
    virtual bool _isBasicCol(int i);
alpar@1843
   149
alpar@1312
   150
    
alpar@1294
   151
alpar@1273
   152
  public:
alpar@1313
   153
    LpSkeleton() : LpSolverBase(), col_num(0), row_num(0) {}
alpar@1254
   154
  };  
alpar@1254
   155
alpar@1254
   156
} //namespace lemon
alpar@1254
   157
alpar@1313
   158
#endif // LEMON_LP_SKELETON