src/lemon/lp_skeleton.h
author alpar
Thu, 19 May 2005 11:46:42 +0000
changeset 1428 9ba88ddc629c
parent 1390 9c8e464ed940
child 1431 ad44b1dd8013
permissions -rw-r--r--
A very simple xml parser
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
alpar@1294
    41
alpar@1294
    42
    /// \warning Arrays are indexed from 1 (datum at index 0 is ignored)
alpar@1294
    43
    ///
alpar@1254
    44
    virtual void _setRowCoeffs(int i, 
alpar@1254
    45
			       int length,
alpar@1254
    46
                               int  const * indices, 
alpar@1254
    47
                               Value  const * values );
alpar@1294
    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 _setColCoeffs(int i, 
alpar@1254
    53
			       int length,
alpar@1254
    54
                               int  const * indices, 
alpar@1294
    55
                               Value  const * values );
alpar@1294
    56
    
alpar@1294
    57
    /// \e
alpar@1294
    58
alpar@1294
    59
    /// The lower bound of a variable (column) have to be given by an 
alpar@1294
    60
    /// extended number of type Value, i.e. a finite number of type 
alpar@1294
    61
    /// Value or -\ref INF.
alpar@1254
    62
    virtual void _setColLowerBound(int i, Value value);
alpar@1294
    63
    /// \e
alpar@1294
    64
alpar@1294
    65
    /// The upper bound of a variable (column) have to be given by an 
alpar@1294
    66
    /// extended number of type Value, i.e. a finite number of type 
alpar@1294
    67
    /// Value or \ref INF.
alpar@1254
    68
    virtual void _setColUpperBound(int i, Value value);
alpar@1294
    69
    /// \e
alpar@1294
    70
athos@1405
    71
//     /// The lower bound of a linear expression (row) have to be given by an 
athos@1405
    72
//     /// extended number of type Value, i.e. a finite number of type 
athos@1405
    73
//     /// Value or -\ref INF.
athos@1405
    74
//     virtual void _setRowLowerBound(int i, Value value);
athos@1405
    75
//     /// \e
athos@1405
    76
athos@1405
    77
//     /// The upper bound of a linear expression (row) have to be given by an 
athos@1405
    78
//     /// extended number of type Value, i.e. a finite number of type 
athos@1405
    79
//     /// Value or \ref INF.
athos@1405
    80
//     virtual void _setRowUpperBound(int i, Value value);
athos@1405
    81
athos@1405
    82
    /// The lower and upper bound of a linear expression (row) have to be 
athos@1405
    83
    /// given by an 
alpar@1294
    84
    /// extended number of type Value, i.e. a finite number of type 
athos@1405
    85
    /// Value or +/-\ref INF.
athos@1389
    86
    virtual void _setRowBounds(int i, Value lb, Value ub);
athos@1389
    87
    /// \e
athos@1389
    88
alpar@1294
    89
alpar@1294
    90
    /// \e
alpar@1390
    91
    virtual void _clearObj();
alpar@1390
    92
    /// \e
alpar@1254
    93
    virtual void _setObjCoeff(int i, Value obj_coef);
alpar@1294
    94
alpar@1294
    95
    ///\e
alpar@1294
    96
    
alpar@1294
    97
    ///\bug Wrong interface
alpar@1294
    98
    ///
alpar@1303
    99
    virtual SolveExitStatus _solve();
alpar@1294
   100
alpar@1294
   101
    ///\e
alpar@1294
   102
alpar@1294
   103
    ///\bug Wrong interface
alpar@1294
   104
    ///
alpar@1293
   105
    virtual Value _getPrimal(int i);
alpar@1294
   106
    ///\e
alpar@1294
   107
alpar@1294
   108
    ///\bug Wrong interface
alpar@1294
   109
    ///
alpar@1312
   110
    virtual Value _getPrimalValue();
alpar@1312
   111
    ///\e
alpar@1312
   112
alpar@1312
   113
    ///\bug Wrong interface
alpar@1312
   114
    ///
alpar@1312
   115
    virtual SolutionStatus _getPrimalStatus();
alpar@1312
   116
alpar@1312
   117
    ///\e
alpar@1312
   118
    virtual void _setMax();
alpar@1312
   119
    ///\e
alpar@1312
   120
    virtual void _setMin();
alpar@1312
   121
    
alpar@1294
   122
alpar@1273
   123
  public:
alpar@1313
   124
    LpSkeleton() : LpSolverBase(), col_num(0), row_num(0) {}
alpar@1254
   125
  };  
alpar@1254
   126
alpar@1254
   127
} //namespace lemon
alpar@1254
   128
alpar@1313
   129
#endif // LEMON_LP_SKELETON