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