Scippy

UG

Ubiquity Generator framework

bbParaSolver.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program and software framework */
4 /* UG --- Ubquity Generator Framework */
5 /* */
6 /* Copyright Written by Yuji Shinano <shinano@zib.de>, */
7 /* Copyright (C) 2021 by Zuse Institute Berlin, */
8 /* licensed under LGPL version 3 or later. */
9 /* Commercial licenses are available through <licenses@zib.de> */
10 /* */
11 /* This code is free software; you can redistribute it and/or */
12 /* modify it under the terms of the GNU Lesser General Public License */
13 /* as published by the Free Software Foundation; either version 3 */
14 /* of the License, or (at your option) any later version. */
15 /* */
16 /* This program is distributed in the hope that it will be useful, */
17 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
18 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
19 /* GNU Lesser General Public License for more details. */
20 /* */
21 /* You should have received a copy of the GNU Lesser General Public License */
22 /* along with this program. If not, see <http://www.gnu.org/licenses/>. */
23 /* */
24 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
25 
26 /**@file paraSolver.h
27  * @brief Base class for solver: Generic parallelized solver.
28  * @author Yuji Shinano
29  *
30  *
31  */
32 
33 
34 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
35 
36 
37 #ifndef __BB_PARA_SOLVER_H__
38 #define __BB_PARA_SOLVER_H__
39 
40 #include "ug/paraDef.h"
41 #include "ug/paraComm.h"
43 #include "ug/paraTimer.h"
45 #include "ug/paraSolution.h"
46 #include "ug/paraSolver.h"
47 #include "bbParaTagDef.h"
48 #include "bbParaParamSet.h"
49 #include "bbParaNode.h"
50 #include "bbParaNodePool.h"
51 // #ifdef _MSC_VER
52 // #include "pthread.h"
53 // #endif
54 
55 #define ENFORCED_THRESHOLD 5
56 
57 namespace UG
58 {
59 
60 ///
61 /// class BbParaSolver
62 ///
63 class BbParaSolver : public ParaSolver
64 {
65 
66 protected:
67 
69 
70  double globalBestDualBoundValueAtWarmStart; ///< global best dual bound value which is set when system warm starts
71  double globalBestCutOffValue; ///< global best cut off value
72  double lcBestDualBoundValue; ///< LoadCoordinator best dual bound value
73  bool collectingMode; ///< indicate whether if this solver is in collecting mode or not
74  bool aggressiveCollecting; ///< indicate that if this solver has two nodes, this solver sends one to LC
75  int nSendInCollectingMode; ///< number of nodes need to send in collecting mode
76  int nCollectOnce; ///< number of nodes need to collect once
77  bool collectingManyNodes; ///< indicate that many nodes collecting is requested by LC
78  bool collectingInterrupt; ///< when the solver is interrupted, all nodes are collected to LC
79  bool anotherNodeIsRequested; ///< indicate that another node is requested or not
80  bool lightWeightRootNodeComputation; ///< indicate that fast root node computation is required
81 
82  bool onceBreak; ///< indicate that the sub-MIP is broken down once
83 
84  ///
85  /// Times
86  ///
87  double rootNodeTime; ///< root node process time of current ParaNode
88  double totalRootNodeTime; ///< accumulated root node process time solved by this solver so far
89  double minRootNodeTime; ///< minimum time consumed by root node process
90  double maxRootNodeTime; ///< maximum time consumed by root node process
91 
92  ///
93  /// Counters related to the current ParaNode
94  ///
95  int nSolved; ///< number of nodes solved, that is, number of subtree nodes rooted from ParaNode
96  int nSent; ///< number of ParaNodes sent from this subtree rooted from the current ParaNode
97  int nSolvedWithNoPreprocesses; ///< number of nodes solved when it is solved with no preprocesses
98 
99  ///
100  /// Counters related to this BbParaSolver
101  ///
102  int totalNSolved; ///< accumulated number of nodes solved in this BbParaSolver
103  int minNSolved; ///< minimum number of subtree nodes rooted from ParaNode
104  int maxNSolved; ///< maximum number of subtree nodes rooted from ParaNode
105  int nTransferredLocalCutsFromSolver; ///< number of local cuts transferred from this Solver
106  int minTransferredLocalCutsFromSolver; ///< minimum number of local cuts transferred from this Solver
107  int maxTransferredLocalCutsFromSolver; ///< maximum number of local cuts transferred from this Solver
108  int nTransferredBendersCutsFromSolver; ///< number of benders cuts transferred from this Solver
109  int minTransferredBendersCutsFromSolver; ///< minimum number of benders cuts transferred from this Solver
110  int maxTransferredBendersCutsFromSolver; ///< maximum number of benders cuts transferred from this Solver
111  int nTotalRestarts; ///< number of total restarts
112  int minRestarts; ///< minimum number of restarts
113  int maxRestarts; ///< maximum number of restarts
114  int totalNSent; ///< accumulated number of nodes sent from this BbParaSolver
115  int totalNImprovedIncumbent; ///< accumulated number of improvements of incumbent value in this BbParaSolver
116  int nParaNodesSolvedAtRoot; ///< number of ParaNodes solved at root node
117  int nParaNodesSolvedAtPreCheck; ///< number of ParaNodes solved at pre-checking of root node solvability
118 
119  int nSimplexIterRoot; ///< number of simplex iteration at root node
120  int nTransferredLocalCuts; ///< number of local cuts (including conflict cuts) transferred from a ParaNode
121  int minTransferredLocalCuts; ///< minimum number of local cuts (including conflict cuts) transferred from a ParaNode
122  int maxTransferredLocalCuts; ///< maximum number of local cuts (including conflict cuts) transferred from a ParaNode
123  int nTransferredBendersCuts; ///< number of benders cuts transferred from a ParaNode
124  int minTransferredBendersCuts; ///< minimum number of benders cuts transferred from a ParaNode
125  int maxTransferredBendersCuts; ///< maximum number of benders cuts transferred from a ParaNode
126  int nTightened; ///< the number of tightened variable bounds in racing
127  int nTightenedInt; ///< the number of tightened integral variable bounds in racing
128  double minIisum; ///< minimum sum of integer infeasibility
129  double maxIisum; ///< maximum sum of integer infeasibility
130  int minNii; ///< minimum number of integer infeasibility
131  int maxNii; ///< maximum number of integer infeasibility
132 
133  double targetBound; ///< target bound value for breaking
134  int nTransferLimit; ///< limit number of transferring nodes for breaking
135  int nTransferredNodes; ///< keep track number of transferred nodes for breaking
136 
137  double solverDualBound; ///< dual bound value achieved for a subproblem
138 
139  double averageDualBoundGain; ///< average dual bound gain
140  bool enoughGainObtained; ///< indicate that the root node process improved dual bound enough or not
141 
142  bool givenGapIsReached; ///< indicate that the given gap is reached or not
143  bool testDualBoundGain; ///< indicate that the dual bound gain needs to test or not
144  bool noWaitModeSend; ///< indicate that no wait mode sending is applied
145  bool keepRacing; ///< indicate if Solver needs to do racing ramp-up repeatedly in case of warm start
146  bool restartingRacing; ///< indicate that this solver is restarting racing
147  bool localIncumbentIsChecked; ///< indicate if a local incumbent solution is checked or not
148 
149  ///
150  /// Pool in Solver
151  ///
152  BbParaNodePool *selfSplitNodePool; ///< node pool for self-split subtree root nodes
153 
154  ///-------------------
155  /// Message handlers
156  ///-------------------
157 
158  ///
159  /// process TagNode
160  /// @return always 0 (for extension)
161  ///
162  virtual int processTagTask(
163  int source, ///< source rank
164  int tag ///< TagNode
165  );
166 
167  ///
168  /// process TagTaskReceived
169  /// @return always 0 (for extension)
170  ///
171  virtual int processTagTaskReceived(
172  int source, ///< source rank
173  int tag ///< TagTaskReceived
174  );
175 
176  ///
177  /// process TagRampUp
178  /// @return always 0 (for extension)
179  ///
180  virtual int processTagRampUp(
181  int source, ///< source rank
182  int tag ///< TagRampUp
183  );
184 
185  ///
186  /// process TagSolution
187  /// @return always 0 (for extension)
188  ///
189  virtual int processTagSolution(
190  int source, ///< source rank
191  int tag ///< TagSolution
192  );
193 
194  ///
195  /// process TagIncumbentValue
196  /// @return always 0 (for extension)
197  ///
198  virtual int processTagIncumbentValue(
199  int source, ///< source rank
200  int tag ///< TagIncumbentValue
201  );
202 
203  ///
204  /// process TagNotificationId
205  /// @return always 0 (for extension)
206  ///
207  virtual int processTagNotificationId(
208  int source, ///< source rank
209  int tag ///< TagNotificationId
210  );
211 
212  ///
213  /// process TagTerminateRequest
214  /// @return always 0 (for extension)
215  ///
216  virtual int processTagTerminateRequest(
217  int source, ///< source rank
218  int tag ///< TagTerminateRequest
219  );
220 
221  ///
222  /// process TagInterruptRequest
223  /// @return always 0 (for extension)
224  ///
225  virtual int processTagInterruptRequest(
226  int source, ///< source rank
227  int tag ///< TagInterruptRequest
228  );
229 
230  ///
231  /// process TagWinnerRacingRampUpParamSet
232  /// @return always 0 (for extension)
233  ///
235  int source, ///< source rank
236  int tag ///< TagWinnerRacingRampUpParamSet
237  );
238 
239  ///
240  /// process TagWinner
241  /// @return always 0 (for extension)
242  ///
243  virtual int processTagWinner(
244  int source, ///< source rank
245  int tag ///< TagWinner
246  );
247 
248  ///
249  /// process TagToken
250  /// @return always 0 (for extension)
251  ///
252  virtual int processTagToken(
253  int source, ///< source rank
254  int tag ///< TagToken
255  );
256 
257  ///
258  /// process TagRetryRampUp
259  /// @return always 0 (for extension)
260  ///
261  virtual int processTagRetryRampUp(
262  int source, ///< source rank
263  int tag ///< TagRetryRampUp
264  );
265 
266  ///
267  /// process TagGlobalBestDualBoundValueAtWarmStart
268  /// @return always 0 (for extension)
269  ///
271  int source, ///< source rank
272  int tag ///< TagGlobalBestDualBoundValueAtWarmStart
273  );
274 
275  ///
276  /// process TagNoNodes
277  /// @return always 0 (for extension)
278  ///
279  virtual int processTagNoNodes(
280  int source, ///< source rank
281  int tag ///< TagNoNodes
282  );
283 
284  ///
285  /// process TagInCollectingMode
286  /// @return always 0 (for extension)
287  ///
288  virtual int processTagInCollectingMode(
289  int source, ///< source rank
290  int tag ///< TagInCollectingMode
291  );
292 
293  ///
294  /// process TagCollectAllNodes
295  /// @return always 0 (for extension)
296  ///
297  virtual int processTagCollectAllNodes(
298  int source, ///< source rank
299  int tag ///< TagCollectAllNodes
300  );
301 
302  ///
303  /// process TagOutCollectingMode
304  /// @return always 0 (for extension)
305  ///
306  virtual int processTagOutCollectingMode(
307  int source, ///< source rank
308  int tag ///< TagOutCollectingMode
309  );
310 
311  ///
312  /// process TagLCBestBoundValue
313  /// @return always 0 (for extension)
314  ///
315  virtual int processTagLCBestBoundValue(
316  int source, ///< source rank
317  int tag ///< TagLCBestBoundValue
318  );
319 
320  ///
321  /// process TagLightWeightRootNodeProcess
322  /// @return always 0 (for extension)
323  ///
325  int source, ///< source rank
326  int tag ///< TagLightWeightRootNodeProcess
327  );
328 
329  ///
330  /// process TagBreaking
331  /// @return always 0 (for extension)
332  ///
333  virtual int processTagBreaking(
334  int source, ///< source rank
335  int tag ///< TagBreaking
336  );
337 
338  ///
339  /// process TagGivenGapIsReached
340  /// @return always 0 (for extension)
341  ///
342  virtual int processTagGivenGapIsReached(
343  int source, ///< source rank
344  int tag ///< TagGivenGapIsReached
345  );
346 
347  ///
348  /// process TagTestDualBoundGain
349  /// @return always 0 (for extension)
350  ///
351  virtual int processTagTestDualBoundGain(
352  int source, ///< source rank
353  int tag ///< TagTestDualBoundGain
354  );
355 
356  ///
357  /// process TagNoTestDualBoundGain
358  /// @return always 0 (for extension)
359  ///
360  virtual int processTagNoTestDualBoundGain(
361  int source, ///< source rank
362  int tag ///< TagNoTestDualBoundGain
363  );
364 
365  ///
366  /// process TagNoWaitModeSend
367  /// @return always 0 (for extension)
368  ///
369  virtual int processTagNoWaitModeSend(
370  int source, ///< source rank
371  int tag ///< TagNoWaitModeSend
372  );
373 
374  ///
375  /// process TagRestart
376  /// @return always 0 (for extension)
377  ///
378  virtual int processTagRestart(
379  int source, ///< source rank
380  int tag ///< TagRestart
381  );
382 
383  ///
384  /// process TagLbBoundTightened
385  /// @return always 0 (for extension)
386  ///
387  virtual int processTagLbBoundTightened(
388  int source, ///< source rank
389  int tag ///< TagLbBoundTightened
390  );
391 
392  ///
393  /// process TagUbBoundTightened
394  /// @return always 0 (for extension)
395  ///
396  virtual int processTagUbBoundTightened(
397  int source, ///< source rank
398  int tag ///< TagUbBoundTightened
399  );
400 
401  ///
402  /// process TagCutOffValue
403  /// @return always 0 (for extension)
404  ///
405  virtual int processTagCutOffValue(
406  int source, ///< source rank
407  int tag ///< TagCutOffValue
408  );
409 
410  ///
411  /// process TagKeepRacing
412  /// @return always 0 (for extension)
413  ///
414  virtual int processTagKeepRacing(
415  int source, ///< source rank
416  int tag ///< TagChangeSearchStrategy
417  );
418 
419  ///
420  /// process TagTerminateSolvingToRestart
421  /// @return always 0 (for extension)
422  ///
424  int source, ///< source rank
425  int tag ///< TagTerminateSolvingToRestart
426  );
427 
428  ///
429  /// wait for receiving a new node and reactivate solver
430  /// @return true if a new node is received, false esle
431  ///
432  virtual bool receiveNewTaskAndReactivate(
433  );
434 
435  ///
436  /// send completion of calculation
437  ///
439  double stopTime ///< stopping time
440  )
441  {
442  std::cerr << "********** BbParaSolver does not use this function. **********" << std::endl;
443  abort();
444  }
445 
446  ///
447  /// send completion of calculation with arguments
448  ///
449  virtual void sendCompletionOfCalculation(
450  double stopTime, ///< stopping time
451  int tag, ///< message Tag
452  int nSelfSplitNodesLeft ///< number of self-split nodes left
453  );
454 
455  ///
456  /// send completion of calculation with arguments
457  ///
459  double stopTime, ///< stopping time
460  int tag, ///< message Tag
461  int nSelfSplitNodesLeft ///< number of self-split nodes left
462  );
463 
464  ///
465  /// update global best cutoff value
466  /// @return true if the global best cutoff value was updated, false otherwise
467  ///
468  virtual bool updateGlobalBestCutOffValue(
469  double newValue ///< new cutoff value
470  );
471 
472  ///
473  /// set racing parameters
474  ///
475  virtual void setRacingParams(
476  ParaRacingRampUpParamSet *racingParms, ///< pointer to racing parameter set object
477  bool winnerParam ///< indicate if the parameter set is winner one
478  ) = 0;
479 
480  ///
481  /// set winner racing parameters
482  ///
483  virtual void setWinnerRacingParams(
484  ParaRacingRampUpParamSet *racingParms ///< pointer to winner racing parameter set object
485  ) = 0;
486 
487  ///
488  /// create subproblem
489  ///
490  virtual void createSubproblem(
491  ) = 0;
492 
493  ///
494  /// free subproblem
495  ///
496  virtual void freeSubproblem(
497  ) = 0;
498 
499  ///
500  /// solve (sub)problem
501  ///
502  virtual void solve(
503  ) = 0;
504 
505  ///
506  /// get number of nodes solved
507  /// @return the number of nodes solved
508  ///
509  virtual long long getNNodesSolved(
510  ) = 0;
511 
512  ///
513  /// get number of nodes left
514  /// @return the number of nodes left
515  ///
516  virtual int getNNodesLeft(
517  ) = 0;
518 
519  ///
520  /// get dual bound value
521  /// @return dual bound value
522  ///
523  virtual double getDualBoundValue(
524  ) = 0;
525 
526  ///
527  /// set original node selection strategy
528  ///
530  ) = 0;
531 
532  ///
533  /// solve to check effect of root node preprocesses
534  ///
536  )
537  {
538  /// set nSolvedWithNoPreprocesses
539  }
540 
541  ///
542  /// lower bound of variable tightened
543  /// @return always 0 (for extension)
544  ///
545  virtual int lbBoundTightened(
546  int source, ///< source rank
547  int tag ///< TagLbBoundTightened
548  )
549  {
550  return 0;
551  }
552 
553  ///
554  /// upper bound of variable tightened
555  /// @return always 0 (for extension)
556  ///
557  virtual int ubBoundTightened(
558  int source, ///< source rank
559  int tag ///< TagUbBoundTightened
560  )
561  {
562  return 0;
563  }
564 
565  ///
566  /// get number of tightened variables during racing
567  ///
568  virtual int getNTightened(
569  )
570  {
571  return 0;
572  }
573 
574  ///
575  /// get number of tightened integral variables during racing
576  ///
577  virtual int getNTightenedInt(
578  )
579  {
580  return 0;
581  }
582 
583  ///
584  /// change search strategy
585  ///
586  virtual void changeSearchStrategy(
587  int searchStrategy ///< searchStrategy == 0: original search, 1: best bound search
588  )
589  {
590  }
591 
592  ///
593  /// send Solver termination state
594  ///
595  virtual void sendSolverTerminationState(
596  );
597 
598  ///
599  /// notify Self-Split finished
600  ///
601  virtual void notifySelfSplitFinished(
602  );
603 
604  ///
605  /// restart racing
606  ///
607  virtual void restartRacing(
608  );
609 
610  ///
611  /// update global best incumbent solution
612  /// @return true if the best incumbent solution was updated, false otherwise
613  ///
615  ParaSolution *sol ///< pointer to new solution object
616  );
617 
618  ///
619  /// update global best incumbent value
620  /// @return true if the best incumbent value was updated, false otherwise
621  ///
622  virtual bool updateGlobalBestIncumbentValue(
623  double newValue ///< new incumbent value
624  );
625 
626 public:
627 
628  ///
629  /// constructor
630  ///
632  )
633  {
634  THROW_LOGICAL_ERROR1("Default constructor of BbParaSolver is called");
635  }
636 
637  ///
638  /// constructor
639  ///
640  BbParaSolver(
641  int argc, ///< number of arguments
642  char **argv, ///< array of arguments
643  int nHandlers, ///< number of valid message handlers
644  ParaComm *comm, ///< communicator used
645  ParaParamSet *inParaParamSet, ///< pointer to ParaParamSet object
646  ParaInstance *paraInstance, ///< pointer to ParaInstance object
647  ParaDeterministicTimer *detTimer ///< pointer to deterministic timer object
648  );
649 
650  ///
651  /// destructor
652  ///
653  virtual ~BbParaSolver(
654  )
655  {
656 // int source, tag;
657 // (void)paraComm->probe(&source, &tag);
658 // (void)paraComm->receive( NULL, 0, ParaBYTE, source, TagTerminated);
659  }
660 
661  ///
662  /// get paraParaComm
663  /// @return communicator used
664  ///
666  )
667  {
668  return paraComm;
669  }
670 
671  ///
672  /// run this Solver
673  ///
674  using ParaSolver::run;
675  virtual void run(
676  );
677 
678  ///
679  /// run this Solver with ParaNode object
680  ///
681 // virtual void run(
682 // ParaTask *paraNode ///< pointer to ParaNode object
683 // )
684 // {
685 // currentTask = paraNode;
686 // run();
687 // }
688 
689  ///
690  /// run this solver with racing parameters
691  ///
692  virtual void run(
693  ParaRacingRampUpParamSet *inRacingRampUpParamSet ///< pointer to ParaRacingRampUpParamSet object
694  )
695  {
696  ParaTask *rootNode = paraComm->createParaTask();
698  rootNode->bcast(paraComm, 0)
699  );
701  racingParams = inRacingRampUpParamSet;
704  {
705  do
706  {
708  } while( !waitToken(paraComm->getRank()) );
709  }
710  iReceiveMessages(); // Feasible solution may be received.
712  {
714  }
715  ParaSolver::run( rootNode );
716  }
717 
718  ///
719  /// the following functions may be called from callback routines of the target Solver
720  ///
721 
722  ///
723  /// get elapsed time of node solving
724  /// @return elapsed time
725  ///
727  )
728  {
730  }
731 
732  ///
733  /// get global best dual bound value at warm start (restart)
734  /// @return global best dual bound value
735  ///
737  )
738  {
740  }
741 
742  ///
743  /// get LoadCorrdinator best dual bound value
744  /// @return LoadCoordinator best dual bound value
745  ///
747  )
748  {
749  return lcBestDualBoundValue;
750  }
751 
752  ///
753  /// get number of nodes to stop solving. This number is not used to decide stop solving.
754  /// It is used a part of conditions.
755  /// @return number of nodes to stop solving
756  ///
758  )
759  {
760  return dynamic_cast<BbParaParamSet *>(paraParams)->getIntParamValue(NStopSolvingMode);
761  }
762 
763  ///
764  /// get time to stop solving. This value is not used to decide stop solving.
765  /// It is used a part of conditions.
766  /// @return time to stop solving
767  ///
769  )
770  {
772  }
773 
774  ///
775  /// get root node computing time
776  /// @return root node computing time
777  ///
779  )
780  {
781  return rootNodeTime;
782  }
783 
784  ///
785  /// get bound gap for stop solving. This value is not used to decide stop solving.
786  /// It is used a part of conditions.
787  /// @return gap value
788  ///
790  )
791  {
793  }
794 
795  ///
796  /// get bound gap for collecting mode
797  /// @return gap value
798  ///
800  )
801  {
803  }
804 
805  ///
806  /// non-blocking receive messages
807  ///
808  virtual void iReceiveMessages(
809  );
810 
811  ///
812  /// check if global incumbent value is updated or not
813  /// @return true if global incumbent value is updated
814  ///
816  )
817  {
819  }
820 
821  ///
822  /// set global incumbent value is reflected
823  ///
825  )
826  {
828  }
829 
830  ///
831  /// check if racing interrupt was requested or not
832  /// @return true if racing interrupt was requested, false otherwise
833  ///
835  )
836  {
837  return ( racingInterruptIsRequested || restartingRacing );
838  }
839 
840  ///
841  /// check if collecting interrupt (interrupt with collecting all nodes) is requested or not
842  /// @return true if collecting interrupt was requested, false otherwise
843  ///
845  )
846  {
847  return collectingInterrupt;
848  }
849 
850  ///
851  /// set root node computing time
852  ///
853  virtual void setRootNodeTime(
854  );
855 
856  ///
857  /// send solution found in this Solver
858  ///
859  virtual void sendLocalSolution(
860  );
861 
862  ///
863  /// check if a notification message needs to send or not
864  /// @return true if the notification message needs to send, false otherwise
865  ///
866  virtual bool notificationIsNecessary(
867  );
868 
869  ///
870  /// send Solver state to LoadCoordinator
871  ///
872  virtual void sendSolverState(
873  long long nNodesSolved,
874  int nNodesLeft,
875  double bestDualBoundValue,
876  double detTime
877  );
878 
879  ///
880  /// check if a new ParaNode was received or not
881  /// @return true if a new ParaNode was received, false otherwise
882  ///
884  )
885  {
886  return (newTask != 0);
887  }
888 
889  ///
890  /// check if Solver is in collecting mode or not
891  /// @return true if Solver is in collecting mode, false otherwise
892  ///
894  )
895  {
896  return ( collectingMode || collectingManyNodes );
897  }
898 
899  ///
900  /// check if Solver is in aggressive collecting mode or not
901  /// @return true if Solver is in aggressive collecting mode, false otherwise
902  ///
904  )
905  {
906  return aggressiveCollecting;
907  }
908 
909  ///
910  /// check if many nodes collection was requested or not
911  /// @return true if many nodes collection was requested, false otherwise
912  ///
914  )
915  {
916  return collectingManyNodes;
917  }
918 
919  ///
920  /// get threshold value to send ParaNodes to LoadCoordinator
921  /// @return the number of ParaNodes
922  ///
923  virtual int getThresholdValue(
924  int nNodes ///< number of processed nodes, including the focus node
925  );
926 
927  ///
928  /// send a branch-and-bound node as ParaNode to LoadCoordinator
929  ///
930  virtual void sendParaNode(
931  long long n, ///< branch-and-bound node number in this Solver
932  int depth, ///< depth of branch-and-bound node in this Solver
933  double dualBound, ///< dual bound value of branch-and-bound node
934  double estimateValue, ///< estimate value of branch-and-bound node
935  ParaDiffSubproblem *diffSubproblem ///< difference between the root branch-and-bound node and transferred one
936  );
937 
938  ///
939  /// keep a branch-and-bound node as ParaNode to LoadCoordinator
940  ///
941  virtual void keepParaNode(
942  long long n, ///< branch-and-bound node number in this Solver
943  int depth, ///< depth of branch-and-bound node in this Solver
944  double dualBound, ///< dual bound value of branch-and-bound node
945  double estimateValue, ///< estimate value of branch-and-bound node
946  ParaDiffSubproblem *diffSubproblem ///< difference between the root branch-and-bound node and transferred one
947  );
948 
949  ///
950  /// send another node request
951  ///
952  virtual void sendAnotherNodeRequest(
953  double bestDualBoundValue ///< best dual bound value in this Solver
954  );
955 
956  ///
957  /// check if Solver is in notification process or not
958  /// TODO: function name should be changed
959  /// @return true if Solver is in notification process, false otherwise
960  ///
962  )
963  {
964  return notificationProcessed;
965  }
966 
967  ///
968  /// get global best incumbent value
969  /// @return global best incumbent value
970  ///
972  )
973  {
975  }
976 
977  ///
978  /// get current ParaNode object
979  /// @return pointer to ParaNode object
980  ///
982  )
983  {
984  return currentTask;
985  }
986 
987  ///
988  /// get ParaInstance object
989  /// @return pointer to ParaInstance object
990  ///
992  )
993  {
994  return paraInstance;
995  }
996 
997  ///
998  /// get ParaParamSet object
999  /// @return pointer to ParaParamSet object
1000  ///
1002  )
1003  {
1004  return paraParams;
1005  }
1006 
1007  ///
1008  /// get rank of this Solver
1009  /// @return rank of this Solver
1010  ///
1011  virtual int getRank(
1012  )
1013  {
1014  return paraComm->getRank();
1015  }
1016 
1017  ///
1018  /// count ParaNode solved at root node in pre-check
1019  ///
1021  )
1022  {
1023  nParaNodesSolvedAtPreCheck++;
1024  }
1025 
1026  ///
1027  /// wait a notification id message if it is needed to synchronize with LoadCoordinaor
1028  ///
1029  virtual void waitMessageIfNecessary(
1030  );
1031 
1032  ///
1033  /// get number of ParaNodes already sent in a collecting mode
1034  /// @return the number of ParaNodes sent
1035  ///
1037  )
1038  {
1039  return nSendInCollectingMode;
1040  }
1041 
1042  ///
1043  /// check if Solver is in racing stage or not
1044  /// @return true if Solver is in racing stage, false otherwise
1045  ///
1046 // bool isRacingStage(
1047 // )
1048 // {
1049 // return (racingParams &&
1050 // (paraParams->getIntParamValue(RampUpPhaseProcess) == 1 ||
1051 // paraParams->getIntParamValue(RampUpPhaseProcess) == 2 ) );
1052 // }
1053 
1054  ///
1055  /// terminate racing stage
1056  ///
1057 // void terminateRacing()
1058 // {
1059 // assert(racingParams);
1060 // delete racingParams;
1061 // racingParams = 0;
1062 // racingInterruptIsRequested = false;
1063 // racingIsInterrupted = false; // rampUp message might have been received before terminate racing
1064 // // Then, this flag should be set false
1065 // }
1066 
1067  ///
1068  /// get global best incumbent solution
1069  /// @return pointer to ParaSolution object
1070  ///
1071 // ParaSolution *getGlobalBestIncumbentSolution(
1072 // )
1073 // {
1074 // return globalBestIncumbentSolution;
1075 // }
1076 
1077  ///
1078  /// check if Solver is waiting for a specific message or not
1079  /// @return true if Solver is waiting for a specific message, false otherwise
1080  ///
1081 // bool isWaitingForSpecificMessage(
1082 // )
1083 // {
1084 // return waitingSpecificMessage;
1085 // }
1086 
1087  ///
1088  /// check if Solver is in breaking mode
1089  /// @return true if Solver is in breaking mode, false otherwise
1090  ///
1092  )
1093  {
1094  return (nTransferLimit > 0);
1095  }
1096 
1097  ///
1098  /// get target bound for breaking
1099  /// @return target bound value
1100  ///
1102  )
1103  {
1104  return targetBound;
1105  }
1106 
1107  ///
1108  /// check if the number of ParaNodes sent is reached to transfer limit specified
1109  /// @return true if the number of ParaNodes sent is reached to the limit, false otherwise
1110  ///
1112  )
1113  {
1114  return (nTransferredNodes >= nTransferLimit);
1115  }
1116 
1117  ///
1118  /// reset breaking information
1119  ///
1121  )
1122  {
1123  targetBound = -DBL_MAX;
1124  nTransferLimit = -1;
1125  nTransferredNodes = -1;
1126  collectingManyNodes = false;
1127  }
1128 
1129  ///
1130  /// check if once breaking procedure worked or not
1131  /// @return true if the breaking procedure worked, false otherwise
1132  ///
1134  )
1135  {
1136  return onceBreak;
1137  }
1138 
1139  ///
1140  /// set once braking procedure worked
1141  ///
1143  )
1144  {
1145  nCollectOnce = -1;
1146  collectingManyNodes = true;
1147  onceBreak = true;
1148  }
1149 
1150  ///
1151  /// check if aggressive presolving is specified
1152  /// @return true if aggressive presolving is specified, false otherwise
1153  ///
1155  )
1156  {
1158  }
1159 
1160  ///
1161  /// get depth to apply aggressive presolving
1162  /// @return depth to apply aggressive presolving
1163  ///
1165  )
1166  {
1168  }
1169 
1170  ///
1171  /// get depth to stop aggressive presolving
1172  /// @return depth to stop aggressive presolving
1173  ///
1175  )
1176  {
1178  }
1179 
1180  ///
1181  /// get depth of sub-MIP root node in global search tree
1182  /// @return depth fo sub-MIP root
1183  ///
1185  )
1186  {
1187  return dynamic_cast<BbParaNode *>(currentTask)->getDepth();
1188  }
1189 
1190  ///
1191  /// set counter and flag to indicate that all nodes are sent to LoadCooordinator
1192  ///
1194  )
1195  {
1196  nCollectOnce = -1; // collect all
1197  collectingManyNodes = true;
1198  }
1199 
1200  ///
1201  /// check if Solver is sending all nodes to LoadCoordinaor or not
1202  /// @return true if Solver is sending all nodes, false otherwise
1203  ///
1205  )
1206  {
1207  return( collectingManyNodes && (nCollectOnce < 0) );
1208  }
1209 
1210  ///
1211  /// get big dual gap subtree handling strategy
1212  /// @return big dual gap subtree handling strategy
1213  ///
1215  )
1216  {
1218  }
1219 
1220  ///
1221  /// check if given gap is reached or not
1222  /// @return true if given gap is reached, false otherwise
1223  ///
1225  )
1226  {
1227  return givenGapIsReached;
1228  }
1229 
1230  ///
1231  /// check if iterative break down is applied or not
1232  /// @return true if iterative break down is applied, false otherwise
1233  ///
1235  )
1236  {
1238  }
1239 
1240  ///
1241  /// set sum and number of integer infeasibility
1242  ///
1243  void setII(
1244  double sum, ///< sum of integer infeasibility
1245  int count ///< number of integer infeasibility
1246  )
1247  {
1248  if( minIisum > sum ) minIisum = sum;
1249  if( maxIisum < sum ) maxIisum = sum;
1250  if( minNii > count ) minNii = count;
1251  if( maxNii < count ) maxNii = count;
1252  }
1253 
1254  ///
1255  /// set number of simplex iteration at root node
1256  ///
1258  int iter
1259  )
1260  {
1261  nSimplexIterRoot = iter;
1262  }
1263 
1264  ///
1265  /// wait token for deterministic mode
1266  /// @return true when token is received, false otherwise
1267  ///
1269  int rank ///< rank of this Solver
1270  )
1271  {
1272  bool result;
1273  double startTimeToWaitToken = paraTimer->getElapsedTime();
1274  result = paraComm->waitToken(rank);
1275  idleTimeToWaitToken += (paraTimer->getElapsedTime() - startTimeToWaitToken);
1276  return result;
1277  }
1278 
1279  ///
1280  /// pass token to the next process
1281  ///
1283  int rank ///< rank of this Solver
1284  )
1285  {
1286  paraComm->passToken(rank);
1287  }
1288 
1289  ///
1290  /// get current solving node merging status
1291  /// @return merging status
1292  ///
1294  )
1295  {
1296  return dynamic_cast<BbParaNode *>(currentTask)->getMergingStatus();
1297  }
1298 
1299  ///
1300  /// get initial dual bound of current solving node
1301  /// @return initial dual bound value
1302  ///
1304  )
1305  {
1306  return dynamic_cast<BbParaNode *>(currentTask)->getInitialDualBoundValue();
1307  }
1308 
1309  ///
1310  /// get average dual bound gain
1311  /// @return average dual bound gaine
1312  ///
1314  )
1315  {
1316  return averageDualBoundGain;
1317  }
1318 
1319  ///
1320  /// set dual bound gain is not enough
1321  ///
1323  )
1324  {
1325  enoughGainObtained = false;
1326  }
1327 
1328  ///
1329  /// check if dual bound gains enough or not
1330  /// @return true if dual bound gains enough, false otherwise
1331  ///
1333  )
1334  {
1335  return enoughGainObtained;
1336  }
1337 
1338  ///
1339  /// check if dual bound gain needs to be tested or not
1340  /// @return true if dual bound gain needs to be tested, false otherwise
1341  ///
1343  )
1344  {
1345  return testDualBoundGain;
1346  }
1347 
1348  ///
1349  /// check if this solver is in racing ramp-up or not
1350  /// @return true if this solver is in racing ramp-up, false otherwise
1351  ///
1353  )
1354  {
1355  return ( ( paraParams->getIntParamValue(RampUpPhaseProcess) == 1 ) ||
1357  }
1358 
1359  ///
1360  /// check if Solver is in racing stage or not
1361  /// @return true if Solver is in racing stage, false otherwise
1362  ///
1364  )
1365  {
1366  return (racingParams &&
1369  }
1370 
1371  ///
1372  /// check if Solver was terminated normally or not
1373  /// @return true if Solver was terminated normally, false otherwise
1374  ///
1375  virtual bool wasTerminatedNormally(
1376  ) = 0;
1377 
1378  ///
1379  /// write current node problem
1380  /// (this method is always useful for debugging, so we should implement this method)
1381  ///
1382  virtual void writeCurrentTaskProblem(
1383  const std::string& filename ///< file name to write
1384  ) = 0;
1385 
1386  ///
1387  /// try to enter solution to base solver environment
1388  ///
1389  virtual void tryNewSolution(
1390  ParaSolution *sol ///< solution to be enterred
1391  ) = 0;
1392 
1393  ///
1394  /// set light weight root node process
1395  ///
1397  )
1398  {
1399  std::cout << "*** virtual function BbParaSolver::setLightWeightRootNodeProcess is called ***" << std::endl;
1400  }
1401 
1402  ///
1403  /// set original root node process
1404  ///
1406  )
1407  {
1408  std::cout << "*** virtual function BbParaSolver::setOriginalRootNodeProcess is called ***" << std::endl;
1409  }
1410 
1411  ///
1412  /// write subproblem
1413  ///
1414  virtual void writeSubproblem(
1415  ) = 0;
1416 
1417  ///
1418  /// get number of simplex iterations
1419  ///
1420  virtual long long getSimplexIter(
1421  ) = 0;
1422 
1423  ///
1424  /// get number of restarts
1425  /// (Derived class for SCIP should override this function)
1426  /// @return number of restarts
1427  ///
1428  virtual int getNRestarts(
1429  )
1430  {
1431  return 0;
1432  }
1433 
1434  ///
1435  /// check if base solver can generate special cut off value or not
1436  /// @return true if base solver can generate special cut off value, false otherwise
1437  ///
1439  )
1440  {
1441  return false;
1442  }
1443 
1444  ///
1445  /// get cut off value
1446  /// @return cut off value
1447  ///
1449  )
1450  {
1451  return globalBestCutOffValue;
1452  }
1453 
1454  ///
1455  /// update number of transferred local cuts
1456  ///
1458  int n ///< number of transferred local cuts to be added
1459  )
1460  {
1461  nTransferredLocalCuts += n;
1462  if( minTransferredLocalCuts > n )
1463  {
1464  minTransferredLocalCuts = n;
1465  }
1466  if( maxTransferredLocalCuts < n )
1467  {
1468  maxTransferredLocalCuts = n;
1469  }
1470  }
1471 
1472  ///
1473  /// update number of transferred benders cuts
1474  ///
1476  int n ///< number of transferred benders cuts to be added
1477  )
1478  {
1479  nTransferredBendersCuts += n;
1480  if( minTransferredBendersCuts > n )
1481  {
1482  minTransferredBendersCuts = n;
1483  }
1484  if( maxTransferredBendersCuts < n )
1485  {
1486  maxTransferredBendersCuts = n;
1487  }
1488  }
1489 
1490  ///
1491  /// check if another node is requested or not
1492  /// @return true if another node is requested, false otherwise
1493  ///
1495  )
1496  {
1497  return anotherNodeIsRequested;
1498  }
1499 
1500  ///
1501  /// get pending incumbent value
1502  /// @return pending incumbent value
1503  ///
1505  )
1506  {
1507  return pendingIncumbentValue;
1508  }
1509 
1510  ///
1511  /// set keep racing value
1512  ///
1514  bool value
1515  )
1516  {
1517  keepRacing = value;
1518  }
1519 
1520  ///
1521  /// get the number of nodes in slef-split node pool
1522  /// @return the number of self-split nodes left
1523  ///
1525  )
1526  {
1527  return selfSplitNodePool->getNumOfNodes();
1528  }
1529 
1530  ///
1531  /// send improved solution if it was found in this Solver
1532  ///
1533  virtual bool sendIfImprovedSolutionWasFound(
1534  ParaSolution *sol ///< solution found in this Solver
1535  );
1536 
1537  ///
1538  /// save improved solution if it was found in this Solver
1539  ///
1540  virtual bool saveIfImprovedSolutionWasFound(
1541  ParaSolution *sol ///< solution found in this Solver
1542  );
1543 
1544  ///
1545  /// wait notification id message to synchronized with LoadCoordinator
1546  ///
1547  virtual void waitNotificationIdMessage(
1548  );
1549 
1550  ///
1551  /// wait ack completion to synchronized with LoadCoordinator
1552  ///
1553  virtual void waitAckCompletion(
1554  );
1555 
1556  ///
1557  /// issue interrupt to solve
1558  ///
1559  virtual void issueInterruptSolve(
1560  )
1561  {
1562  }
1563 
1564 };
1565 
1566 }
1567 
1568 #endif // __BB_PARA_SOLVER_H__
bool newParaNodeExists()
check if a new ParaNode was received or not
Definition: bbParaSolver.h:883
int minNii
minimum number of integer infeasibility
Definition: bbParaSolver.h:130
void setOnceBreak()
set once braking procedure worked
bool isOnceBreak()
check if once breaking procedure worked or not
int minTransferredBendersCutsFromSolver
minimum number of benders cuts transferred from this Solver
Definition: bbParaSolver.h:109
double rootNodeTime
Times.
Definition: bbParaSolver.h:87
virtual void createSubproblem()=0
create subproblem
double minIisum
minimum sum of integer infeasibility
Definition: bbParaSolver.h:128
int nTransferredBendersCuts
number of benders cuts transferred from a ParaNode
Definition: bbParaSolver.h:123
bool isIterativeBreakDownApplied()
check if iterative break down is applied or not
bool notificationProcessed
if true, notification is issued but not receive the corresponding LCB
Definition: paraSolver.h:140
double getLcBestDualBoundValue()
get LoadCorrdinator best dual bound value
Definition: bbParaSolver.h:746
virtual int processTagSolution(int source, int tag)
process TagSolution
bool isBreaking()
check if Solver is in racing stage or not
static ScipParaCommTh * comm
Definition: fscip.cpp:73
virtual int processTagNoNodes(int source, int tag)
process TagNoNodes
virtual int processTagTerminateSolvingToRestart(int source, int tag)
process TagTerminateSolvingToRestart
double getBoundGapForStopSolving()
get bound gap for stop solving. This value is not used to decide stop solving. It is used a part of c...
Definition: bbParaSolver.h:789
bool isAggressivePresolvingSpecified()
check if aggressive presolving is specified
bool collectingInterrupt
when the solver is interrupted, all nodes are collected to LC
Definition: bbParaSolver.h:78
bool racingInterruptIsRequested
indicate a racing interrupt is requested
Definition: paraSolver.h:105
virtual void restartRacing()
restart racing
virtual double getElapsedTime()=0
get elapsed time
virtual void waitNotificationIdMessage()
wait notification id message to synchronized with LoadCoordinator
ParaParamSet * paraParams
ParaParamSet object.
Definition: paraSolver.h:83
virtual void run(ParaRacingRampUpParamSet *inRacingRampUpParamSet)
run this Solver with ParaNode object
Definition: bbParaSolver.h:692
virtual double getDualBoundValue()=0
get dual bound value
static const int AggressivePresolveStopDepth
void countInPrecheckSolvedParaNodes()
count ParaNode solved at root node in pre-check
int nParaNodesSolvedAtRoot
number of ParaNodes solved at root node
Definition: bbParaSolver.h:116
int nTotalRestarts
number of total restarts
Definition: bbParaSolver.h:111
void setII(double sum, int count)
set sum and number of integer infeasibility
int maxRestarts
maximum number of restarts
Definition: bbParaSolver.h:113
virtual int processTagUbBoundTightened(int source, int tag)
process TagUbBoundTightened
virtual int processTagWinnerRacingRampUpParamSet(int source, int tag)
process TagWinnerRacingRampUpParamSet
void setRootNodeSimplexIter(int iter)
set number of simplex iteration at root node
double getGlobalBestIncumbentValue()
get global best incumbent value
Definition: bbParaSolver.h:971
static const int BgapStopSolvingMode
bool isRacingRampUp()
check if this solver is in racing ramp-up or not
virtual void sendCompletionOfCalculation(double stopTime)
send completion of calculation
Definition: bbParaSolver.h:438
int minTransferredBendersCuts
minimum number of benders cuts transferred from a ParaNode
Definition: bbParaSolver.h:124
int getSubMipDepth()
get depth of sub-MIP root node in global search tree
int maxTransferredLocalCuts
maximum number of local cuts (including conflict cuts) transferred from a ParaNode ...
Definition: bbParaSolver.h:122
double globalBestIncumbentValue
global best incumbent value
Definition: paraSolver.h:91
int getBigDualGapSubtreeHandlingStrategy()
get big dual gap subtree handling strategy
bool isAggressiveCollecting()
check if Solver is in aggressive collecting mode or not
Definition: bbParaSolver.h:903
virtual int bcast(ParaComm *comm, int root)=0
broadcast this object
ParaRacingRampUpParamSet * racingParams
ParaRacingRampUpParamSet object. This is also a flag to indicate running with racing ramp-up...
Definition: paraSolver.h:84
bool isRacingInterruptRequested()
check if racing interrupt was requested or not
Definition: bbParaSolver.h:834
double globalBestDualBoundValueAtWarmStart
global best dual bound value which is set when system warm starts
Definition: bbParaSolver.h:70
virtual int getNRestarts()
get number of restarts (Derived class for SCIP should override this function)
void updateNTransferredLocalCuts(int n)
update number of transferred local cuts
virtual int processTagTestDualBoundGain(int source, int tag)
process TagTestDualBoundGain
bool lightWeightRootNodeComputation
indicate that fast root node computation is required
Definition: bbParaSolver.h:80
class BbParaSolver
Definition: bbParaSolver.h:63
virtual int processTagNoWaitModeSend(int source, int tag)
process TagNoWaitModeSend
Base class for deterministic timer.
int getAggresivePresolvingDepth()
get depth to apply aggressive presolving
BbParaNodePool * selfSplitNodePool
Pool in Solver.
Definition: bbParaSolver.h:152
virtual int processTagRampUp(int source, int tag)
process TagRampUp
Defines for UG Framework.
int nTightenedInt
the number of tightened integral variable bounds in racing
Definition: bbParaSolver.h:127
virtual int processTagNotificationId(int source, int tag)
process TagNotificationId
ug_bb Tag definitions
virtual void issueInterruptSolve()
issue interrupt to solve
void updateNTransferredBendersCuts(int n)
update number of transferred benders cuts
int totalNSolved
Counters related to this BbParaSolver.
Definition: bbParaSolver.h:102
virtual bool waitToken(int rank)
wait token when UG runs with deterministic mode
Definition: paraComm.h:191
int nSent
number of ParaNodes sent from this subtree rooted from the current ParaNode
Definition: bbParaSolver.h:96
virtual void iReceiveMessages()
non-blocking receive messages
virtual long long getSimplexIter()=0
get number of simplex iterations
bool isRacingStage()
check if Solver is in racing stage or not
int maxTransferredLocalCutsFromSolver
maximum number of local cuts transferred from this Solver
Definition: bbParaSolver.h:107
int maxNii
maximum number of integer infeasibility
Definition: bbParaSolver.h:131
int nSendInCollectingMode
number of nodes need to send in collecting mode
Definition: bbParaSolver.h:75
double getTimeStopSolvingMode()
get time to stop solving. This value is not used to decide stop solving. It is used a part of conditi...
Definition: bbParaSolver.h:768
virtual void setRootNodeTime()
set root node computing time
void setNotEnoughGain()
set dual bound gain is not enough
double pendingIncumbentValue
incumbent value which is pending to update in case of deterministic runs
Definition: paraSolver.h:95
bool isCollecingInterrupt()
check if collecting interrupt (interrupt with collecting all nodes) is requested or not ...
Definition: bbParaSolver.h:844
class for deterministic timer
static const int TimeStopSolvingMode
bool anotherNodeIsRequested
indicate that another node is requested or not
Definition: bbParaSolver.h:79
virtual int processTagCutOffValue(int source, int tag)
process TagCutOffValue
virtual void waitAckCompletion()
wait ack completion to synchronized with LoadCoordinator
static const int NStopSolvingMode
virtual void sendAnotherNodeRequest(double bestDualBoundValue)
send another node request
virtual void changeSearchStrategy(int searchStrategy)
change search strategy
Definition: bbParaSolver.h:586
virtual int processTagLCBestBoundValue(int source, int tag)
process TagLCBestBoundValue
virtual void passToken(int rank)
pass token to from the rank to the next
Definition: paraComm.h:201
#define PARA_COMM_CALL(paracommcall)
Definition: paraComm.h:47
static const int Deterministic
Definition: paraParamSet.h:76
virtual int getRank()=0
get rank of this process or this thread depending on run-time environment
int nTightened
the number of tightened variable bounds in racing
Definition: bbParaSolver.h:126
virtual int getNTightened()
get number of tightened variables during racing
Definition: bbParaSolver.h:568
Base class for Timer.
virtual void run()=0
run this Solver
virtual int processTagKeepRacing(int source, int tag)
process TagKeepRacing
virtual ~BbParaSolver()
destructor
Definition: bbParaSolver.h:653
int getCurrentSolivingNodeMergingStatus()
get current solving node merging status
int getAggresivePresolvingStopDepth()
get depth to stop aggressive presolving
Base class for solver: Generic parallelized solver.
virtual void tryNewSolution(ParaSolution *sol)=0
try to enter solution to base solver environment
virtual long long getNNodesSolved()=0
get number of nodes solved
int nTransferredNodes
keep track number of transferred nodes for breaking
Definition: bbParaSolver.h:135
double getGlobalBestDualBoundValueAtWarmStart()
get global best dual bound value at warm start (restart)
Definition: bbParaSolver.h:736
double getTargetBound()
get target bound for breaking
double averageDualBoundGain
average dual bound gain
Definition: bbParaSolver.h:139
int nSolved
Counters related to the current ParaNode.
Definition: bbParaSolver.h:95
int nHandlers
number of valid message handlers
Definition: paraSolver.h:77
double globalBestCutOffValue
global best cut off value
Definition: bbParaSolver.h:71
void passToken(int rank)
pass token to the next process
bool testDualBoundGain
indicate that the dual bound gain needs to test or not
Definition: bbParaSolver.h:143
virtual bool updateGlobalBestCutOffValue(double newValue)
update global best cutoff value
virtual int processTagInCollectingMode(int source, int tag)
process TagInCollectingMode
bool isGivenGapReached()
check if given gap is reached or not
static const int BigDualGapSubtreeHandling
virtual void writeSubproblem()=0
write subproblem
double targetBound
target bound value for breaking
Definition: bbParaSolver.h:133
double solverDualBound
dual bound value achieved for a subproblem
Definition: bbParaSolver.h:137
double getRealParamValue(int param)
for real parameters
ParaTask * getCurrentNode()
get current ParaNode object
Definition: bbParaSolver.h:981
virtual int processTagGlobalBestDualBoundValueAtWarmStart(int source, int tag)
process TagGlobalBestDualBoundValueAtWarmStart
virtual int processTagLightWeightRootNodeProcess(int source, int tag)
process TagLightWeightRootNodeProcess
int nParaNodesSolvedAtPreCheck
number of ParaNodes solved at pre-checking of root node solvability
Definition: bbParaSolver.h:117
int nParaTasksReceived
Counters related to this ParaSolver.
Definition: paraSolver.h:135
virtual void sendCompletionOfCalculationWithoutSolving(double stopTime, int tag, int nSelfSplitNodesLeft)
send completion of calculation with arguments
virtual int processTagToken(int source, int tag)
process TagToken
int nTransferredBendersCutsFromSolver
number of benders cuts transferred from this Solver
Definition: bbParaSolver.h:108
virtual size_t getNumOfNodes()=0
get number of BbParaNodes in this pool
int minRestarts
minimum number of restarts
Definition: bbParaSolver.h:112
virtual void setOriginalRootNodeProcess()
set original root node process
int nSolvedWithNoPreprocesses
number of nodes solved when it is solved with no preprocesses
Definition: bbParaSolver.h:97
virtual int processTagCollectAllNodes(int source, int tag)
process TagCollectAllNodes
#define THROW_LOGICAL_ERROR1(msg1)
Definition: paraDef.h:52
virtual void freeSubproblem()=0
free subproblem
virtual int processTagTerminateRequest(int source, int tag)
process TagTerminateRequest
virtual void waitMessageIfNecessary()
wait a notification id message if it is needed to synchronize with LoadCoordinaor ...
double getRootNodeTime()
get root node computing time
Definition: bbParaSolver.h:778
virtual int processTagRetryRampUp(int source, int tag)
process TagRetryRampUp
virtual int getNNodesLeft()=0
get number of nodes left
Base class of communicator for UG Framework.
virtual void sendLocalSolution()
send solution found in this Solver
virtual bool canGenerateSpecialCutOffValue()
check if base solver can generate special cut off value or not
virtual int getRank()
get rank of this Solver
int maxTransferredBendersCuts
maximum number of benders cuts transferred from a ParaNode
Definition: bbParaSolver.h:125
virtual int processTagNoTestDualBoundGain(int source, int tag)
process TagNoTestDualBoundGain
int maxNSolved
maximum number of subtree nodes rooted from ParaNode
Definition: bbParaSolver.h:104
ParaTimer * paraTimer
timer for this ParaSolver
Definition: paraSolver.h:88
virtual int processTagTaskReceived(int source, int tag)
process TagTaskReceived
Base class for racing ramp-up parameter set.
void resetBreakingInfo()
reset breaking information
bool enoughGainObtained
indicate that the root node process improved dual bound enough or not
Definition: bbParaSolver.h:140
virtual void solve()=0
solve (sub)problem
virtual int processTagBreaking(int source, int tag)
process TagBreaking
double getCurrentSolvingNodeInitialDualBound()
get initial dual bound of current solving node
virtual void setRacingParams(ParaRacingRampUpParamSet *racingParms, bool winnerParam)=0
set racing parameters
bool isInCollectingMode()
check if Solver is in collecting mode or not
Definition: bbParaSolver.h:893
virtual bool updateGlobalBestIncumbentValue(double newValue)
update global best incumbent value
class ParaParamSet
Definition: paraParamSet.h:850
double maxIisum
maximum sum of integer infeasibility
Definition: bbParaSolver.h:129
double getPendingIncumbentValue()
get pending incumbent value
class for instance data
Definition: paraInstance.h:50
bool globalIncumbnetValueUpdateFlag
indicate that global incumbent value is updated in iReceiveMessages() routine
Definition: paraSolver.h:139
virtual void setOriginalNodeSelectionStrategy()=0
set original node selection strategy
Class for the difference between instance and subproblem.
virtual int ubBoundTightened(int source, int tag)
upper bound of variable tightened
Definition: bbParaSolver.h:557
int nTransferredLocalCuts
number of local cuts (including conflict cuts) transferred from a ParaNode
Definition: bbParaSolver.h:120
double minRootNodeTime
minimum time consumed by root node process
Definition: bbParaSolver.h:89
double getElapsedTimeOfNodeSolving()
the following functions may be called from callback routines of the target Solver ...
Definition: bbParaSolver.h:726
virtual bool saveIfImprovedSolutionWasFound(ParaSolution *sol)
save improved solution if it was found in this Solver
BbParaSolver()
constructor
Definition: bbParaSolver.h:631
virtual ParaTask * createParaTask()=0
create ParaTask object by default constructor
virtual bool updateGlobalBestIncumbentSolution(ParaSolution *sol)
update global best incumbent solution
virtual int getThresholdValue(int nNodes)
get threshold value to send ParaNodes to LoadCoordinator
ParaTask * currentTask
solving task
Definition: paraSolver.h:97
double getAverageDualBoundGain()
get average dual bound gain
virtual int processTagOutCollectingMode(int source, int tag)
process TagOutCollectingMode
int getSelfSplitNodesLeft()
get the number of nodes in slef-split node pool
bool givenGapIsReached
indicate that the given gap is reached or not
Definition: bbParaSolver.h:142
void globalIncumbnetValueIsReflected()
set global incumbent value is reflected
Definition: bbParaSolver.h:824
virtual bool wasTerminatedNormally()=0
check if Solver was terminated normally or not
double getBoundGapForCollectingMode()
get bound gap for collecting mode
Definition: bbParaSolver.h:799
class BbParaNode
Definition: bbParaNode.h:61
static const int BgapCollectingMode
double idleTimeToWaitToken
idle time to wait token
Definition: paraSolver.h:123
static const int AggressivePresolveDepth
virtual void keepParaNode(long long n, int depth, double dualBound, double estimateValue, ParaDiffSubproblem *diffSubproblem)
keep a branch-and-bound node as ParaNode to LoadCoordinator
double maxRootNodeTime
maximum time consumed by root node process
Definition: bbParaSolver.h:90
bool collectingManyNodes
indicate that many nodes collecting is requested by LC
Definition: bbParaSolver.h:77
virtual void notifySelfSplitFinished()
notify Self-Split finished
int nTransferLimit
limit number of transferring nodes for breaking
Definition: bbParaSolver.h:134
bool isDualBoundGainTestNeeded()
check if dual bound gain needs to be tested or not
static const int RampUpPhaseProcess
bool isCollectingAllNodes()
check if Solver is sending all nodes to LoadCoordinaor or not
virtual bool notificationIsNecessary()
check if a notification message needs to send or not
bool aggressiveCollecting
indicate that if this solver has two nodes, this solver sends one to LC
Definition: bbParaSolver.h:74
virtual bool receiveNewTaskAndReactivate()
wait for receiving a new node and reactivate solver
void setKeepRacing(bool value)
set keep racing value
virtual void setWinnerRacingParams(ParaRacingRampUpParamSet *racingParms)=0
set winner racing parameters
void setSendBackAllNodes()
set counter and flag to indicate that all nodes are sent to LoadCooordinator
virtual void run()
int maxTransferredBendersCutsFromSolver
maximum number of benders cuts transferred from this Solver
Definition: bbParaSolver.h:110
double paraTaskStartTime
start time of current ParaTask
Definition: paraSolver.h:112
int getNStopSolvingMode()
get number of nodes to stop solving. This number is not used to decide stop solving. It is used a part of conditions.
Definition: bbParaSolver.h:757
class BbParaNodePool
ParaInstance * getParaInstance()
get ParaInstance object
Definition: bbParaSolver.h:991
ParaTask * newTask
new task to solve
Definition: paraSolver.h:98
bool getNotificaionProcessed()
check if Solver is in notification process or not TODO: function name should be changed ...
Definition: bbParaSolver.h:961
bool waitToken(int rank)
wait token for deterministic mode
ParaInstance * paraInstance
root problem instance
Definition: paraSolver.h:96
double lcBestDualBoundValue
LoadCoordinator best dual bound value.
Definition: bbParaSolver.h:72
virtual int processTagWinner(int source, int tag)
process TagWinner
int totalNImprovedIncumbent
accumulated number of improvements of incumbent value in this BbParaSolver
Definition: bbParaSolver.h:115
int getIntParamValue(int param)
for int parameters
ParaComm * paraComm
ParaCommunicator object.
Definition: paraSolver.h:82
virtual int processTagRestart(int source, int tag)
process TagRestart
virtual void setLightWeightRootNodeProcess()
set light weight root node process
virtual int processTagLbBoundTightened(int source, int tag)
process TagLbBoundTightened
virtual void sendSolverState(long long nNodesSolved, int nNodesLeft, double bestDualBoundValue, double detTime)
send Solver state to LoadCoordinator
double totalRootNodeTime
accumulated root node process time solved by this solver so far
Definition: bbParaSolver.h:88
bool isGlobalIncumbentUpdated()
check if global incumbent value is updated or not
Definition: bbParaSolver.h:815
int nCollectOnce
number of nodes need to collect once
Definition: bbParaSolver.h:76
ParaParamSet * getParaParamSet()
get ParaParamSet object
int minTransferredLocalCuts
minimum number of local cuts (including conflict cuts) transferred from a ParaNode ...
Definition: bbParaSolver.h:121
virtual bool sendIfImprovedSolutionWasFound(ParaSolution *sol)
send improved solution if it was found in this Solver
int(BbParaSolver::* BbMessageHandlerFunctionPointer)(int, int)
Definition: bbParaSolver.h:68
int totalNSent
accumulated number of nodes sent from this BbParaSolver
Definition: bbParaSolver.h:114
virtual void sendParaNode(long long n, int depth, double dualBound, double estimateValue, ParaDiffSubproblem *diffSubproblem)
send a branch-and-bound node as ParaNode to LoadCoordinator
class ParaRacingRampUpParamSet (parameter set for racing ramp-up)
int nSimplexIterRoot
number of simplex iteration at root node
Definition: bbParaSolver.h:119
int minTransferredLocalCutsFromSolver
minimum number of local cuts transferred from this Solver
Definition: bbParaSolver.h:106
virtual int processTagTask(int source, int tag)
Message handlers
bool localIncumbentIsChecked
indicate if a local incumbent solution is checked or not
Definition: bbParaSolver.h:147
class ParaSolver
Definition: paraSolver.h:70
bool isAnotherNodeIsRequested()
check if another node is requested or not
virtual int processTagGivenGapIsReached(int source, int tag)
process TagGivenGapIsReached
virtual void sendSolverTerminationState()
send Solver termination state
virtual void solveToCheckEffectOfRootNodePreprocesses()
solve to check effect of root node preprocesses
Definition: bbParaSolver.h:535
virtual void writeCurrentTaskProblem(const std::string &filename)=0
write current node problem (this method is always useful for debugging, so we should implement this m...
bool noWaitModeSend
indicate that no wait mode sending is applied
Definition: bbParaSolver.h:144
Base class of communicator object.
Definition: paraComm.h:101
int getNSendInCollectingMode()
get number of ParaNodes already sent in a collecting mode
bool keepRacing
indicate if Solver needs to do racing ramp-up repeatedly in case of warm start
Definition: bbParaSolver.h:145
virtual int processTagInterruptRequest(int source, int tag)
process TagInterruptRequest
class for solution
Definition: paraSolution.h:53
Base class for solution.
virtual int lbBoundTightened(int source, int tag)
lower bound of variable tightened
Definition: bbParaSolver.h:545
bool collectingMode
indicate whether if this solver is in collecting mode or not
Definition: bbParaSolver.h:73
static const int IterativeBreakDown
int minNSolved
minimum number of subtree nodes rooted from ParaNode
Definition: bbParaSolver.h:103
virtual int processTagIncumbentValue(int source, int tag)
process TagIncumbentValue
int nTransferredLocalCutsFromSolver
number of local cuts transferred from this Solver
Definition: bbParaSolver.h:105
virtual int getNTightenedInt()
get number of tightened integral variables during racing
Definition: bbParaSolver.h:577
bool isManyNodesCollectionRequested()
check if many nodes collection was requested or not
Definition: bbParaSolver.h:913
bool onceBreak
indicate that the sub-MIP is broken down once
Definition: bbParaSolver.h:82
ParaComm * getParaComm()
get paraParaComm
Definition: bbParaSolver.h:665
double getCutOffValue()
get cut off value
bool isEnoughGainObtained()
check if dual bound gains enough or not
class ParaTask
Definition: paraTask.h:541
bool getBoolParamValue(int param)
for bool parameters
bool isTransferLimitReached()
check if the number of ParaNodes sent is reached to transfer limit specified
bool restartingRacing
indicate that this solver is restarting racing
Definition: bbParaSolver.h:146