lemon/cbc.h
author Balazs Dezso <deba@google.com>
Fri, 22 Jan 2021 10:55:32 +0100
changeset 1208 c6aa2cc1af04
parent 1064 fc3854d936f7
permissions -rw-r--r--
Factor out recursion from weighted matching algorithms (#638)
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
 *
alpar@1092
     5
 * Copyright (C) 2003-2013
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
#ifndef LEMON_CBC_H
deba@567
    20
#define LEMON_CBC_H
deba@567
    21
deba@567
    22
///\file
deba@567
    23
///\brief Header of the LEMON-CBC mip solver interface.
deba@567
    24
///\ingroup lp_group
deba@567
    25
deba@567
    26
#include <lemon/lp_base.h>
deba@567
    27
deba@567
    28
class CoinModel;
deba@567
    29
class OsiSolverInterface;
deba@567
    30
class CbcModel;
deba@567
    31
deba@567
    32
namespace lemon {
deba@567
    33
deba@567
    34
  /// \brief Interface for the CBC MIP solver
deba@567
    35
  ///
deba@567
    36
  /// This class implements an interface for the CBC MIP solver.
deba@567
    37
  ///\ingroup lp_group
deba@567
    38
  class CbcMip : public MipSolver {
deba@567
    39
  protected:
deba@567
    40
deba@567
    41
    CoinModel *_prob;
deba@567
    42
    OsiSolverInterface *_osi_solver;
deba@567
    43
    CbcModel *_cbc_model;
deba@567
    44
deba@567
    45
  public:
deba@567
    46
deba@567
    47
    /// \e
deba@567
    48
    CbcMip();
deba@567
    49
    /// \e
deba@567
    50
    CbcMip(const CbcMip&);
deba@567
    51
    /// \e
deba@567
    52
    ~CbcMip();
deba@567
    53
    /// \e
deba@567
    54
    virtual CbcMip* newSolver() const;
deba@567
    55
    /// \e
deba@567
    56
    virtual CbcMip* cloneSolver() const;
deba@567
    57
deba@567
    58
  protected:
deba@567
    59
deba@567
    60
    virtual const char* _solverName() const;
deba@567
    61
deba@567
    62
    virtual int _addCol();
deba@567
    63
    virtual int _addRow();
deba@746
    64
    virtual int _addRow(Value l, ExprIterator b, ExprIterator e, Value u);
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
alpar@877
   123
deba@567
   124
deba@567
   125
  };
deba@567
   126
deba@567
   127
}
deba@567
   128
deba@567
   129
#endif