source: branches/devel/Bonmin/experimental/Bcp/BB_cut.hpp @ 26

Last change on this file since 26 was 1, checked in by andreasw, 13 years ago

imported initial code

  • Property svn:eol-style set to native
  • Property svn:keywords set to "Author Date Id Revision"
File size: 1.5 KB
Line 
1// Copyright (C) 2003, International Business Machines
2// Corporation and others.  All Rights Reserved.
3// File from COIN project Examples/Bac/BB_cut.hpp
4#ifndef _BB_CUT_H
5#define _BB_CUT_H
6
7#include "BCP_cut.hpp"
8#include "BCP_mempool.hpp"
9#include "OsiRowCut.hpp"
10
11class BCP_buffer;
12
13/** Simple representation of a cut by storing non zero coefficients only */ 
14
15/****************************************************************************/
16class BB_cut : public BCP_cut_algo, public OsiRowCut {
17
18private:
19
20    static BCP_MemPool memPool;
21
22public:
23
24    static inline void * operator new(size_t size) {
25        return memPool.alloc(size);
26    }
27
28    static inline void operator delete(void *p, size_t size) {
29        memPool.free(p, size);
30    }
31
32    /// Packing cut to a buffer
33    void pack(BCP_buffer& buf) const;
34
35    /**@name Constructors and destructors */
36    //@{
37    /// Constructor from content of buffer
38    BB_cut(BCP_buffer& buf);
39
40    /// Constructor from an OsiRowCut
41    BB_cut(const OsiRowCut& cut);
42
43    /// Destructor
44    ~BB_cut() {}
45};
46
47/****************************************************************************/
48
49static inline void
50BB_pack_cut(const BCP_cut_algo* cut, BCP_buffer& buf)
51{
52    const BB_cut* bb_cut = dynamic_cast<const BB_cut*>(cut);
53    if (!bb_cut)
54        throw BCP_fatal_error("pack_cut_algo() : unknown cut type!\n");
55    bb_cut->pack(buf);
56}
57
58static inline BCP_cut_algo*
59BB_unpack_cut(BCP_buffer& buf)
60{
61    return new BB_cut(buf);
62}
63
64/****************************************************************************/
65
66#endif
Note: See TracBrowser for help on using the repository browser.