lemon/lp_skeleton.h
author deba
Mon, 03 Oct 2005 10:11:29 +0000
changeset 1694 6d81e6f7a88d
parent 1460 7c58aabb9eea
child 1796 b6a58c8bea87
permissions -rw-r--r--
Fixing naming conventions
Temporarly bugfix with named-parameters
Removing dead codes
alpar@1254
     1
/* -*- C++ -*-
ladanyi@1435
     2
 * lemon/lp_skeleton.h - Part of LEMON, a generic C++ optimization library
alpar@1254
     3
 *
alpar@1254
     4
 * Copyright (C) 2005 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);
alpar@1294
   110
    ///\e
alpar@1294
   111
alpar@1294
   112
    ///\bug Wrong interface
alpar@1294
   113
    ///
alpar@1312
   114
    virtual Value _getPrimalValue();
alpar@1312
   115
    ///\e
alpar@1312
   116
alpar@1312
   117
    ///\bug Wrong interface
alpar@1312
   118
    ///
alpar@1312
   119
    virtual SolutionStatus _getPrimalStatus();
alpar@1312
   120
athos@1460
   121
    ////e
athos@1460
   122
    virtual SolutionStatus _getDualStatus();
athos@1460
   123
athos@1460
   124
athos@1460
   125
    ///\e
athos@1460
   126
    virtual ProblemTypes _getProblemType();
athos@1460
   127
alpar@1312
   128
    ///\e
alpar@1312
   129
    virtual void _setMax();
alpar@1312
   130
    ///\e
alpar@1312
   131
    virtual void _setMin();
alpar@1312
   132
    
alpar@1294
   133
alpar@1273
   134
  public:
alpar@1313
   135
    LpSkeleton() : LpSolverBase(), col_num(0), row_num(0) {}
alpar@1254
   136
  };  
alpar@1254
   137
alpar@1254
   138
} //namespace lemon
alpar@1254
   139
alpar@1313
   140
#endif // LEMON_LP_SKELETON