lemon/cbc.h
author Balazs Dezso <deba@inf.elte.hu>
Sun, 04 Oct 2009 00:28:42 +0200
changeset 793 e4554cd6b2bf
parent 623 745e182d0139
child 956 141f9c0db4a3
permissions -rw-r--r--
Faster add row operation (#203)

One virtual function call instead of more
deba@614
     1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
deba@614
     2
 *
deba@614
     3
 * This file is a part of LEMON, a generic C++ optimization library.
deba@614
     4
 *
deba@614
     5
 * Copyright (C) 2003-2009
deba@614
     6
 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
deba@614
     7
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
deba@614
     8
 *
deba@614
     9
 * Permission to use, modify and distribute this software is granted
deba@614
    10
 * provided that this copyright notice appears in all copies. For
deba@614
    11
 * precise terms see the accompanying LICENSE file.
deba@614
    12
 *
deba@614
    13
 * This software is provided "AS IS" with no warranty of any kind,
deba@614
    14
 * express or implied, and with no claim as to its suitability for any
deba@614
    15
 * purpose.
deba@614
    16
 *
deba@614
    17
 */
deba@614
    18
deba@614
    19
// -*- C++ -*-
deba@614
    20
#ifndef LEMON_CBC_H
deba@614
    21
#define LEMON_CBC_H
deba@614
    22
deba@614
    23
///\file
deba@614
    24
///\brief Header of the LEMON-CBC mip solver interface.
deba@614
    25
///\ingroup lp_group
deba@614
    26
deba@614
    27
#include <lemon/lp_base.h>
deba@614
    28
deba@614
    29
class CoinModel;
deba@614
    30
class OsiSolverInterface;
deba@614
    31
class CbcModel;
deba@614
    32
deba@614
    33
namespace lemon {
deba@614
    34
deba@614
    35
  /// \brief Interface for the CBC MIP solver
deba@614
    36
  ///
deba@614
    37
  /// This class implements an interface for the CBC MIP solver.
deba@614
    38
  ///\ingroup lp_group
deba@614
    39
  class CbcMip : public MipSolver {
deba@614
    40
  protected:
deba@614
    41
deba@614
    42
    CoinModel *_prob;
deba@614
    43
    OsiSolverInterface *_osi_solver;
deba@614
    44
    CbcModel *_cbc_model;
deba@614
    45
deba@614
    46
  public:
deba@614
    47
deba@614
    48
    /// \e
deba@614
    49
    CbcMip();
deba@614
    50
    /// \e
deba@614
    51
    CbcMip(const CbcMip&);
deba@614
    52
    /// \e
deba@614
    53
    ~CbcMip();
deba@614
    54
    /// \e
deba@614
    55
    virtual CbcMip* newSolver() const;
deba@614
    56
    /// \e
deba@614
    57
    virtual CbcMip* cloneSolver() const;
deba@614
    58
deba@614
    59
  protected:
deba@614
    60
deba@614
    61
    virtual const char* _solverName() const;
deba@614
    62
deba@614
    63
    virtual int _addCol();
deba@614
    64
    virtual int _addRow();
deba@793
    65
    virtual int _addRow(Value l, ExprIterator b, ExprIterator e, Value u);
deba@614
    66
deba@614
    67
    virtual void _eraseCol(int i);
deba@614
    68
    virtual void _eraseRow(int i);
deba@614
    69
deba@614
    70
    virtual void _eraseColId(int i);
deba@614
    71
    virtual void _eraseRowId(int i);
deba@614
    72
deba@614
    73
    virtual void _getColName(int col, std::string& name) const;
deba@614
    74
    virtual void _setColName(int col, const std::string& name);
deba@614
    75
    virtual int _colByName(const std::string& name) const;
deba@614
    76
deba@614
    77
    virtual void _getRowName(int row, std::string& name) const;
deba@614
    78
    virtual void _setRowName(int row, const std::string& name);
deba@614
    79
    virtual int _rowByName(const std::string& name) const;
deba@614
    80
deba@614
    81
    virtual void _setRowCoeffs(int i, ExprIterator b, ExprIterator e);
deba@614
    82
    virtual void _getRowCoeffs(int i, InsertIterator b) const;
deba@614
    83
deba@614
    84
    virtual void _setColCoeffs(int i, ExprIterator b, ExprIterator e);
deba@614
    85
    virtual void _getColCoeffs(int i, InsertIterator b) const;
deba@614
    86
deba@614
    87
    virtual void _setCoeff(int row, int col, Value value);
deba@614
    88
    virtual Value _getCoeff(int row, int col) const;
deba@614
    89
deba@614
    90
    virtual void _setColLowerBound(int i, Value value);
deba@614
    91
    virtual Value _getColLowerBound(int i) const;
deba@614
    92
    virtual void _setColUpperBound(int i, Value value);
deba@614
    93
    virtual Value _getColUpperBound(int i) const;
deba@614
    94
deba@614
    95
    virtual void _setRowLowerBound(int i, Value value);
deba@614
    96
    virtual Value _getRowLowerBound(int i) const;
deba@614
    97
    virtual void _setRowUpperBound(int i, Value value);
deba@614
    98
    virtual Value _getRowUpperBound(int i) const;
deba@614
    99
deba@614
   100
    virtual void _setObjCoeffs(ExprIterator b, ExprIterator e);
deba@614
   101
    virtual void _getObjCoeffs(InsertIterator b) const;
deba@614
   102
deba@614
   103
    virtual void _setObjCoeff(int i, Value obj_coef);
deba@614
   104
    virtual Value _getObjCoeff(int i) const;
deba@614
   105
deba@614
   106
    virtual void _setSense(Sense sense);
deba@614
   107
    virtual Sense _getSense() const;
deba@614
   108
deba@614
   109
    virtual ColTypes _getColType(int col) const;
deba@614
   110
    virtual void _setColType(int col, ColTypes col_type);
deba@614
   111
deba@614
   112
    virtual SolveExitStatus _solve();
deba@614
   113
    virtual ProblemType _getType() const;
deba@614
   114
    virtual Value _getSol(int i) const;
deba@614
   115
    virtual Value _getSolValue() const;
deba@614
   116
deba@614
   117
    virtual void _clear();
deba@614
   118
deba@623
   119
    virtual void _messageLevel(MessageLevel level);
deba@623
   120
    void _applyMessageLevel();
deba@614
   121
deba@623
   122
    int _message_level;
deba@614
   123
deba@623
   124
    
deba@614
   125
deba@614
   126
  };
deba@614
   127
deba@614
   128
}
deba@614
   129
deba@614
   130
#endif