13#ifndef MINOTAURDISTPARBRANCHANDBOUND_H
14#define MINOTAURDISTPARBRANCHANDBOUND_H
21 struct DistParBabOptions;
22 struct DistParBabStats;
26 class ParNodeIncRelaxer;
27 class ParPCBProcessor;
34 typedef Engine* EnginePtr;
35 typedef DistParBabOptions* DistParBabOptionsPtr;
36 typedef NodeProcessor* NodeProcessorPtr;
37 typedef NodeRelaxer* NodeRelaxerPtr;
38 typedef ParNodeIncRelaxer* ParNodeIncRelaxerPtr;
39 typedef ParPCBProcessor* ParPCBProcessorPtr;
40 typedef Solution* SolutionPtr;
41 typedef SolutionPool* SolutionPoolPtr;
42 typedef ParTreeManager* ParTreeManagerPtr;
43 typedef WarmStart* WarmStartPtr;
60 void printsomething();
126 std::vector<std::vector<double> >serVec,
127 std::vector<std::vector<double> >parVec);
187 void print2dvec(std::vector<std::vector<int> > output);
190 void print2dvec(std::vector<std::vector<double> > output);
218 if (gettimeofday(&time,NULL)) {
222 return (
double)time.tv_sec + (double)time.tv_usec * .000001;
233 static const std::string me_;
235 void getBoundChanges_(
NodePtr node, std::vector<double>& bound_changes);
237 void updateProcsRunningStatus_(std::vector<int>& proc_running);
238 void checkUbUpdates_(
const std::vector<int>& proc_running);
239 void checkLbUpdatesFromOtherProcs_(
double& globalBestLB, std::vector<double>& proc_lb);
241 void distributeNodes_();
243 void getStartingNode_(
bool *shouldWait,
bool *shouldRun, std::vector<double>& node_data);
258 HeurVector preHeurs_;
302 NodePtr processRoot_(
bool *should_prune,
bool *should_dive);
305 NodePtr getStartingNode_(
bool *shouldWait,
bool *shouldRun);
316 void processRoot_(
bool *should_prune,
bool *should_dive,
322 void sendUbToOtherProcs_(
double val,
const std::vector<int>& proc_running);
325 bool shouldPrune_(
NodePtr node);
334 bool shouldStopPar_(
double wallStartTime,
double treeLb);
343 void showStatus_(
bool current_uncounted);
356 void showParStatus_(
UInt current_uncounted,
double treeLb,
357 double wallStartTime);
Declare important 'types' used in Minotaur.
Implement a generic parallel branch-and-bound algorithm on a multicore cpu.
Definition: DistParBranchAndBound.h:48
virtual ~DistParBranchAndBound()
Destroy.
Definition: DistParBranchAndBound.cpp:95
void parsolveOppor(ParNodeIncRelaxerPtr parNodeRelaxer[], ParPCBProcessorPtr parPCBProcessor[], UInt nThreads)
Start solving the Problem using parallel branch-and-bound in an opportunistic mode.
Definition: DistParBranchAndBound.cpp:1173
void addPreRootHeur(HeurPtr h)
Add a heuristic that will be called before root node.
Definition: DistParBranchAndBound.cpp:119
void setLogLevel(LogLevel level)
Set log level.
Definition: DistParBranchAndBound.cpp:379
void writeParStats(std::ostream &out, ParPCBProcessorPtr parPCBProcessor[])
Write statistics of parallel algorithm to the ostream out.
Definition: DistParBranchAndBound.cpp:2695
void setNodeRelaxer(NodeRelaxerPtr nr)
Set the NodeRelaxer for setting-up relaxations at each node.
Definition: DistParBranchAndBound.cpp:391
void print2dvec(std::vector< std::vector< int > > output)
Print a two-dimensional vector (customized).
Definition: DistParBranchAndBound.cpp:273
DistParBranchAndBound()
Default constructor.
Definition: DistParBranchAndBound.cpp:61
int strToInt(std::string str)
Convert a string to integer data type.
Definition: DistParBranchAndBound.cpp:500
double totalTime()
Return total time taken.
Definition: DistParBranchAndBound.cpp:2710
void setNodeProcessor(NodeProcessorPtr p)
Set the NodeProcessor that processes each node.
Definition: DistParBranchAndBound.cpp:385
NodeRelaxerPtr getNodeRelaxer()
Return a pointer to NodeRelaxer used in branch-and-bound.
Definition: DistParBranchAndBound.cpp:153
void writeStats()
Write statistics to the logger.
NodeProcessorPtr getNodeProcessor()
Return a pointer to NodeProcessor used in branch-and-bound.
Definition: DistParBranchAndBound.cpp:147
UInt numProcNodes()
Return number of nodes processed while solving.
Definition: DistParBranchAndBound.cpp:251
SolveStatus getStatus()
Return the final status.
Definition: DistParBranchAndBound.cpp:165
ParTreeManagerPtr getTreeManager()
Return a pointer to the tree manager. The client can then directly query the ParTreeManager for its s...
Definition: DistParBranchAndBound.cpp:171
void solve()
Start solving the Problem using branch-and-bound.
double getPerGap()
Return the percentage gap between the lower and upper bounds.
Definition: DistParBranchAndBound.cpp:125
double getUb()
Return the upper bound for the solution value from the search tree.
Definition: DistParBranchAndBound.cpp:177
double getLb()
Return the lower bound from the search tree.
Definition: DistParBranchAndBound.cpp:131
void shouldCreateRoot(bool b)
Switch to turn on/off root-node creation.
Definition: DistParBranchAndBound.cpp:397
double getWallTime()
Get wall clock time.
Definition: DistParBranchAndBound.h:216
std::vector< std::vector< double > > readSerialOutput(const char *inputFile)
Read output of branch-and-bound tree generated by a single thread.
Definition: DistParBranchAndBound.cpp:358
std::vector< std::vector< double > > mapSerialOutput(std::vector< std::vector< double > >serVec, std::vector< std::vector< double > >parVec)
Map nodes generated in serial and parallel branch-and-bound tree.
Definition: DistParBranchAndBound.cpp:183
Definition: Environment.h:28
Definition: Heuristic.h:30
Definition: NodeProcessor.h:49
Definition: NodeRelaxer.h:42
Definition: ParNodeIncRelaxer.h:32
Default node processor used in solver for now.
Definition: ParPCBProcessor.h:47
Base class for managing the branch-and-bound tree.
Definition: ParTreeManager.h:29
Definition: SolutionPool.h:28
Definition: Solution.h:30
Definition: WarmStart.h:45
Definition: ActiveNodeStore.h:20
LogLevel
Levels of verbosity.
Definition: Types.h:226
unsigned int UInt
Unsigned integer.
Definition: Types.h:30
SolveStatus
Different states an algorithm like branch-and-bound can be in.
Definition: Types.h:158
Different options and parameters that control branch-and-bound.
Definition: DistParBranchAndBound.h:379
double timeLimit
Time limit in seconds for the branch-and-bound.
Definition: DistParBranchAndBound.h:408
UInt nodeLimit
Limit on number of nodes processed.
Definition: DistParBranchAndBound.h:396
UInt solLimit
Limit on number of nodes processed.
Definition: DistParBranchAndBound.h:405
double perGapLimit
Stop if the percent gap between lower and upper bounds of the objective function falls below this lev...
Definition: DistParBranchAndBound.h:402
double logInterval
Time in seconds between status updates of the progress.
Definition: DistParBranchAndBound.h:393
DistParBabOptions()
Default constructor.
Definition: DistParBranchAndBound.cpp:2729
bool createRoot
Should the root be created in branch-and-bound (yes), or the user calls branch-and-bound after creati...
Definition: DistParBranchAndBound.h:390
Statistics about the branch-and-bound.
Definition: DistParBranchAndBound.h:362
DistParBabStats()
Constructor. All data is initialized to zero.
Definition: DistParBranchAndBound.cpp:2719
UInt nodesProc
Number of nodes processed.
Definition: DistParBranchAndBound.h:367
double updateTime
Time of the last log display.
Definition: DistParBranchAndBound.h:373
double timeUsed
Total time used in branch-and-bound.
Definition: DistParBranchAndBound.h:370