source: trunk/Bonmin/experimental/Bcp/BM.cpp @ 42

Last change on this file since 42 was 42, checked in by ladanyi, 13 years ago

B&B running fine; preparing to distribute pseudocosts

  • Property svn:eol-style set to native
  • Property svn:keywords set to "Author Date Id Revision"
File size: 3.8 KB
Line 
1// (C) Copyright International Business Machines Corporation and Carnegie Mellon University 2006
2// All Rights Reserved.
3// This code is published under the Common Public License.
4//
5// Authors :
6// Laszlo Ladanyi, International Business Machines Corporation
7// Pierre Bonami, Carnegie Mellon University,
8//
9// Date : 03/15/2006
10
11#include <sstream>
12
13/* To get the cumulative time spent on a processor just use a gawk command
14   like this below. Look at the output first; probably the process id needs
15   to be prepended to the regexp and the procid may also change the $7 to
16   some other word.
17   gawk -e 'BEGIN {t=0} /^BCP_lp: Time spent in this node:/ {t+=$7} END {print t}' outfile
18*/
19
20#include "CoinHelperFunctions.hpp"
21#include "BonminAmplInterface.hpp"
22#include "TMINLP.hpp"
23#include "OsiClpSolverInterface.hpp"
24#include "BCP_parameters.hpp"
25#include "BCP_lp.hpp"
26#include "BM.hpp"
27#include "BB_cut.hpp"
28#include "CoinDistance.hpp"
29#include "BCP_lp_node.hpp"
30#include "BCP_tm.hpp"
31
32using namespace std;
33
34//#############################################################################
35
36int main(int argc, char* argv[])
37{
38    BM_init user_init;
39    return bcp_main(argc, argv, &user_init);
40}
41
42//#############################################################################
43
44template <>
45void BCP_parameter_set<BM_par>::create_keyword_list() {
46    // Create the list of keywords for parameter file reading
47    keys.push_back(make_pair(BCP_string("BranchOnSos"),
48                             BCP_parameter(BCP_CharPar, BranchOnSos)));
49    keys.push_back(make_pair(BCP_string("PureBranchAndBound"),
50                             BCP_parameter(BCP_CharPar, PureBranchAndBound)));
51    keys.push_back(make_pair(BCP_string("PrintBranchingInfo"),
52                             BCP_parameter(BCP_CharPar, PrintBranchingInfo)));
53    keys.push_back(make_pair(BCP_string("CombinedDistanceAndPriority"),
54                             BCP_parameter(BCP_CharPar,
55                                           CombinedDistanceAndPriority)));
56    keys.push_back(make_pair(BCP_string("SosWithLowPriorityMoreImportant"),
57                             BCP_parameter(BCP_CharPar,
58                                           SosWithLowPriorityMoreImportant)));
59    keys.push_back(make_pair(BCP_string("VarWithLowPriorityMoreImportant"),
60                             BCP_parameter(BCP_CharPar,
61                                           VarWithLowPriorityMoreImportant)));
62    keys.push_back(make_pair(BCP_string("NumNlpFailureMax"),
63                             BCP_parameter(BCP_IntPar, NumNlpFailureMax)));
64    keys.push_back(make_pair(BCP_string("NL_filename"),
65                             BCP_parameter(BCP_StringPar, NL_filename)));
66    keys.push_back(make_pair(BCP_string("IpoptParamfile"),
67                             BCP_parameter(BCP_StringPar, IpoptParamfile)));
68}
69
70/****************************************************************************/
71
72template <>
73void BCP_parameter_set<BM_par>::set_default_entries() {
74    set_entry(BranchOnSos, true);
75    set_entry(PureBranchAndBound, false);
76    set_entry(PrintBranchingInfo, true);
77    set_entry(CombinedDistanceAndPriority, true);
78    set_entry(SosWithLowPriorityMoreImportant, true);
79    set_entry(SosWithLowPriorityMoreImportant, true);
80    set_entry(VarWithLowPriorityMoreImportant, true);
81    set_entry(NumNlpFailureMax, 5);
82    set_entry(NL_filename, "");
83    set_entry(IpoptParamfile, "");
84}
85
86//#############################################################################
87
88BCP_lp_user *
89BM_init::lp_init(BCP_lp_prob& p)
90{
91    return new BM_lp;
92}
93
94/****************************************************************************/
95
96BCP_tm_user *
97BM_init::tm_init(BCP_tm_prob& p,
98                 const int argnum, const char * const * arglist)
99{
100    BM_tm* tm = new BM_tm;
101
102    if (argnum == 2) {
103        tm->par.read_from_file(arglist[1]);
104    } else if (argnum == 1) {
105        // work with defaults
106    } else {
107        tm->par.read_from_arglist(argnum, arglist);
108    }
109
110    tm->readIpopt();
111
112    return tm;
113}
114
115//#############################################################################
116
117BCP_MemPool BM_branching_var::memPool(sizeof(BM_branching_var));
Note: See TracBrowser for help on using the repository browser.