lemon/cbc.h
author Peter Kovacs <kpeter@inf.elte.hu>
Sun, 23 Oct 2011 22:42:14 +0200
changeset 955 7f6eeffe3cd1
parent 746 e4554cd6b2bf
child 1064 fc3854d936f7
permissions -rw-r--r--
Fix windows-specific compilation error (#429)
     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-2010
     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 // -*- C++ -*-
    20 #ifndef LEMON_CBC_H
    21 #define LEMON_CBC_H
    22 
    23 ///\file
    24 ///\brief Header of the LEMON-CBC mip solver interface.
    25 ///\ingroup lp_group
    26 
    27 #include <lemon/lp_base.h>
    28 
    29 class CoinModel;
    30 class OsiSolverInterface;
    31 class CbcModel;
    32 
    33 namespace lemon {
    34 
    35   /// \brief Interface for the CBC MIP solver
    36   ///
    37   /// This class implements an interface for the CBC MIP solver.
    38   ///\ingroup lp_group
    39   class CbcMip : public MipSolver {
    40   protected:
    41 
    42     CoinModel *_prob;
    43     OsiSolverInterface *_osi_solver;
    44     CbcModel *_cbc_model;
    45 
    46   public:
    47 
    48     /// \e
    49     CbcMip();
    50     /// \e
    51     CbcMip(const CbcMip&);
    52     /// \e
    53     ~CbcMip();
    54     /// \e
    55     virtual CbcMip* newSolver() const;
    56     /// \e
    57     virtual CbcMip* cloneSolver() const;
    58 
    59   protected:
    60 
    61     virtual const char* _solverName() const;
    62 
    63     virtual int _addCol();
    64     virtual int _addRow();
    65     virtual int _addRow(Value l, ExprIterator b, ExprIterator e, Value u);
    66 
    67     virtual void _eraseCol(int i);
    68     virtual void _eraseRow(int i);
    69 
    70     virtual void _eraseColId(int i);
    71     virtual void _eraseRowId(int i);
    72 
    73     virtual void _getColName(int col, std::string& name) const;
    74     virtual void _setColName(int col, const std::string& name);
    75     virtual int _colByName(const std::string& name) const;
    76 
    77     virtual void _getRowName(int row, std::string& name) const;
    78     virtual void _setRowName(int row, const std::string& name);
    79     virtual int _rowByName(const std::string& name) const;
    80 
    81     virtual void _setRowCoeffs(int i, ExprIterator b, ExprIterator e);
    82     virtual void _getRowCoeffs(int i, InsertIterator b) const;
    83 
    84     virtual void _setColCoeffs(int i, ExprIterator b, ExprIterator e);
    85     virtual void _getColCoeffs(int i, InsertIterator b) const;
    86 
    87     virtual void _setCoeff(int row, int col, Value value);
    88     virtual Value _getCoeff(int row, int col) const;
    89 
    90     virtual void _setColLowerBound(int i, Value value);
    91     virtual Value _getColLowerBound(int i) const;
    92     virtual void _setColUpperBound(int i, Value value);
    93     virtual Value _getColUpperBound(int i) const;
    94 
    95     virtual void _setRowLowerBound(int i, Value value);
    96     virtual Value _getRowLowerBound(int i) const;
    97     virtual void _setRowUpperBound(int i, Value value);
    98     virtual Value _getRowUpperBound(int i) const;
    99 
   100     virtual void _setObjCoeffs(ExprIterator b, ExprIterator e);
   101     virtual void _getObjCoeffs(InsertIterator b) const;
   102 
   103     virtual void _setObjCoeff(int i, Value obj_coef);
   104     virtual Value _getObjCoeff(int i) const;
   105 
   106     virtual void _setSense(Sense sense);
   107     virtual Sense _getSense() const;
   108 
   109     virtual ColTypes _getColType(int col) const;
   110     virtual void _setColType(int col, ColTypes col_type);
   111 
   112     virtual SolveExitStatus _solve();
   113     virtual ProblemType _getType() const;
   114     virtual Value _getSol(int i) const;
   115     virtual Value _getSolValue() const;
   116 
   117     virtual void _clear();
   118 
   119     virtual void _messageLevel(MessageLevel level);
   120     void _applyMessageLevel();
   121 
   122     int _message_level;
   123 
   124 
   125 
   126   };
   127 
   128 }
   129 
   130 #endif