lemon/cbc.h
author Akos Ladanyi <ladanyi@tmit.bme.hu>
Fri, 29 May 2009 12:44:37 +0100
changeset 679 9c7639f3a741
parent 567 3314f58e7b25
child 746 e4554cd6b2bf
permissions -rw-r--r--
Minor CMake improvements

* Use the empty ELSE(), ENDIF(), ENDMACRO(), etc. syntax since this improves
readability and requires less typing.
* Use FIND_PACKAGE() instead of INCLUDE().
* Use the value of CMAKE_COMMAND variable instead of cmake, since this works
even if cmake is not in the PATH.
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@576
   118
    virtual void _messageLevel(MessageLevel level);
deba@576
   119
    void _applyMessageLevel();
deba@567
   120
deba@576
   121
    int _message_level;
deba@567
   122
deba@576
   123
    
deba@567
   124
deba@567
   125
  };
deba@567
   126
deba@567
   127
}
deba@567
   128
deba@567
   129
#endif