00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "OsiCuts.hpp"
00012 #include "BonRegisteredOptions.hpp"
00013 #include "CouenneTwoImplied.hpp"
00014
00015 #include "CglCutGenerator.hpp"
00016 #include "CouenneJournalist.hpp"
00017
00018 #include "IpOptionsList.hpp"
00019 #include "IpJournalist.hpp"
00020
00021 using namespace Couenne;
00022
00024 CouenneTwoImplied::CouenneTwoImplied (CouenneProblem *p,
00025 JnlstPtr jnlst,
00026 const Ipopt::SmartPtr <Ipopt::OptionsList> options):
00027 problem_ (p),
00028 jnlst_ (jnlst),
00029 totalTime_ (0.),
00030 totalInitTime_ (0.),
00031 firstCall_ (true) {
00032
00033 options -> GetIntegerValue ("two_implied_max_trials", nMaxTrials_, "couenne.");
00034 options -> GetIntegerValue ("twoimpl_depth_level", depthLevelling_, "couenne.");
00035 options -> GetIntegerValue ("twoimpl_depth_stop", depthStopSeparate_, "couenne.");
00036 }
00037
00038
00040 CouenneTwoImplied::CouenneTwoImplied (const CouenneTwoImplied &src):
00041
00042 CglCutGenerator (src),
00043 problem_ (src.problem_),
00044 jnlst_ (src.jnlst_),
00045 nMaxTrials_ (src.nMaxTrials_),
00046 totalTime_ (src.totalTime_),
00047 totalInitTime_ (src.totalInitTime_),
00048 firstCall_ (src.firstCall_),
00049 depthLevelling_ (src.depthLevelling_),
00050 depthStopSeparate_ (src.depthStopSeparate_) {}
00051
00052
00054 CouenneTwoImplied::~CouenneTwoImplied () {
00055
00056 if (totalTime_ > 1e-5)
00057 jnlst_ -> Printf (Ipopt::J_ERROR, J_COUENNE, "TwoImpliedCuts: %g seconds (%g init)\n", totalTime_, totalInitTime_);
00058 }
00059
00060
00062 void CouenneTwoImplied::registerOptions (Ipopt::SmartPtr <Bonmin::RegisteredOptions> roptions) {
00063
00064 roptions -> AddLowerBoundedIntegerOption
00065 ("two_implied_bt",
00066 "The frequency (in terms of nodes) at which Couenne two-implied bounds are tightened.",
00067 -99, 0,
00068 "A frequency of 0 (default) means these cuts are never generated. \
00069 Any positive number n instructs Couenne to generate them at every n nodes of the B&B tree. \
00070 A negative number -n means that generation should be attempted at the root node, and if \
00071 successful it can be repeated at every n nodes, otherwise it is stopped altogether."
00072 );
00073
00074 roptions -> AddLowerBoundedIntegerOption
00075 ("two_implied_max_trials",
00076 "The number of iteration at each call to the cut generator.",
00077 1, 2,
00078 "");
00079
00080 roptions -> AddLowerBoundedIntegerOption
00081 ("twoimpl_depth_level",
00082 "Depth of the B&B tree when to start decreasing the chance of running this algorithm.",
00083 -1, 5, "This has a similar behavior as log_num_obbt_per_level. "
00084 "A value of -1 means that generation can be done at all nodes.");
00085
00086 roptions -> AddLowerBoundedIntegerOption
00087 ("twoimpl_depth_stop",
00088 "Depth of the B&B tree where separation is stopped.",
00089 -1, 20, "A value of -1 means that generation can be done at all nodes");
00090 }