lemon/cbc.h
changeset 559 3314f58e7b25
child 568 745e182d0139
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/lemon/cbc.h	Wed Apr 01 22:58:58 2009 +0200
     1.3 @@ -0,0 +1,150 @@
     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-2009
     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 +// -*- C++ -*-
    1.23 +#ifndef LEMON_CBC_H
    1.24 +#define LEMON_CBC_H
    1.25 +
    1.26 +///\file
    1.27 +///\brief Header of the LEMON-CBC mip solver interface.
    1.28 +///\ingroup lp_group
    1.29 +
    1.30 +#include <lemon/lp_base.h>
    1.31 +
    1.32 +class CoinModel;
    1.33 +class OsiSolverInterface;
    1.34 +class CbcModel;
    1.35 +
    1.36 +namespace lemon {
    1.37 +
    1.38 +  /// \brief Interface for the CBC MIP solver
    1.39 +  ///
    1.40 +  /// This class implements an interface for the CBC MIP solver.
    1.41 +  ///\ingroup lp_group
    1.42 +  class CbcMip : public MipSolver {
    1.43 +  protected:
    1.44 +
    1.45 +    CoinModel *_prob;
    1.46 +    OsiSolverInterface *_osi_solver;
    1.47 +    CbcModel *_cbc_model;
    1.48 +
    1.49 +  public:
    1.50 +
    1.51 +    /// \e
    1.52 +    CbcMip();
    1.53 +    /// \e
    1.54 +    CbcMip(const CbcMip&);
    1.55 +    /// \e
    1.56 +    ~CbcMip();
    1.57 +    /// \e
    1.58 +    virtual CbcMip* newSolver() const;
    1.59 +    /// \e
    1.60 +    virtual CbcMip* cloneSolver() const;
    1.61 +
    1.62 +  protected:
    1.63 +
    1.64 +    virtual const char* _solverName() const;
    1.65 +
    1.66 +    virtual int _addCol();
    1.67 +    virtual int _addRow();
    1.68 +
    1.69 +    virtual void _eraseCol(int i);
    1.70 +    virtual void _eraseRow(int i);
    1.71 +
    1.72 +    virtual void _eraseColId(int i);
    1.73 +    virtual void _eraseRowId(int i);
    1.74 +
    1.75 +    virtual void _getColName(int col, std::string& name) const;
    1.76 +    virtual void _setColName(int col, const std::string& name);
    1.77 +    virtual int _colByName(const std::string& name) const;
    1.78 +
    1.79 +    virtual void _getRowName(int row, std::string& name) const;
    1.80 +    virtual void _setRowName(int row, const std::string& name);
    1.81 +    virtual int _rowByName(const std::string& name) const;
    1.82 +
    1.83 +    virtual void _setRowCoeffs(int i, ExprIterator b, ExprIterator e);
    1.84 +    virtual void _getRowCoeffs(int i, InsertIterator b) const;
    1.85 +
    1.86 +    virtual void _setColCoeffs(int i, ExprIterator b, ExprIterator e);
    1.87 +    virtual void _getColCoeffs(int i, InsertIterator b) const;
    1.88 +
    1.89 +    virtual void _setCoeff(int row, int col, Value value);
    1.90 +    virtual Value _getCoeff(int row, int col) const;
    1.91 +
    1.92 +    virtual void _setColLowerBound(int i, Value value);
    1.93 +    virtual Value _getColLowerBound(int i) const;
    1.94 +    virtual void _setColUpperBound(int i, Value value);
    1.95 +    virtual Value _getColUpperBound(int i) const;
    1.96 +
    1.97 +    virtual void _setRowLowerBound(int i, Value value);
    1.98 +    virtual Value _getRowLowerBound(int i) const;
    1.99 +    virtual void _setRowUpperBound(int i, Value value);
   1.100 +    virtual Value _getRowUpperBound(int i) const;
   1.101 +
   1.102 +    virtual void _setObjCoeffs(ExprIterator b, ExprIterator e);
   1.103 +    virtual void _getObjCoeffs(InsertIterator b) const;
   1.104 +
   1.105 +    virtual void _setObjCoeff(int i, Value obj_coef);
   1.106 +    virtual Value _getObjCoeff(int i) const;
   1.107 +
   1.108 +    virtual void _setSense(Sense sense);
   1.109 +    virtual Sense _getSense() const;
   1.110 +
   1.111 +    virtual ColTypes _getColType(int col) const;
   1.112 +    virtual void _setColType(int col, ColTypes col_type);
   1.113 +
   1.114 +    virtual SolveExitStatus _solve();
   1.115 +    virtual ProblemType _getType() const;
   1.116 +    virtual Value _getSol(int i) const;
   1.117 +    virtual Value _getSolValue() const;
   1.118 +
   1.119 +    virtual void _clear();
   1.120 +
   1.121 +  public:
   1.122 +
   1.123 +    ///Enum for \c messageLevel() parameter
   1.124 +    enum MessageLevel {
   1.125 +      /// no output (default value)
   1.126 +      MESSAGE_NO_OUTPUT = 0,
   1.127 +      /// error messages only
   1.128 +      MESSAGE_ERROR_MESSAGE = 1,
   1.129 +      /// normal output
   1.130 +      MESSAGE_NORMAL_OUTPUT = 2,
   1.131 +      /// full output (includes informational messages)
   1.132 +      MESSAGE_FULL_OUTPUT = 3
   1.133 +    };
   1.134 +
   1.135 +  private:
   1.136 +
   1.137 +    MessageLevel _message_level;
   1.138 +
   1.139 +  public:
   1.140 +
   1.141 +    ///Set the verbosity of the messages
   1.142 +
   1.143 +    ///Set the verbosity of the messages
   1.144 +    ///
   1.145 +    ///\param m is the level of the messages output by the solver routines.
   1.146 +    void messageLevel(MessageLevel m);
   1.147 +
   1.148 +
   1.149 +  };
   1.150 +
   1.151 +}
   1.152 +
   1.153 +#endif