lemon/lp_skeleton.h
author alpar
Fri, 03 Feb 2006 09:18:17 +0000
changeset 1949 5db4ff8d69de
parent 1875 98698b69a902
child 1956 a055123339d5
permissions -rw-r--r--
Fight with Doxygen.
Victory hasn't been reached yet, but it's on the horizon.
alpar@1254
     1
/* -*- C++ -*-
ladanyi@1435
     2
 * lemon/lp_skeleton.h - Part of LEMON, a generic C++ optimization library
alpar@1254
     3
 *
alpar@1875
     4
 * Copyright (C) 2006 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
alpar@1359
     5
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
alpar@1254
     6
 *
alpar@1254
     7
 * Permission to use, modify and distribute this software is granted
alpar@1254
     8
 * provided that this copyright notice appears in all copies. For
alpar@1254
     9
 * precise terms see the accompanying LICENSE file.
alpar@1254
    10
 *
alpar@1254
    11
 * This software is provided "AS IS" with no warranty of any kind,
alpar@1254
    12
 * express or implied, and with no claim as to its suitability for any
alpar@1254
    13
 * purpose.
alpar@1254
    14
 *
alpar@1254
    15
 */
alpar@1254
    16
alpar@1313
    17
#ifndef LEMON_LP_SKELETON
alpar@1313
    18
#define LEMON_LP_SKELETON
alpar@1254
    19
ladanyi@1356
    20
#include <lemon/lp_base.h>
alpar@1254
    21
alpar@1254
    22
///\file
alpar@1254
    23
///\brief A skeleton file to implement LP solver interfaces
alpar@1254
    24
namespace lemon {
athos@1508
    25
alpar@1254
    26
  ///A skeleton class to implement LP solver interfaces
alpar@1313
    27
  class LpSkeleton :public LpSolverBase {
alpar@1273
    28
    int col_num,row_num;
alpar@1273
    29
    
alpar@1254
    30
  protected:
alpar@1364
    31
    ///\e
alpar@1364
    32
    virtual LpSolverBase &_newLp();
alpar@1364
    33
    ///\e
alpar@1364
    34
    virtual LpSolverBase &_copyLp();
alpar@1294
    35
    /// \e
alpar@1254
    36
    virtual int _addCol();
alpar@1294
    37
    /// \e
alpar@1254
    38
    virtual int _addRow();
alpar@1294
    39
    /// \e
athos@1432
    40
    virtual void _eraseCol(int i);
athos@1432
    41
    /// \e
athos@1432
    42
    virtual void _eraseRow(int i);
athos@1432
    43
    /// \e
alpar@1895
    44
    virtual void _getColName(int col,       std::string & name);
alpar@1895
    45
    /// \e
alpar@1895
    46
    virtual void _setColName(int col, const std::string & name);
alpar@1895
    47
alpar@1895
    48
    /// \e
alpar@1294
    49
alpar@1294
    50
    /// \warning Arrays are indexed from 1 (datum at index 0 is ignored)
alpar@1294
    51
    ///
alpar@1254
    52
    virtual void _setRowCoeffs(int i, 
alpar@1254
    53
			       int length,
alpar@1254
    54
                               int  const * indices, 
alpar@1254
    55
                               Value  const * values );
alpar@1294
    56
    /// \e
alpar@1294
    57
alpar@1294
    58
    /// \warning Arrays are indexed from 1 (datum at index 0 is ignored)
alpar@1294
    59
    ///
alpar@1254
    60
    virtual void _setColCoeffs(int i, 
alpar@1254
    61
			       int length,
alpar@1254
    62
                               int  const * indices, 
alpar@1294
    63
                               Value  const * values );
alpar@1294
    64
    
athos@1431
    65
    /// Set one element of the coefficient matrix
athos@1431
    66
    virtual void _setCoeff(int row, int col, Value value);
alpar@1294
    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
alpar@1294
    74
    /// The upper bound of a variable (column) have to be given by an 
alpar@1294
    75
    /// extended number of type Value, i.e. a finite number of type 
alpar@1294
    76
    /// Value or \ref INF.
alpar@1254
    77
    virtual void _setColUpperBound(int i, Value value);
alpar@1294
    78
    /// \e
alpar@1294
    79
athos@1405
    80
//     /// The lower bound of a linear expression (row) have to be given by an 
athos@1405
    81
//     /// extended number of type Value, i.e. a finite number of type 
athos@1405
    82
//     /// Value or -\ref INF.
athos@1405
    83
//     virtual void _setRowLowerBound(int i, Value value);
athos@1405
    84
//     /// \e
athos@1405
    85
athos@1405
    86
//     /// The upper bound of a linear expression (row) have to be given by an 
athos@1405
    87
//     /// extended number of type Value, i.e. a finite number of type 
athos@1405
    88
//     /// Value or \ref INF.
athos@1405
    89
//     virtual void _setRowUpperBound(int i, Value value);
athos@1405
    90
athos@1405
    91
    /// The lower and upper bound of a linear expression (row) have to be 
athos@1405
    92
    /// given by an 
alpar@1294
    93
    /// extended number of type Value, i.e. a finite number of type 
athos@1405
    94
    /// Value or +/-\ref INF.
athos@1389
    95
    virtual void _setRowBounds(int i, Value lb, Value ub);
athos@1389
    96
    /// \e
athos@1389
    97
alpar@1294
    98
alpar@1294
    99
    /// \e
alpar@1390
   100
    virtual void _clearObj();
alpar@1390
   101
    /// \e
alpar@1254
   102
    virtual void _setObjCoeff(int i, Value obj_coef);
alpar@1294
   103
alpar@1294
   104
    ///\e
alpar@1294
   105
    
alpar@1294
   106
    ///\bug Wrong interface
alpar@1294
   107
    ///
alpar@1303
   108
    virtual SolveExitStatus _solve();
alpar@1294
   109
alpar@1294
   110
    ///\e
alpar@1294
   111
alpar@1294
   112
    ///\bug Wrong interface
alpar@1294
   113
    ///
alpar@1293
   114
    virtual Value _getPrimal(int i);
klao@1796
   115
klao@1796
   116
    ///\e
klao@1796
   117
klao@1796
   118
    ///\bug Wrong interface
klao@1796
   119
    ///
klao@1796
   120
    virtual Value _getDual(int i);
klao@1796
   121
alpar@1294
   122
    ///\e
alpar@1294
   123
alpar@1294
   124
    ///\bug Wrong interface
alpar@1294
   125
    ///
alpar@1312
   126
    virtual Value _getPrimalValue();
klao@1796
   127
alpar@1312
   128
    ///\e
alpar@1312
   129
alpar@1312
   130
    ///\bug Wrong interface
alpar@1312
   131
    ///
alpar@1312
   132
    virtual SolutionStatus _getPrimalStatus();
alpar@1312
   133
athos@1460
   134
    ////e
athos@1460
   135
    virtual SolutionStatus _getDualStatus();
athos@1460
   136
athos@1460
   137
athos@1460
   138
    ///\e
athos@1460
   139
    virtual ProblemTypes _getProblemType();
athos@1460
   140
alpar@1312
   141
    ///\e
alpar@1312
   142
    virtual void _setMax();
alpar@1312
   143
    ///\e
alpar@1312
   144
    virtual void _setMin();
alpar@1843
   145
alpar@1843
   146
    ///\e
alpar@1843
   147
    virtual bool _isBasicCol(int i);
alpar@1843
   148
alpar@1312
   149
    
alpar@1294
   150
alpar@1273
   151
  public:
alpar@1313
   152
    LpSkeleton() : LpSolverBase(), col_num(0), row_num(0) {}
alpar@1254
   153
  };  
alpar@1254
   154
alpar@1254
   155
} //namespace lemon
alpar@1254
   156
alpar@1313
   157
#endif // LEMON_LP_SKELETON