lemon/lp_skeleton.h
author deba
Wed, 29 Nov 2006 17:32:03 +0000
changeset 2314 dbbd5c514163
parent 1956 a055123339d5
child 2324 18fc834761d9
permissions -rw-r--r--
checking soplex
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
alpar@1294
    58
    /// The lower bound of a variable (column) have to be given by an 
alpar@1294
    59
    /// extended number of type Value, i.e. a finite number of type 
alpar@1294
    60
    /// Value or -\ref INF.
alpar@1254
    61
    virtual void _setColLowerBound(int i, Value value);
alpar@1294
    62
    /// \e
alpar@1294
    63
alpar@1294
    64
    /// The upper bound of a variable (column) have to be given by an 
alpar@1294
    65
    /// extended number of type Value, i.e. a finite number of type 
alpar@1294
    66
    /// Value or \ref INF.
alpar@1254
    67
    virtual void _setColUpperBound(int i, Value value);
alpar@1294
    68
    /// \e
alpar@1294
    69
athos@1405
    70
//     /// The lower bound of a linear expression (row) have to be given by an 
athos@1405
    71
//     /// extended number of type Value, i.e. a finite number of type 
athos@1405
    72
//     /// Value or -\ref INF.
athos@1405
    73
//     virtual void _setRowLowerBound(int i, Value value);
athos@1405
    74
//     /// \e
athos@1405
    75
athos@1405
    76
//     /// The upper bound of a linear expression (row) have to be given by an 
athos@1405
    77
//     /// extended number of type Value, i.e. a finite number of type 
athos@1405
    78
//     /// Value or \ref INF.
athos@1405
    79
//     virtual void _setRowUpperBound(int i, Value value);
athos@1405
    80
athos@1405
    81
    /// The lower and upper bound of a linear expression (row) have to be 
athos@1405
    82
    /// given by an 
alpar@1294
    83
    /// extended number of type Value, i.e. a finite number of type 
athos@1405
    84
    /// Value or +/-\ref INF.
athos@1389
    85
    virtual void _setRowBounds(int i, Value lb, Value ub);
athos@1389
    86
    /// \e
athos@1389
    87
alpar@1294
    88
alpar@1294
    89
    /// \e
alpar@1390
    90
    virtual void _clearObj();
alpar@1390
    91
    /// \e
alpar@1254
    92
    virtual void _setObjCoeff(int i, Value obj_coef);
alpar@1294
    93
alpar@1294
    94
    ///\e
alpar@1294
    95
    
alpar@1294
    96
    ///\bug Wrong interface
alpar@1294
    97
    ///
alpar@1303
    98
    virtual SolveExitStatus _solve();
alpar@1294
    99
alpar@1294
   100
    ///\e
alpar@1294
   101
alpar@1294
   102
    ///\bug Wrong interface
alpar@1294
   103
    ///
alpar@1293
   104
    virtual Value _getPrimal(int i);
klao@1796
   105
klao@1796
   106
    ///\e
klao@1796
   107
klao@1796
   108
    ///\bug Wrong interface
klao@1796
   109
    ///
klao@1796
   110
    virtual Value _getDual(int i);
klao@1796
   111
alpar@1294
   112
    ///\e
alpar@1294
   113
alpar@1294
   114
    ///\bug Wrong interface
alpar@1294
   115
    ///
alpar@1312
   116
    virtual Value _getPrimalValue();
klao@1796
   117
alpar@1312
   118
    ///\e
alpar@1312
   119
alpar@1312
   120
    ///\bug Wrong interface
alpar@1312
   121
    ///
alpar@1312
   122
    virtual SolutionStatus _getPrimalStatus();
alpar@1312
   123
athos@1460
   124
    ////e
athos@1460
   125
    virtual SolutionStatus _getDualStatus();
athos@1460
   126
athos@1460
   127
athos@1460
   128
    ///\e
athos@1460
   129
    virtual ProblemTypes _getProblemType();
athos@1460
   130
alpar@1312
   131
    ///\e
alpar@1312
   132
    virtual void _setMax();
alpar@1312
   133
    ///\e
alpar@1312
   134
    virtual void _setMin();
alpar@1843
   135
alpar@1843
   136
    ///\e
alpar@1843
   137
    virtual bool _isBasicCol(int i);
alpar@1843
   138
alpar@1312
   139
    
alpar@1294
   140
alpar@1273
   141
  public:
alpar@1313
   142
    LpSkeleton() : LpSolverBase(), col_num(0), row_num(0) {}
alpar@1254
   143
  };  
alpar@1254
   144
alpar@1254
   145
} //namespace lemon
alpar@1254
   146
alpar@1313
   147
#endif // LEMON_LP_SKELETON