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