src/lemon/lp_skeleton.h
author ladanyi
Sat, 21 May 2005 21:04:57 +0000
changeset 1434 d8475431bbbb
parent 1431 ad44b1dd8013
permissions -rw-r--r--
bugfix
alpar@1254
     1
/* -*- C++ -*-
alpar@1313
     2
 * src/lemon/lp_skeleton.h
alpar@1254
     3
 * - Part of LEMON, a generic C++ optimization library
alpar@1254
     4
 *
alpar@1254
     5
 * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
alpar@1359
     6
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
alpar@1254
     7
 *
alpar@1254
     8
 * Permission to use, modify and distribute this software is granted
alpar@1254
     9
 * provided that this copyright notice appears in all copies. For
alpar@1254
    10
 * precise terms see the accompanying LICENSE file.
alpar@1254
    11
 *
alpar@1254
    12
 * This software is provided "AS IS" with no warranty of any kind,
alpar@1254
    13
 * express or implied, and with no claim as to its suitability for any
alpar@1254
    14
 * purpose.
alpar@1254
    15
 *
alpar@1254
    16
 */
alpar@1254
    17
alpar@1313
    18
#ifndef LEMON_LP_SKELETON
alpar@1313
    19
#define LEMON_LP_SKELETON
alpar@1254
    20
ladanyi@1356
    21
#include <lemon/lp_base.h>
alpar@1254
    22
alpar@1254
    23
///\file
alpar@1254
    24
///\brief A skeleton file to implement LP solver interfaces
alpar@1254
    25
namespace lemon {
alpar@1254
    26
  
alpar@1254
    27
  ///A skeleton class to implement LP solver interfaces
alpar@1313
    28
  class LpSkeleton :public LpSolverBase {
alpar@1273
    29
    int col_num,row_num;
alpar@1273
    30
    
alpar@1254
    31
  protected:
alpar@1364
    32
    ///\e
alpar@1364
    33
    virtual LpSolverBase &_newLp();
alpar@1364
    34
    ///\e
alpar@1364
    35
    virtual LpSolverBase &_copyLp();
alpar@1294
    36
    /// \e
alpar@1254
    37
    virtual int _addCol();
alpar@1294
    38
    /// \e
alpar@1254
    39
    virtual int _addRow();
alpar@1294
    40
    /// \e
athos@1432
    41
    virtual void _eraseCol(int i);
athos@1432
    42
    /// \e
athos@1432
    43
    virtual void _eraseRow(int i);
athos@1432
    44
    /// \e
alpar@1294
    45
alpar@1294
    46
    /// \warning Arrays are indexed from 1 (datum at index 0 is ignored)
alpar@1294
    47
    ///
alpar@1254
    48
    virtual void _setRowCoeffs(int i, 
alpar@1254
    49
			       int length,
alpar@1254
    50
                               int  const * indices, 
alpar@1254
    51
                               Value  const * values );
alpar@1294
    52
    /// \e
alpar@1294
    53
alpar@1294
    54
    /// \warning Arrays are indexed from 1 (datum at index 0 is ignored)
alpar@1294
    55
    ///
alpar@1254
    56
    virtual void _setColCoeffs(int i, 
alpar@1254
    57
			       int length,
alpar@1254
    58
                               int  const * indices, 
alpar@1294
    59
                               Value  const * values );
alpar@1294
    60
    
athos@1431
    61
    /// Set one element of the coefficient matrix
athos@1431
    62
    virtual void _setCoeff(int row, int col, Value value);
alpar@1294
    63
alpar@1294
    64
    /// The lower 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 _setColLowerBound(int i, Value value);
alpar@1294
    68
    /// \e
alpar@1294
    69
alpar@1294
    70
    /// The upper 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 _setColUpperBound(int i, Value value);
alpar@1294
    74
    /// \e
alpar@1294
    75
athos@1405
    76
//     /// The lower 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 _setRowLowerBound(int i, Value value);
athos@1405
    80
//     /// \e
athos@1405
    81
athos@1405
    82
//     /// The upper 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 _setRowUpperBound(int i, Value value);
athos@1405
    86
athos@1405
    87
    /// The lower and upper bound of a linear expression (row) have to be 
athos@1405
    88
    /// given by an 
alpar@1294
    89
    /// extended number of type Value, i.e. a finite number of type 
athos@1405
    90
    /// Value or +/-\ref INF.
athos@1389
    91
    virtual void _setRowBounds(int i, Value lb, Value ub);
athos@1389
    92
    /// \e
athos@1389
    93
alpar@1294
    94
alpar@1294
    95
    /// \e
alpar@1390
    96
    virtual void _clearObj();
alpar@1390
    97
    /// \e
alpar@1254
    98
    virtual void _setObjCoeff(int i, Value obj_coef);
alpar@1294
    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);
alpar@1294
   111
    ///\e
alpar@1294
   112
alpar@1294
   113
    ///\bug Wrong interface
alpar@1294
   114
    ///
alpar@1312
   115
    virtual Value _getPrimalValue();
alpar@1312
   116
    ///\e
alpar@1312
   117
alpar@1312
   118
    ///\bug Wrong interface
alpar@1312
   119
    ///
alpar@1312
   120
    virtual SolutionStatus _getPrimalStatus();
alpar@1312
   121
alpar@1312
   122
    ///\e
alpar@1312
   123
    virtual void _setMax();
alpar@1312
   124
    ///\e
alpar@1312
   125
    virtual void _setMin();
alpar@1312
   126
    
alpar@1294
   127
alpar@1273
   128
  public:
alpar@1313
   129
    LpSkeleton() : LpSolverBase(), col_num(0), row_num(0) {}
alpar@1254
   130
  };  
alpar@1254
   131
alpar@1254
   132
} //namespace lemon
alpar@1254
   133
alpar@1313
   134
#endif // LEMON_LP_SKELETON