src/lemon/lp_skeleton.h
author athos
Thu, 07 Apr 2005 15:22:03 +0000
changeset 1319 6e277ba3fc76
parent 1312 48f9299b390d
child 1356 10d84041141c
permissions -rw-r--r--
Cplex interface has improved a lot.
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@1254
     6
 * (Egervary Combinatorial Optimization Research Group, 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
alpar@1254
    21
#include"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@1294
    32
    /// \e
alpar@1254
    33
    virtual int _addCol();
alpar@1294
    34
    /// \e
alpar@1254
    35
    virtual int _addRow();
alpar@1294
    36
    /// \e
alpar@1294
    37
alpar@1294
    38
    /// \warning Arrays are indexed from 1 (datum at index 0 is ignored)
alpar@1294
    39
    ///
alpar@1254
    40
    virtual void _setRowCoeffs(int i, 
alpar@1254
    41
			       int length,
alpar@1254
    42
                               int  const * indices, 
alpar@1254
    43
                               Value  const * values );
alpar@1294
    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 _setColCoeffs(int i, 
alpar@1254
    49
			       int length,
alpar@1254
    50
                               int  const * indices, 
alpar@1294
    51
                               Value  const * values );
alpar@1294
    52
    
alpar@1294
    53
    /// \e
alpar@1294
    54
alpar@1294
    55
    /// The lower bound of a variable (column) have to be given by an 
alpar@1294
    56
    /// extended number of type Value, i.e. a finite number of type 
alpar@1294
    57
    /// Value or -\ref INF.
alpar@1254
    58
    virtual void _setColLowerBound(int i, Value value);
alpar@1294
    59
    /// \e
alpar@1294
    60
alpar@1294
    61
    /// The upper bound of a variable (column) have to be given by an 
alpar@1294
    62
    /// extended number of type Value, i.e. a finite number of type 
alpar@1294
    63
    /// Value or \ref INF.
alpar@1254
    64
    virtual void _setColUpperBound(int i, Value value);
alpar@1294
    65
    /// \e
alpar@1294
    66
alpar@1294
    67
    /// The lower bound of a linear expression (row) have to be given by an 
alpar@1294
    68
    /// extended number of type Value, i.e. a finite number of type 
alpar@1294
    69
    /// Value or -\ref INF.
alpar@1254
    70
    virtual void _setRowLowerBound(int i, Value value);
alpar@1294
    71
    /// \e
alpar@1294
    72
alpar@1294
    73
    /// The upper bound of a linear expression (row) have to be given by an 
alpar@1294
    74
    /// extended number of type Value, i.e. a finite number of type 
alpar@1294
    75
    /// Value or \ref INF.
alpar@1254
    76
    virtual void _setRowUpperBound(int i, Value value);
alpar@1294
    77
alpar@1294
    78
    /// \e
alpar@1254
    79
    virtual void _setObjCoeff(int i, Value obj_coef);
alpar@1294
    80
alpar@1294
    81
    ///\e
alpar@1294
    82
    
alpar@1294
    83
    ///\bug Wrong interface
alpar@1294
    84
    ///
alpar@1303
    85
    virtual SolveExitStatus _solve();
alpar@1294
    86
alpar@1294
    87
    ///\e
alpar@1294
    88
alpar@1294
    89
    ///\bug Wrong interface
alpar@1294
    90
    ///
alpar@1293
    91
    virtual Value _getPrimal(int i);
alpar@1294
    92
    ///\e
alpar@1294
    93
alpar@1294
    94
    ///\bug Wrong interface
alpar@1294
    95
    ///
alpar@1312
    96
    virtual Value _getPrimalValue();
alpar@1312
    97
    ///\e
alpar@1312
    98
alpar@1312
    99
    ///\bug Wrong interface
alpar@1312
   100
    ///
alpar@1312
   101
    virtual SolutionStatus _getPrimalStatus();
alpar@1312
   102
alpar@1312
   103
    ///\e
alpar@1312
   104
    virtual void _setMax();
alpar@1312
   105
    ///\e
alpar@1312
   106
    virtual void _setMin();
alpar@1312
   107
    
alpar@1294
   108
alpar@1273
   109
  public:
alpar@1313
   110
    LpSkeleton() : LpSolverBase(), col_num(0), row_num(0) {}
alpar@1254
   111
  };  
alpar@1254
   112
alpar@1254
   113
} //namespace lemon
alpar@1254
   114
alpar@1313
   115
#endif // LEMON_LP_SKELETON