00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include <sstream>
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "BM.hpp"
00020
00021 using namespace std;
00022
00023
00024
00025 int main(int argc, char* argv[])
00026 {
00027 CoinError::printErrors_ = true;
00028 BM_init user_init;
00029 int retcode = -1;
00030 #if 1
00031 retcode = bcp_main(argc, argv, &user_init);
00032 #else
00033 try {
00034 retcode = bcp_main(argc, argv, &user_init);
00035 }
00036 catch(Bonmin::TNLPSolver::UnsolvedError &E) {
00037
00038 E.printError(std::cerr);
00039 }
00040 catch(Bonmin::OsiTMINLPInterface::SimpleError &E) {
00041 std::cerr<<E.className()<<"::"<<E.methodName()
00042 <<std::endl
00043 <<E.message()<<std::endl;
00044 }
00045 catch(CoinError &E) {
00046 std::cerr<<E.className()<<"::"<<E.methodName()
00047 <<std::endl
00048 <<E.message()<<std::endl;
00049 }
00050 catch (Ipopt::OPTION_INVALID &E)
00051 {
00052 std::cerr<<"Ipopt exception : "<<E.Message()<<std::endl;
00053 }
00054 catch(...) {
00055 std::cerr<<" unrecognized exception"<<std::endl;
00056 throw;
00057 }
00058 #endif
00059
00060 return retcode;
00061 }
00062
00063
00064
00065 template <>
00066 void BCP_parameter_set<BM_par>::create_keyword_list() {
00067
00068 keys.push_back(make_pair(BCP_string("BM_DisregardPriorities"),
00069 BCP_parameter(BCP_CharPar, DisregardPriorities)));
00070 keys.push_back(make_pair(BCP_string("BM_PrintBranchingInfo"),
00071 BCP_parameter(BCP_CharPar, PrintBranchingInfo)));
00072 keys.push_back(make_pair(BCP_string("BM_UsePseudoCosts"),
00073 BCP_parameter(BCP_IntPar, UsePseudoCosts)));
00074 keys.push_back(make_pair(BCP_string("BM_DecreasingSortInSetupList"),
00075 BCP_parameter(BCP_IntPar, DecreasingSortInSetupList)));
00076 keys.push_back(make_pair(BCP_string("BM_PreferHighCombinationInBranching"),
00077 BCP_parameter(BCP_IntPar, PreferHighCombinationInBranching)));
00078 keys.push_back(make_pair(BCP_string("BM_NumNlpFailureMax"),
00079 BCP_parameter(BCP_IntPar, NumNlpFailureMax)));
00080 keys.push_back(make_pair(BCP_string("BM_NL_filename"),
00081 BCP_parameter(BCP_StringPar, NL_filename)));
00082 keys.push_back(make_pair(BCP_string("BM_IpoptParamfile"),
00083 BCP_parameter(BCP_StringPar, IpoptParamfile)));
00084 }
00085
00086
00087
00088 template <>
00089 void BCP_parameter_set<BM_par>::set_default_entries() {
00090 set_entry(DisregardPriorities, false);
00091 set_entry(PrintBranchingInfo, true);
00092 set_entry(UsePseudoCosts, 1);
00093 set_entry(DecreasingSortInSetupList, 1);
00094 set_entry(PreferHighCombinationInBranching, 0);
00095 set_entry(NumNlpFailureMax, 5);
00096 set_entry(NL_filename, "");
00097 set_entry(IpoptParamfile, "");
00098 }
00099
00100
00101
00102 BCP_lp_user *
00103 BM_init::lp_init(BCP_lp_prob& p)
00104 {
00105 return new BM_lp;
00106 }
00107
00108
00109
00110 BCP_tm_user *
00111 BM_init::tm_init(BCP_tm_prob& p,
00112 const int argnum, const char * const * arglist)
00113 {
00114 BM_tm* tm = new BM_tm;
00115
00116 if (argnum == 2) {
00117 tm->par.read_from_file(arglist[1]);
00118 } else if (argnum == 1) {
00119
00120 } else {
00121 tm->par.read_from_arglist(argnum, arglist);
00122 }
00123
00124 tm->readIpopt();
00125
00126 return tm;
00127 }
00128
00129
00130
00131 BCP_user_pack *
00132 BM_init::packer_init(BCP_user_class* p)
00133 {
00134 return new BM_pack;
00135 }
00136
00137
00138
00139 BM_stats::~BM_stats()
00140 {
00141
00142
00143
00144 printf("Stats: #NodesSol = %d #SbSol = %d #Fixed = %d #SbDone = %d SumInd = %d SumPos = %e\n", numberNodeSolves_, numberSbSolves_, numberFixed_, numberStrongBranching_, sumStrongBranchingListIndices_, sumStrongBranchingListPositions_);
00145 }