lemon/soplex.h
author Alpar Juttner <alpar@cs.elte.hu>
Sat, 25 May 2013 06:59:31 +0200
changeset 1064 fc3854d936f7
parent 746 e4554cd6b2bf
child 1092 dceba191c00d
permissions -rw-r--r--
Enable/disable options for LP/MIP backends (#465)
alpar@461
     1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
alpar@461
     2
 *
alpar@461
     3
 * This file is a part of LEMON, a generic C++ optimization library.
alpar@461
     4
 *
alpar@877
     5
 * Copyright (C) 2003-2010
alpar@461
     6
 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
alpar@461
     7
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
alpar@461
     8
 *
alpar@461
     9
 * Permission to use, modify and distribute this software is granted
alpar@461
    10
 * provided that this copyright notice appears in all copies. For
alpar@461
    11
 * precise terms see the accompanying LICENSE file.
alpar@461
    12
 *
alpar@461
    13
 * This software is provided "AS IS" with no warranty of any kind,
alpar@461
    14
 * express or implied, and with no claim as to its suitability for any
alpar@461
    15
 * purpose.
alpar@461
    16
 *
alpar@461
    17
 */
alpar@461
    18
alpar@461
    19
#ifndef LEMON_SOPLEX_H
alpar@461
    20
#define LEMON_SOPLEX_H
alpar@461
    21
alpar@461
    22
///\file
alpar@461
    23
///\brief Header of the LEMON-SOPLEX lp solver interface.
alpar@461
    24
alpar@461
    25
#include <vector>
alpar@461
    26
#include <string>
alpar@461
    27
alpar@461
    28
#include <lemon/lp_base.h>
alpar@461
    29
alpar@461
    30
// Forward declaration
alpar@461
    31
namespace soplex {
alpar@461
    32
  class SoPlex;
alpar@461
    33
}
alpar@461
    34
alpar@461
    35
namespace lemon {
alpar@461
    36
alpar@461
    37
  /// \ingroup lp_group
alpar@461
    38
  ///
alpar@461
    39
  /// \brief Interface for the SOPLEX solver
alpar@461
    40
  ///
alpar@461
    41
  /// This class implements an interface for the SoPlex LP solver.
alpar@461
    42
  /// The SoPlex library is an object oriented lp solver library
alpar@461
    43
  /// developed at the Konrad-Zuse-Zentrum für Informationstechnik
alpar@461
    44
  /// Berlin (ZIB). You can find detailed information about it at the
alpar@461
    45
  /// <tt>http://soplex.zib.de</tt> address.
alpar@462
    46
  class SoplexLp : public LpSolver {
alpar@461
    47
  private:
alpar@461
    48
alpar@461
    49
    soplex::SoPlex* soplex;
alpar@461
    50
alpar@461
    51
    std::vector<std::string> _col_names;
alpar@461
    52
    std::map<std::string, int> _col_names_ref;
alpar@461
    53
alpar@461
    54
    std::vector<std::string> _row_names;
alpar@461
    55
    std::map<std::string, int> _row_names_ref;
alpar@461
    56
alpar@461
    57
  private:
alpar@461
    58
alpar@461
    59
    // these values cannot be retrieved element by element
alpar@461
    60
    mutable std::vector<Value> _primal_values;
alpar@461
    61
    mutable std::vector<Value> _dual_values;
alpar@461
    62
alpar@461
    63
    mutable std::vector<Value> _primal_ray;
alpar@461
    64
    mutable std::vector<Value> _dual_ray;
alpar@461
    65
alpar@461
    66
    void _clear_temporals();
alpar@461
    67
alpar@461
    68
  public:
alpar@461
    69
alpar@461
    70
    /// \e
alpar@462
    71
    SoplexLp();
alpar@461
    72
    /// \e
alpar@462
    73
    SoplexLp(const SoplexLp&);
alpar@461
    74
    /// \e
alpar@462
    75
    ~SoplexLp();
alpar@540
    76
    /// \e
alpar@540
    77
    virtual SoplexLp* newSolver() const;
alpar@540
    78
    /// \e
alpar@540
    79
    virtual SoplexLp* cloneSolver() const;
alpar@461
    80
alpar@461
    81
  protected:
alpar@461
    82
alpar@461
    83
    virtual const char* _solverName() const;
alpar@461
    84
alpar@461
    85
    virtual int _addCol();
alpar@461
    86
    virtual int _addRow();
deba@746
    87
    virtual int _addRow(Value l, ExprIterator b, ExprIterator e, Value u);
alpar@461
    88
alpar@461
    89
    virtual void _eraseCol(int i);
alpar@461
    90
    virtual void _eraseRow(int i);
alpar@461
    91
alpar@461
    92
    virtual void _eraseColId(int i);
alpar@461
    93
    virtual void _eraseRowId(int i);
alpar@461
    94
alpar@461
    95
    virtual void _getColName(int col, std::string& name) const;
alpar@461
    96
    virtual void _setColName(int col, const std::string& name);
alpar@461
    97
    virtual int _colByName(const std::string& name) const;
alpar@461
    98
alpar@461
    99
    virtual void _getRowName(int row, std::string& name) const;
alpar@461
   100
    virtual void _setRowName(int row, const std::string& name);
alpar@461
   101
    virtual int _rowByName(const std::string& name) const;
alpar@461
   102
alpar@461
   103
    virtual void _setRowCoeffs(int i, ExprIterator b, ExprIterator e);
alpar@461
   104
    virtual void _getRowCoeffs(int i, InsertIterator b) const;
alpar@461
   105
alpar@461
   106
    virtual void _setColCoeffs(int i, ExprIterator b, ExprIterator e);
alpar@461
   107
    virtual void _getColCoeffs(int i, InsertIterator b) const;
alpar@461
   108
alpar@461
   109
    virtual void _setCoeff(int row, int col, Value value);
alpar@461
   110
    virtual Value _getCoeff(int row, int col) const;
alpar@461
   111
alpar@461
   112
    virtual void _setColLowerBound(int i, Value value);
alpar@461
   113
    virtual Value _getColLowerBound(int i) const;
alpar@461
   114
    virtual void _setColUpperBound(int i, Value value);
alpar@461
   115
    virtual Value _getColUpperBound(int i) const;
alpar@461
   116
alpar@461
   117
    virtual void _setRowLowerBound(int i, Value value);
alpar@461
   118
    virtual Value _getRowLowerBound(int i) const;
alpar@461
   119
    virtual void _setRowUpperBound(int i, Value value);
alpar@461
   120
    virtual Value _getRowUpperBound(int i) const;
alpar@461
   121
alpar@461
   122
    virtual void _setObjCoeffs(ExprIterator b, ExprIterator e);
alpar@461
   123
    virtual void _getObjCoeffs(InsertIterator b) const;
alpar@461
   124
alpar@461
   125
    virtual void _setObjCoeff(int i, Value obj_coef);
alpar@461
   126
    virtual Value _getObjCoeff(int i) const;
alpar@461
   127
alpar@461
   128
    virtual void _setSense(Sense sense);
alpar@461
   129
    virtual Sense _getSense() const;
alpar@461
   130
alpar@461
   131
    virtual SolveExitStatus _solve();
alpar@461
   132
    virtual Value _getPrimal(int i) const;
alpar@461
   133
    virtual Value _getDual(int i) const;
alpar@461
   134
alpar@461
   135
    virtual Value _getPrimalValue() const;
alpar@461
   136
alpar@461
   137
    virtual Value _getPrimalRay(int i) const;
alpar@461
   138
    virtual Value _getDualRay(int i) const;
alpar@461
   139
alpar@461
   140
    virtual VarStatus _getColStatus(int i) const;
alpar@461
   141
    virtual VarStatus _getRowStatus(int i) const;
alpar@461
   142
alpar@461
   143
    virtual ProblemType _getPrimalType() const;
alpar@461
   144
    virtual ProblemType _getDualType() const;
alpar@461
   145
alpar@461
   146
    virtual void _clear();
alpar@461
   147
deba@576
   148
    void _messageLevel(MessageLevel m);
deba@576
   149
    void _applyMessageLevel();
deba@576
   150
deba@576
   151
    int _message_level;
deba@576
   152
alpar@461
   153
  };
alpar@461
   154
alpar@461
   155
} //END OF NAMESPACE LEMON
alpar@461
   156
alpar@461
   157
#endif //LEMON_SOPLEX_H
alpar@461
   158