37#ifndef __PARA_SOLVER_H__
38#define __PARA_SOLVER_H__
52#define ENFORCED_THRESHOLD 5
182 std::cout <<
"*** virtual function ParaSolver::processTagRampUp is called ***" << std::endl;
204 std::cout <<
"*** virtual function ParaSolver::processTagIncumbentValue is called ***" << std::endl;
244 std::cout <<
"*** virtual function ParaSolver::processTagWinnerRacingRampUpParamSet is called ***" << std::endl;
257 std::cout <<
"*** virtual function ParaSolver::processTagWinner is called ***" << std::endl;
270 std::cout <<
"*** virtual function ParaSolver::processTagToken is called ***" << std::endl;
314 std::cout <<
"*** virtual function ParaSolver::updateGlobalBestIncumbentSolution is called ***" << std::endl;
326 std::cout <<
"*** virtual function ParaSolver::updateGlobalBestIncumbentValue is called ***" << std::endl;
338 std::cout <<
"*** virtual function ParaSolver::setRacingParams is called ***" << std::endl;
348 std::cout <<
"*** virtual function ParaSolver::setWinnerRacingParams is called ***" << std::endl;
357 std::cout <<
"*** virtual function ParaSolver::createSubproblem is called ***" << std::endl;
366 std::cout <<
"*** virtual function ParaSolver::freeSubproblem is called ***" << std::endl;
381 std::cout <<
"*** virtual function ParaSolver::reinitializeInstance is called ***" << std::endl;
458 std::cout <<
"*** virtual function ParaSolver::run(araRacingRampUpParamSet *) is called ***" << std::endl;
543 std::cout <<
"*** virtual function ParaSolver::sendIfImprovedSolutionWasFound is called ***" << std::endl;
554 std::cout <<
"*** virtual function ParaSolver::saveIfImprovedSolutionWasFound is called ***" << std::endl;
564 std::cout <<
"*** virtual function ParaSolver::sendLocalSolution is called ***" << std::endl;
715 std::cout <<
"*** virtual function ParaSolver::waitToken is called ***" << std::endl;
731 std::cout <<
"*** virtual function ParaSolver::passToken is called ***" << std::endl;
798 const std::string& filename
Base class of communicator object.
virtual int getRank()=0
get rank of this process or this thread depending on run-time environment
class for deterministic timer
class ParaRacingRampUpParamSet (parameter set for racing ramp-up)
ParaTask * getCurrentTask()
get current ParaTask object
virtual bool wasTerminatedNormally()=0
check if Solver was terminated normally or not
double idleTimeToWaitNotificationId
idle time to wait a message within collecting mode
virtual int getRank()
get rank of this Solver
virtual int processTagNotificationId(int source, int tag)=0
process TagNotificationId
bool rampUp
indicate whether if ramp-up phase is finished or not: true - finish
virtual void updatePendingSolution()
update pending solution
ParaParamSet * paraParams
ParaParamSet object.
virtual void setRacingParams(ParaRacingRampUpParamSet *racingParms, bool winnerParam)
set racing parameters
virtual void waitNotificationIdMessage()=0
wait notification id message to synchronized with LoadCoordinator
ParaComm * paraComm
ParaCommunicator object.
virtual void run()=0
run this Solver
void setPreviousCommTime(double detTime)
set previous communication time for deterministic execution
virtual bool notificationIsNecessary()=0
check if a notification message needs to send or not TODO: function name should be isNotificationNece...
bool stayAliveAfterInterrupt
indicate that stay alive this solver after interrupt request
double paraTaskStartTime
start time of current ParaTask
void setTerminationMode(int tm)
set termination mode
virtual void iReceiveMessages()=0
non-blocking receive messages
ParaTask * currentTask
solving task
double offsetTimeToWaitToken
offset time to wait token
bool notificationProcessed
if true, notification is issued but not receive the corresponding LCB
virtual bool receiveNewTaskAndReactivate()=0
wait for receiving a new task and reactivate solver
bool racingInterruptIsRequested
indicate a racing interrupt is requested
virtual void waitMessageIfNecessary()=0
wait a notification id message if it is needed to synchronize with LoadCoordinaor
ParaComm * getParaComm()
get paraParaComm
bool updatePendingSolutionIsProceeding
update pending solution process is proceeding
bool isWaitingForSpecificMessage()
check if Solver is waiting for a specific message or not
ParaSolution * getGlobalBestIncumbentSolution()
get global best incumbent solution
bool isRampUp()
check if this solver is ramp-up or not
int nParaTasksReceived
Counters related to this ParaSolver.
virtual void passToken(int rank)
pass token to the next process
double idleTimeBetweenParaTasks
idle time between ParaTasks processing
virtual int processTagWinner(int source, int tag)
process TagWinner
bool waitingSpecificMessage
indicate that this solver is waiting for a specific message
double previousNotificationTime
previous notification time
ParaParamSet * getParaParamSet()
get ParaParamSet object
virtual int processTagTerminateRequest(int source, int tag)=0
process TagTerminateRequest
virtual void freeSubproblem()
free subproblem
bool racingIsInterrupted
indicate whether if racing phases is interrupted or not: true - interrupted
virtual void writeCurrentTaskProblem(const std::string &filename)=0
write current task problem (this method is always useful for debugging, so we should implement this m...
virtual void run(ParaRacingRampUpParamSet *inRacingRampUpParamSet)
run this solver with racing parameters
virtual bool waitToken(int rank)
wait token for deterministic mode
double pendingIncumbentValue
incumbent value which is pending to update in case of deterministic runs
ParaSolution * globalBestIncumbentSolution
global best solution. However, this is not always feasible for the current sub-MIP
double getElapsedTimeOfTaskSolving()
the following functions may be called from callback routines of the target Solver
virtual bool updateGlobalBestIncumbentSolution(ParaSolution *sol)
update global best incumbent solution
double previousIdleTimeToWaitToken
previous idle time to wait token
ParaDeterministicTimer * getDeterministicTimer()
get deterministic timer object
virtual int processTagInterruptRequest(int source, int tag)=0
process TagInterruptRequest
virtual void reinitialize()
re-initialized instance
bool memoryLimitIsReached
indicate if memory limit is reached or not, when base solver has memory management feature
unsigned int notificationIdGenerator
virtual int processTagRampUp(int source, int tag)
process TagRampUp
ParaRacingRampUpParamSet * winnerRacingParams
Winner ParaRacingRampUpParamSet object.
bool warmStarted
indicate whether if system is warm started or not
virtual int processTagSolution(int source, int tag)=0
process TagSolution
double eps
absolute values smaller than this are considered zero esp should be set in the constructor of the der...
ParaSolution * localIncumbentSolution
incumbent solution generated in local solver
virtual void setWinnerRacingParams(ParaRacingRampUpParamSet *racingParms)
set winner racing parameters
virtual bool updateGlobalBestIncumbentValue(double newValue)
update global best incumbent value
virtual bool sendIfImprovedSolutionWasFound(ParaSolution *sol)
send improved solution if it was found in this Solver
ParaSolution * pendingSolution
solution which is pending to update in case of deterministic runs
double idleTimeToWaitToken
idle time to wait token
int(ParaSolver::* MessageHandlerFunctionPointer)(int, int)
virtual void solve()=0
solve (sub)problem
ParaTimer * paraTimer
timer for this ParaSolver
virtual int processTagIncumbentValue(int source, int tag)
process TagIncumbentValue
virtual int processTagTaskReceived(int source, int tag)=0
process TagTaskReceived
void terminateRacing()
terminate racing stage
virtual void writeSubproblem()=0
write subproblem
virtual void sendLocalSolution()
send solution found in this Solver
double idleTimeToWaitAckCompletion
idle time to wait acknowledgment of completion
virtual void createSubproblem()
create subproblem
ParaRacingRampUpParamSet * racingParams
ParaRacingRampUpParamSet object. This is also a flag to indicate running with racing ramp-up.
bool isRacingWinner()
check if this solver is in racing ramp-up or not
virtual int processTagWinnerRacingRampUpParamSet(int source, int tag)
process TagWinnerRacingRampUpParamSet
ParaInstance * getParaInstance()
get ParaInstance object
int nImprovedIncumbent
Counters related to the current ParaTask.
bool isWarmStarted()
check if current execution is warm start (restart) or not
virtual void run(ParaTask *paraTask)
run this Solver with ParaTask object
double previousStopTime
Idle Times.
bool isTerminationRequested()
check if termination was requested or not
virtual int processTagTask(int source, int tag)=0
process TagTask
double idleTimeAfterLastParaTask
idle time after the last ParaTask was solved
virtual void sendCompletionOfCalculation(double stopTime)=0
restart racing
virtual int processTagToken(int source, int tag)
process TagToken
ParaTask * newTask
new task to solve
bool isInterrupting()
check if Solver is in interrupting phase or not
virtual void waitAckCompletion()=0
wait ack completion to synchronized with LoadCoordinator
double globalBestIncumbentValue
global best incumbent value
bool racingWinner
indicate racing ramp-up winner or not: true - winner
virtual void tryNewSolution(ParaSolution *sol)=0
try to enter solution to base solver environment
bool globalIncumbnetValueUpdateFlag
indicate that global incumbent value is updated in iReceiveMessages() routine
virtual ~ParaSolver()
destructor
double previousCommTime
previous communication time for deterministic execution
bool subproblemFreed
indicate that subproblem is already freed or not
double getOffsetTimeToWaitToken()
get offset time to wait token
ParaDeterministicTimer * paraDetTimer
deterministic timer for this ParaSolver
virtual bool saveIfImprovedSolutionWasFound(ParaSolution *sol)
save improved solution if it was found in this Solver
double getPreviousCommTime()
get previous communication time for deterministic execution
double idleTimeToFirstParaTask
idle time to start solving the first ParaTask
int nHandlers
number of valid message handlers
int nParaTasksSolved
number of ParaTasks solved ( received ) in this ParaSolver
MessageHandlerFunctionPointer * messageHandler
table for message handlers
int terminationMode
indicate that termination mode 0: no termination mode 1: normal termination mode 2: interrupted termi...
int getTerminationMode()
get termination mode
bool newParaTaskExists()
check if a new ParaTask was received or not
ParaInstance * paraInstance
root problem instance
bool getNotificaionProcessed()
check if Solver is in notification process or not TODO: function name should be changed
virtual double getElapsedTime()=0
get elapsed time
static ScipParaCommTh * comm
static const int NoTerminationMode
termination mode
static const int UgBaseTerminationModeLast
static const int NormalTerminationMode
static const int TimeLimitTerminationMode
static const int InterruptedTerminationMode
Base class of communicator for UG Framework.
Defines for UG Framework.
#define THROW_LOGICAL_ERROR1(msg1)
Base class for deterministic timer.
Parameter set for UG framework.
Base class for racing ramp-up parameter set.