lemon/soplex.h
changeset 784 1a7fe3bef514
parent 576 745e182d0139
child 877 141f9c0db4a3
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/lemon/soplex.h	Thu Nov 05 15:50:01 2009 +0100
     1.3 @@ -0,0 +1,158 @@
     1.4 +/* -*- mode: C++; indent-tabs-mode: nil; -*-
     1.5 + *
     1.6 + * This file is a part of LEMON, a generic C++ optimization library.
     1.7 + *
     1.8 + * Copyright (C) 2003-2008
     1.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    1.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
    1.11 + *
    1.12 + * Permission to use, modify and distribute this software is granted
    1.13 + * provided that this copyright notice appears in all copies. For
    1.14 + * precise terms see the accompanying LICENSE file.
    1.15 + *
    1.16 + * This software is provided "AS IS" with no warranty of any kind,
    1.17 + * express or implied, and with no claim as to its suitability for any
    1.18 + * purpose.
    1.19 + *
    1.20 + */
    1.21 +
    1.22 +#ifndef LEMON_SOPLEX_H
    1.23 +#define LEMON_SOPLEX_H
    1.24 +
    1.25 +///\file
    1.26 +///\brief Header of the LEMON-SOPLEX lp solver interface.
    1.27 +
    1.28 +#include <vector>
    1.29 +#include <string>
    1.30 +
    1.31 +#include <lemon/lp_base.h>
    1.32 +
    1.33 +// Forward declaration
    1.34 +namespace soplex {
    1.35 +  class SoPlex;
    1.36 +}
    1.37 +
    1.38 +namespace lemon {
    1.39 +
    1.40 +  /// \ingroup lp_group
    1.41 +  ///
    1.42 +  /// \brief Interface for the SOPLEX solver
    1.43 +  ///
    1.44 +  /// This class implements an interface for the SoPlex LP solver.
    1.45 +  /// The SoPlex library is an object oriented lp solver library
    1.46 +  /// developed at the Konrad-Zuse-Zentrum für Informationstechnik
    1.47 +  /// Berlin (ZIB). You can find detailed information about it at the
    1.48 +  /// <tt>http://soplex.zib.de</tt> address.
    1.49 +  class SoplexLp : public LpSolver {
    1.50 +  private:
    1.51 +
    1.52 +    soplex::SoPlex* soplex;
    1.53 +
    1.54 +    std::vector<std::string> _col_names;
    1.55 +    std::map<std::string, int> _col_names_ref;
    1.56 +
    1.57 +    std::vector<std::string> _row_names;
    1.58 +    std::map<std::string, int> _row_names_ref;
    1.59 +
    1.60 +  private:
    1.61 +
    1.62 +    // these values cannot be retrieved element by element
    1.63 +    mutable std::vector<Value> _primal_values;
    1.64 +    mutable std::vector<Value> _dual_values;
    1.65 +
    1.66 +    mutable std::vector<Value> _primal_ray;
    1.67 +    mutable std::vector<Value> _dual_ray;
    1.68 +
    1.69 +    void _clear_temporals();
    1.70 +
    1.71 +  public:
    1.72 +
    1.73 +    /// \e
    1.74 +    SoplexLp();
    1.75 +    /// \e
    1.76 +    SoplexLp(const SoplexLp&);
    1.77 +    /// \e
    1.78 +    ~SoplexLp();
    1.79 +    /// \e
    1.80 +    virtual SoplexLp* newSolver() const;
    1.81 +    /// \e
    1.82 +    virtual SoplexLp* cloneSolver() const;
    1.83 +
    1.84 +  protected:
    1.85 +
    1.86 +    virtual const char* _solverName() const;
    1.87 +
    1.88 +    virtual int _addCol();
    1.89 +    virtual int _addRow();
    1.90 +    virtual int _addRow(Value l, ExprIterator b, ExprIterator e, Value u);
    1.91 +
    1.92 +    virtual void _eraseCol(int i);
    1.93 +    virtual void _eraseRow(int i);
    1.94 +
    1.95 +    virtual void _eraseColId(int i);
    1.96 +    virtual void _eraseRowId(int i);
    1.97 +
    1.98 +    virtual void _getColName(int col, std::string& name) const;
    1.99 +    virtual void _setColName(int col, const std::string& name);
   1.100 +    virtual int _colByName(const std::string& name) const;
   1.101 +
   1.102 +    virtual void _getRowName(int row, std::string& name) const;
   1.103 +    virtual void _setRowName(int row, const std::string& name);
   1.104 +    virtual int _rowByName(const std::string& name) const;
   1.105 +
   1.106 +    virtual void _setRowCoeffs(int i, ExprIterator b, ExprIterator e);
   1.107 +    virtual void _getRowCoeffs(int i, InsertIterator b) const;
   1.108 +
   1.109 +    virtual void _setColCoeffs(int i, ExprIterator b, ExprIterator e);
   1.110 +    virtual void _getColCoeffs(int i, InsertIterator b) const;
   1.111 +
   1.112 +    virtual void _setCoeff(int row, int col, Value value);
   1.113 +    virtual Value _getCoeff(int row, int col) const;
   1.114 +
   1.115 +    virtual void _setColLowerBound(int i, Value value);
   1.116 +    virtual Value _getColLowerBound(int i) const;
   1.117 +    virtual void _setColUpperBound(int i, Value value);
   1.118 +    virtual Value _getColUpperBound(int i) const;
   1.119 +
   1.120 +    virtual void _setRowLowerBound(int i, Value value);
   1.121 +    virtual Value _getRowLowerBound(int i) const;
   1.122 +    virtual void _setRowUpperBound(int i, Value value);
   1.123 +    virtual Value _getRowUpperBound(int i) const;
   1.124 +
   1.125 +    virtual void _setObjCoeffs(ExprIterator b, ExprIterator e);
   1.126 +    virtual void _getObjCoeffs(InsertIterator b) const;
   1.127 +
   1.128 +    virtual void _setObjCoeff(int i, Value obj_coef);
   1.129 +    virtual Value _getObjCoeff(int i) const;
   1.130 +
   1.131 +    virtual void _setSense(Sense sense);
   1.132 +    virtual Sense _getSense() const;
   1.133 +
   1.134 +    virtual SolveExitStatus _solve();
   1.135 +    virtual Value _getPrimal(int i) const;
   1.136 +    virtual Value _getDual(int i) const;
   1.137 +
   1.138 +    virtual Value _getPrimalValue() const;
   1.139 +
   1.140 +    virtual Value _getPrimalRay(int i) const;
   1.141 +    virtual Value _getDualRay(int i) const;
   1.142 +
   1.143 +    virtual VarStatus _getColStatus(int i) const;
   1.144 +    virtual VarStatus _getRowStatus(int i) const;
   1.145 +
   1.146 +    virtual ProblemType _getPrimalType() const;
   1.147 +    virtual ProblemType _getDualType() const;
   1.148 +
   1.149 +    virtual void _clear();
   1.150 +
   1.151 +    void _messageLevel(MessageLevel m);
   1.152 +    void _applyMessageLevel();
   1.153 +
   1.154 +    int _message_level;
   1.155 +
   1.156 +  };
   1.157 +
   1.158 +} //END OF NAMESPACE LEMON
   1.159 +
   1.160 +#endif //LEMON_SOPLEX_H
   1.161 +