lemon/soplex.h
changeset 484 08d495d48089
child 485 9b082b3fb33f
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/lemon/soplex.h	Mon Jan 12 12:26:01 2009 +0000
     1.3 @@ -0,0 +1,151 @@
     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 LpSoplex : 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 +    LpSoplex();
    1.75 +    /// \e
    1.76 +    LpSoplex(const LpSoplex&);
    1.77 +    /// \e
    1.78 +    ~LpSoplex();
    1.79 +
    1.80 +  protected:
    1.81 +
    1.82 +    virtual LpSoplex* _newSolver() const;
    1.83 +    virtual LpSoplex* _cloneSolver() const;
    1.84 +
    1.85 +    virtual const char* _solverName() const;
    1.86 +
    1.87 +    virtual int _addCol();
    1.88 +    virtual int _addRow();
    1.89 +
    1.90 +    virtual void _eraseCol(int i);
    1.91 +    virtual void _eraseRow(int i);
    1.92 +
    1.93 +    virtual void _eraseColId(int i);
    1.94 +    virtual void _eraseRowId(int i);
    1.95 +
    1.96 +    virtual void _getColName(int col, std::string& name) const;
    1.97 +    virtual void _setColName(int col, const std::string& name);
    1.98 +    virtual int _colByName(const std::string& name) const;
    1.99 +
   1.100 +    virtual void _getRowName(int row, std::string& name) const;
   1.101 +    virtual void _setRowName(int row, const std::string& name);
   1.102 +    virtual int _rowByName(const std::string& name) const;
   1.103 +
   1.104 +    virtual void _setRowCoeffs(int i, ExprIterator b, ExprIterator e);
   1.105 +    virtual void _getRowCoeffs(int i, InsertIterator b) const;
   1.106 +
   1.107 +    virtual void _setColCoeffs(int i, ExprIterator b, ExprIterator e);
   1.108 +    virtual void _getColCoeffs(int i, InsertIterator b) const;
   1.109 +
   1.110 +    virtual void _setCoeff(int row, int col, Value value);
   1.111 +    virtual Value _getCoeff(int row, int col) const;
   1.112 +
   1.113 +    virtual void _setColLowerBound(int i, Value value);
   1.114 +    virtual Value _getColLowerBound(int i) const;
   1.115 +    virtual void _setColUpperBound(int i, Value value);
   1.116 +    virtual Value _getColUpperBound(int i) const;
   1.117 +
   1.118 +    virtual void _setRowLowerBound(int i, Value value);
   1.119 +    virtual Value _getRowLowerBound(int i) const;
   1.120 +    virtual void _setRowUpperBound(int i, Value value);
   1.121 +    virtual Value _getRowUpperBound(int i) const;
   1.122 +
   1.123 +    virtual void _setObjCoeffs(ExprIterator b, ExprIterator e);
   1.124 +    virtual void _getObjCoeffs(InsertIterator b) const;
   1.125 +
   1.126 +    virtual void _setObjCoeff(int i, Value obj_coef);
   1.127 +    virtual Value _getObjCoeff(int i) const;
   1.128 +
   1.129 +    virtual void _setSense(Sense sense);
   1.130 +    virtual Sense _getSense() const;
   1.131 +
   1.132 +    virtual SolveExitStatus _solve();
   1.133 +    virtual Value _getPrimal(int i) const;
   1.134 +    virtual Value _getDual(int i) const;
   1.135 +
   1.136 +    virtual Value _getPrimalValue() const;
   1.137 +
   1.138 +    virtual Value _getPrimalRay(int i) const;
   1.139 +    virtual Value _getDualRay(int i) const;
   1.140 +
   1.141 +    virtual VarStatus _getColStatus(int i) const;
   1.142 +    virtual VarStatus _getRowStatus(int i) const;
   1.143 +
   1.144 +    virtual ProblemType _getPrimalType() const;
   1.145 +    virtual ProblemType _getDualType() const;
   1.146 +
   1.147 +    virtual void _clear();
   1.148 +
   1.149 +  };
   1.150 +
   1.151 +} //END OF NAMESPACE LEMON
   1.152 +
   1.153 +#endif //LEMON_SOPLEX_H
   1.154 +