lemon/cbc.h
author Alpar Juttner <alpar@cs.elte.hu>
Tue, 07 Apr 2009 12:56:50 +0100
changeset 571 d5c39e9d1a4e
child 576 745e182d0139
permissions -rw-r--r--
Merge
deba@567
     1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
deba@567
     2
 *
deba@567
     3
 * This file is a part of LEMON, a generic C++ optimization library.
deba@567
     4
 *
deba@567
     5
 * Copyright (C) 2003-2009
deba@567
     6
 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
deba@567
     7
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
deba@567
     8
 *
deba@567
     9
 * Permission to use, modify and distribute this software is granted
deba@567
    10
 * provided that this copyright notice appears in all copies. For
deba@567
    11
 * precise terms see the accompanying LICENSE file.
deba@567
    12
 *
deba@567
    13
 * This software is provided "AS IS" with no warranty of any kind,
deba@567
    14
 * express or implied, and with no claim as to its suitability for any
deba@567
    15
 * purpose.
deba@567
    16
 *
deba@567
    17
 */
deba@567
    18
deba@567
    19
// -*- C++ -*-
deba@567
    20
#ifndef LEMON_CBC_H
deba@567
    21
#define LEMON_CBC_H
deba@567
    22
deba@567
    23
///\file
deba@567
    24
///\brief Header of the LEMON-CBC mip solver interface.
deba@567
    25
///\ingroup lp_group
deba@567
    26
deba@567
    27
#include <lemon/lp_base.h>
deba@567
    28
deba@567
    29
class CoinModel;
deba@567
    30
class OsiSolverInterface;
deba@567
    31
class CbcModel;
deba@567
    32
deba@567
    33
namespace lemon {
deba@567
    34
deba@567
    35
  /// \brief Interface for the CBC MIP solver
deba@567
    36
  ///
deba@567
    37
  /// This class implements an interface for the CBC MIP solver.
deba@567
    38
  ///\ingroup lp_group
deba@567
    39
  class CbcMip : public MipSolver {
deba@567
    40
  protected:
deba@567
    41
deba@567
    42
    CoinModel *_prob;
deba@567
    43
    OsiSolverInterface *_osi_solver;
deba@567
    44
    CbcModel *_cbc_model;
deba@567
    45
deba@567
    46
  public:
deba@567
    47
deba@567
    48
    /// \e
deba@567
    49
    CbcMip();
deba@567
    50
    /// \e
deba@567
    51
    CbcMip(const CbcMip&);
deba@567
    52
    /// \e
deba@567
    53
    ~CbcMip();
deba@567
    54
    /// \e
deba@567
    55
    virtual CbcMip* newSolver() const;
deba@567
    56
    /// \e
deba@567
    57
    virtual CbcMip* cloneSolver() const;
deba@567
    58
deba@567
    59
  protected:
deba@567
    60
deba@567
    61
    virtual const char* _solverName() const;
deba@567
    62
deba@567
    63
    virtual int _addCol();
deba@567
    64
    virtual int _addRow();
deba@567
    65
deba@567
    66
    virtual void _eraseCol(int i);
deba@567
    67
    virtual void _eraseRow(int i);
deba@567
    68
deba@567
    69
    virtual void _eraseColId(int i);
deba@567
    70
    virtual void _eraseRowId(int i);
deba@567
    71
deba@567
    72
    virtual void _getColName(int col, std::string& name) const;
deba@567
    73
    virtual void _setColName(int col, const std::string& name);
deba@567
    74
    virtual int _colByName(const std::string& name) const;
deba@567
    75
deba@567
    76
    virtual void _getRowName(int row, std::string& name) const;
deba@567
    77
    virtual void _setRowName(int row, const std::string& name);
deba@567
    78
    virtual int _rowByName(const std::string& name) const;
deba@567
    79
deba@567
    80
    virtual void _setRowCoeffs(int i, ExprIterator b, ExprIterator e);
deba@567
    81
    virtual void _getRowCoeffs(int i, InsertIterator b) const;
deba@567
    82
deba@567
    83
    virtual void _setColCoeffs(int i, ExprIterator b, ExprIterator e);
deba@567
    84
    virtual void _getColCoeffs(int i, InsertIterator b) const;
deba@567
    85
deba@567
    86
    virtual void _setCoeff(int row, int col, Value value);
deba@567
    87
    virtual Value _getCoeff(int row, int col) const;
deba@567
    88
deba@567
    89
    virtual void _setColLowerBound(int i, Value value);
deba@567
    90
    virtual Value _getColLowerBound(int i) const;
deba@567
    91
    virtual void _setColUpperBound(int i, Value value);
deba@567
    92
    virtual Value _getColUpperBound(int i) const;
deba@567
    93
deba@567
    94
    virtual void _setRowLowerBound(int i, Value value);
deba@567
    95
    virtual Value _getRowLowerBound(int i) const;
deba@567
    96
    virtual void _setRowUpperBound(int i, Value value);
deba@567
    97
    virtual Value _getRowUpperBound(int i) const;
deba@567
    98
deba@567
    99
    virtual void _setObjCoeffs(ExprIterator b, ExprIterator e);
deba@567
   100
    virtual void _getObjCoeffs(InsertIterator b) const;
deba@567
   101
deba@567
   102
    virtual void _setObjCoeff(int i, Value obj_coef);
deba@567
   103
    virtual Value _getObjCoeff(int i) const;
deba@567
   104
deba@567
   105
    virtual void _setSense(Sense sense);
deba@567
   106
    virtual Sense _getSense() const;
deba@567
   107
deba@567
   108
    virtual ColTypes _getColType(int col) const;
deba@567
   109
    virtual void _setColType(int col, ColTypes col_type);
deba@567
   110
deba@567
   111
    virtual SolveExitStatus _solve();
deba@567
   112
    virtual ProblemType _getType() const;
deba@567
   113
    virtual Value _getSol(int i) const;
deba@567
   114
    virtual Value _getSolValue() const;
deba@567
   115
deba@567
   116
    virtual void _clear();
deba@567
   117
deba@567
   118
  public:
deba@567
   119
deba@567
   120
    ///Enum for \c messageLevel() parameter
deba@567
   121
    enum MessageLevel {
deba@567
   122
      /// no output (default value)
deba@567
   123
      MESSAGE_NO_OUTPUT = 0,
deba@567
   124
      /// error messages only
deba@567
   125
      MESSAGE_ERROR_MESSAGE = 1,
deba@567
   126
      /// normal output
deba@567
   127
      MESSAGE_NORMAL_OUTPUT = 2,
deba@567
   128
      /// full output (includes informational messages)
deba@567
   129
      MESSAGE_FULL_OUTPUT = 3
deba@567
   130
    };
deba@567
   131
deba@567
   132
  private:
deba@567
   133
deba@567
   134
    MessageLevel _message_level;
deba@567
   135
deba@567
   136
  public:
deba@567
   137
deba@567
   138
    ///Set the verbosity of the messages
deba@567
   139
deba@567
   140
    ///Set the verbosity of the messages
deba@567
   141
    ///
deba@567
   142
    ///\param m is the level of the messages output by the solver routines.
deba@567
   143
    void messageLevel(MessageLevel m);
deba@567
   144
deba@567
   145
deba@567
   146
  };
deba@567
   147
deba@567
   148
}
deba@567
   149
deba@567
   150
#endif