source: branches/devel/Bonmin/src/CbcBonmin/BonCbcLpStrategy.cpp @ 62

Last change on this file since 62 was 62, checked in by pbonami, 13 years ago

astyled the devel branch

  • Property svn:eol-style set to native
  • Property svn:keywords set to "Author Date Id Revision"
File size: 3.1 KB
Line 
1// (C) Copyright Carnegie Mellon University 2006
2// All Rights Reserved.
3// This code is published under the Common Public License.
4//
5// Authors :
6// Pierre Bonami, Carnegie Mellon University,
7//
8// Date : 03/15/2006
9
10#include "BonCbcLpStrategy.hpp"
11
12
13// Cut generators
14#include "CglGomory.hpp"
15#include "CglProbing.hpp"
16#include "CglKnapsackCover.hpp"
17#include "CglOddHole.hpp"
18#include "CglClique.hpp"
19#include "CglFlowCover.hpp"
20#include "CglMixedIntegerRounding.hpp"
21#include "CglTwomir.hpp"
22#include "CglPreProcess.hpp"
23
24
25// Node selection
26#include "CbcCompareUser.hpp"
27#include "CbcCompareActual.hpp"
28
29#include "CbcBranchUser.hpp"
30
31
32namespace Bonmin
33{
34  CbcOaStrategy::CbcOaStrategy(int migFreq,
35      int probFreq,
36      int mirFreq,
37      int coverFreq,
38      int minReliability,
39      int numberStrong,
40      int nodeSelection,
41      double intTol,
42      int logLevel
43                              ):
44      CbcStrategy(),
45      migFreq_(migFreq),
46      probFreq_(probFreq),
47      mirFreq_(mirFreq),
48      coverFreq_(coverFreq),
49      minReliability_(minReliability),
50      numberStrong_(numberStrong),
51      nodeSelection_(nodeSelection),
52      intTol_(intTol),
53      logLevel_(logLevel)
54  {
55    setPreProcessState(0);
56  }
57
58  CbcStrategy *
59  CbcOaStrategy::clone () const
60  {
61    return new CbcOaStrategy(migFreq_, probFreq_,  mirFreq_, coverFreq_, minReliability_,
62        numberStrong_, nodeSelection_, intTol_,
63        logLevel_);
64  }
65
66  void
67  CbcOaStrategy::setupCutGenerators(CbcModel & model)
68  {
69
70    CglGomory miGGen;
71
72    CglProbing probGen;
73    probGen.setUsingObjective(true);
74    probGen.setMaxPass(3);
75    probGen.setMaxProbe(100);
76    probGen.setMaxLook(50);
77
78    CglKnapsackCover knapsackGen;
79    CglMixedIntegerRounding mixedGen;
80
81    if (migFreq_ != 0)
82      model.addCutGenerator(&miGGen,migFreq_,"GMI");
83    if (probFreq_ != 0)
84      model.addCutGenerator(&probGen,probFreq_,"Probing");
85    if (coverFreq_ != 0)
86      model.addCutGenerator(&knapsackGen,coverFreq_,"covers");
87    if (mirFreq_ != 0)
88      model.addCutGenerator(&mixedGen,mirFreq_,"MIR");
89
90  }
91
92/// Setup heuristics
93  void
94  CbcOaStrategy::setupHeuristics(CbcModel & model)
95{}
96
97/// Do printing stuff
98  void
99  CbcOaStrategy::setupPrinting(CbcModel & model,int modelLogLevel)
100  {
101    //  throw -1;
102    model.messageHandler()->setLogLevel(logLevel_);
103    model.solver()->messageHandler()->setLogLevel(0);
104    model.setPrintFrequency(100);
105  }
106
107// Other stuff e.g. strong branching
108  void
109  CbcOaStrategy::setupOther(CbcModel & model)
110  {
111    model.setNumberStrong(numberStrong_);
112    model.setNumberBeforeTrust(minReliability_);
113
114    model.setIntegerTolerance(intTol_);
115
116    // Definition of node selection strategy
117    CbcCompareObjective compare0;
118    CbcCompareDepth compare1;
119    CbcCompareUser compare2;
120    if (nodeSelection_==0) {
121      model.setNodeComparison(compare0);
122    }
123    else if (nodeSelection_==1) {
124      model.setNodeComparison(compare1);
125    }
126    else if (nodeSelection_==2) {
127      compare2.setWeight(0.0);
128      model.setNodeComparison(compare2);
129    }
130    else if (nodeSelection_==3) {
131      model.setNodeComparison(compare2);
132    }
133
134  }
135
136}
Note: See TracBrowser for help on using the repository browser.