lemon/lp_soplex.h
author alpar
Thu, 01 Mar 2007 16:03:36 +0000
changeset 2379 248152674a9e
parent 2366 bfbdded3763a
child 2391 14a343be7a5a
permissions -rw-r--r--
Prescaling can be turned off
deba@2313
     1
/* -*- C++ -*-
deba@2313
     2
 *
deba@2313
     3
 * This file is a part of LEMON, a generic C++ optimization library
deba@2313
     4
 *
deba@2313
     5
 * Copyright (C) 2003-2006
deba@2313
     6
 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
deba@2313
     7
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
deba@2313
     8
 *
deba@2313
     9
 * Permission to use, modify and distribute this software is granted
deba@2313
    10
 * provided that this copyright notice appears in all copies. For
deba@2313
    11
 * precise terms see the accompanying LICENSE file.
deba@2313
    12
 *
deba@2313
    13
 * This software is provided "AS IS" with no warranty of any kind,
deba@2313
    14
 * express or implied, and with no claim as to its suitability for any
deba@2313
    15
 * purpose.
deba@2313
    16
 *
deba@2313
    17
 */
deba@2313
    18
deba@2313
    19
#ifndef LEMON_LP_SOPLEX_H
deba@2313
    20
#define LEMON_LP_SOPLEX_H
deba@2313
    21
deba@2313
    22
///\file
deba@2313
    23
///\brief Header of the LEMON-SOPLEX lp solver interface.
deba@2313
    24
deba@2313
    25
#include <vector>
deba@2313
    26
#include <string>
deba@2313
    27
deba@2313
    28
#include <lemon/lp_base.h>
deba@2313
    29
deba@2313
    30
// Forward declaration
deba@2313
    31
namespace soplex {
deba@2313
    32
  class SoPlex;
deba@2313
    33
}
deba@2313
    34
deba@2313
    35
namespace lemon {
deba@2313
    36
deba@2370
    37
  /// \ingroup lp_group
deba@2366
    38
  ///
deba@2313
    39
  /// \brief Interface for the SOPLEX solver
deba@2313
    40
  /// 
deba@2366
    41
  /// This class implements an interface for the SoPlex LP solver.
deba@2366
    42
  /// The SoPlex library is an object oriented lp solver library
deba@2366
    43
  /// developed at the Konrad-Zuse-Zentrum für Informationstechnik
deba@2366
    44
  /// Berlin (ZIB). You can find detailed information about it at the
deba@2366
    45
  /// <tt>http://soplex.zib.de</tt> address.
deba@2313
    46
  class LpSoplex :virtual public LpSolverBase {
deba@2313
    47
  protected:
deba@2313
    48
deba@2363
    49
    _lp_bits::RelocateIdHandler relocateIdHandler;
deba@2363
    50
deba@2313
    51
    soplex::SoPlex* soplex;
deba@2363
    52
    bool solved;
deba@2313
    53
deba@2313
    54
    std::vector<std::string> colNames;
deba@2366
    55
    std::map<std::string, int> invColNames;
deba@2313
    56
deba@2363
    57
    std::vector<Value> primal_value;
deba@2363
    58
    std::vector<Value> dual_value;
deba@2313
    59
deba@2313
    60
deba@2313
    61
  public:
deba@2313
    62
deba@2313
    63
    typedef LpSolverBase Parent;
deba@2313
    64
    
deba@2313
    65
deba@2313
    66
    /// \e
deba@2313
    67
    LpSoplex();
deba@2313
    68
    /// \e
deba@2313
    69
    ~LpSoplex();
deba@2313
    70
deba@2313
    71
  protected:
deba@2313
    72
deba@2313
    73
    virtual LpSolverBase &_newLp();
deba@2313
    74
    virtual LpSolverBase &_copyLp();
deba@2313
    75
deba@2313
    76
    virtual int _addCol();
deba@2313
    77
    virtual int _addRow();
deba@2313
    78
    virtual void _eraseCol(int i);
deba@2313
    79
    virtual void _eraseRow(int i);
deba@2366
    80
    virtual void _getColName(int col, std::string & name) const;
deba@2313
    81
    virtual void _setColName(int col, const std::string & name);
deba@2366
    82
    virtual int _colByName(const std::string& name) const;
deba@2364
    83
    virtual void _setRowCoeffs(int i, ConstRowIterator b, ConstRowIterator e);
deba@2366
    84
    virtual void _getRowCoeffs(int i, RowIterator b) const;
deba@2364
    85
    virtual void _setColCoeffs(int i, ConstColIterator b, ConstColIterator e);
deba@2366
    86
    virtual void _getColCoeffs(int i, ColIterator b) const;
deba@2313
    87
    virtual void _setCoeff(int row, int col, Value value);
deba@2366
    88
    virtual Value _getCoeff(int row, int col) const;
deba@2313
    89
    virtual void _setColLowerBound(int i, Value value);
deba@2366
    90
    virtual Value _getColLowerBound(int i) const;
deba@2313
    91
    virtual void _setColUpperBound(int i, Value value);
deba@2366
    92
    virtual Value _getColUpperBound(int i) const;
deba@2313
    93
    virtual void _setRowBounds(int i, Value lower, Value upper);
deba@2366
    94
    virtual void _getRowBounds(int i, Value &lower, Value &upper) const;
deba@2313
    95
    virtual void _setObjCoeff(int i, Value obj_coef);
deba@2366
    96
    virtual Value _getObjCoeff(int i) const;
deba@2313
    97
    virtual void _clearObj();
deba@2313
    98
    
deba@2313
    99
    virtual SolveExitStatus _solve();
deba@2366
   100
    virtual Value _getPrimal(int i) const;
deba@2366
   101
    virtual Value _getDual(int i) const;
deba@2366
   102
    virtual Value _getPrimalValue() const;
deba@2366
   103
    virtual bool _isBasicCol(int i) const;
deba@2313
   104
    
deba@2366
   105
    virtual SolutionStatus _getPrimalStatus() const;
deba@2366
   106
    virtual SolutionStatus _getDualStatus() const;
deba@2366
   107
    virtual ProblemTypes _getProblemType() const;
deba@2313
   108
deba@2313
   109
    
deba@2313
   110
    virtual void _setMax();
deba@2313
   111
    virtual void _setMin();
deba@2366
   112
    virtual bool _isMax() const;
deba@2313
   113
deba@2313
   114
  };
deba@2313
   115
} //END OF NAMESPACE LEMON
deba@2313
   116
deba@2313
   117
#endif //LEMON_LP_SOPLEX_H
deba@2313
   118