lemon/lp_skeleton.h
author alpar
Wed, 09 Aug 2006 12:51:21 +0000
changeset 2170 42fffa713424
parent 1895 5b01801efbc0
child 2312 07e46cbb7d85
permissions -rw-r--r--
Do not list the header itself.
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
alpar@1895
    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
alpar@1294
    51
alpar@1294
    52
    /// \warning Arrays are indexed from 1 (datum at index 0 is ignored)
alpar@1294
    53
    ///
alpar@1254
    54
    virtual void _setRowCoeffs(int i, 
alpar@1254
    55
			       int length,
alpar@1254
    56
                               int  const * indices, 
alpar@1254
    57
                               Value  const * values );
alpar@1294
    58
    /// \e
alpar@1294
    59
alpar@1294
    60
    /// \warning Arrays are indexed from 1 (datum at index 0 is ignored)
alpar@1294
    61
    ///
alpar@1254
    62
    virtual void _setColCoeffs(int i, 
alpar@1254
    63
			       int length,
alpar@1254
    64
                               int  const * indices, 
alpar@1294
    65
                               Value  const * values );
alpar@1294
    66
    
athos@1431
    67
    /// Set one element of the coefficient matrix
athos@1431
    68
    virtual void _setCoeff(int row, int col, Value value);
alpar@1294
    69
alpar@1294
    70
    /// The lower bound of a variable (column) have to be given by an 
alpar@1294
    71
    /// extended number of type Value, i.e. a finite number of type 
alpar@1294
    72
    /// Value or -\ref INF.
alpar@1254
    73
    virtual void _setColLowerBound(int i, Value value);
alpar@1294
    74
    /// \e
alpar@1294
    75
alpar@1294
    76
    /// The upper bound of a variable (column) have to be given by an 
alpar@1294
    77
    /// extended number of type Value, i.e. a finite number of type 
alpar@1294
    78
    /// Value or \ref INF.
alpar@1254
    79
    virtual void _setColUpperBound(int i, Value value);
alpar@1294
    80
    /// \e
alpar@1294
    81
athos@1405
    82
//     /// The lower bound of a linear expression (row) have to be given by an 
athos@1405
    83
//     /// extended number of type Value, i.e. a finite number of type 
athos@1405
    84
//     /// Value or -\ref INF.
athos@1405
    85
//     virtual void _setRowLowerBound(int i, Value value);
athos@1405
    86
//     /// \e
athos@1405
    87
athos@1405
    88
//     /// The upper 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 _setRowUpperBound(int i, Value value);
athos@1405
    92
athos@1405
    93
    /// The lower and upper bound of a linear expression (row) have to be 
athos@1405
    94
    /// given by an 
alpar@1294
    95
    /// extended number of type Value, i.e. a finite number of type 
athos@1405
    96
    /// Value or +/-\ref INF.
athos@1389
    97
    virtual void _setRowBounds(int i, Value lb, Value ub);
athos@1389
    98
    /// \e
athos@1389
    99
alpar@1294
   100
alpar@1294
   101
    /// \e
alpar@1390
   102
    virtual void _clearObj();
alpar@1390
   103
    /// \e
alpar@1254
   104
    virtual void _setObjCoeff(int i, Value obj_coef);
alpar@1294
   105
alpar@1294
   106
    ///\e
alpar@1294
   107
    
alpar@1294
   108
    ///\bug Wrong interface
alpar@1294
   109
    ///
alpar@1303
   110
    virtual SolveExitStatus _solve();
alpar@1294
   111
alpar@1294
   112
    ///\e
alpar@1294
   113
alpar@1294
   114
    ///\bug Wrong interface
alpar@1294
   115
    ///
alpar@1293
   116
    virtual Value _getPrimal(int i);
klao@1796
   117
klao@1796
   118
    ///\e
klao@1796
   119
klao@1796
   120
    ///\bug Wrong interface
klao@1796
   121
    ///
klao@1796
   122
    virtual Value _getDual(int i);
klao@1796
   123
alpar@1294
   124
    ///\e
alpar@1294
   125
alpar@1294
   126
    ///\bug Wrong interface
alpar@1294
   127
    ///
alpar@1312
   128
    virtual Value _getPrimalValue();
klao@1796
   129
alpar@1312
   130
    ///\e
alpar@1312
   131
alpar@1312
   132
    ///\bug Wrong interface
alpar@1312
   133
    ///
alpar@1312
   134
    virtual SolutionStatus _getPrimalStatus();
alpar@1312
   135
athos@1460
   136
    ////e
athos@1460
   137
    virtual SolutionStatus _getDualStatus();
athos@1460
   138
athos@1460
   139
athos@1460
   140
    ///\e
athos@1460
   141
    virtual ProblemTypes _getProblemType();
athos@1460
   142
alpar@1312
   143
    ///\e
alpar@1312
   144
    virtual void _setMax();
alpar@1312
   145
    ///\e
alpar@1312
   146
    virtual void _setMin();
alpar@1843
   147
alpar@1843
   148
    ///\e
alpar@1843
   149
    virtual bool _isBasicCol(int i);
alpar@1843
   150
alpar@1312
   151
    
alpar@1294
   152
alpar@1273
   153
  public:
alpar@1313
   154
    LpSkeleton() : LpSolverBase(), col_num(0), row_num(0) {}
alpar@1254
   155
  };  
alpar@1254
   156
alpar@1254
   157
} //namespace lemon
alpar@1254
   158
alpar@1313
   159
#endif // LEMON_LP_SKELETON