Scippy

UG

Ubiquity Generator framework

ScipParaInitiator Class Reference

#include <scipParaInitiator.h>

Inheritance diagram for ScipParaInitiator:
BbParaInitiator ParaInitiator

Public Member Functions

 ScipParaInitiator (UG::ParaComm *inComm, UG::ParaTimer *inTimer)
 
virtual ~ScipParaInitiator ()
 
virtual int init (UG::ParaParamSet *paraParams, int argc, char **argv)
 
int reInit (int nRestartedRacing)
 
UG::ParaInstancegetParaInstance ()
 
UG::BbParaDiffSubproblemmakeRootNodeDiffSubproblem ()
 
bool tryToSetIncumbentSolution (UG::BbParaSolution *sol, bool checksol)
 
void sendSolverInitializationMessage ()
 
void generateRacingRampUpParameterSets (int nParamSets, UG::ParaRacingRampUpParamSet **racingRampUpParamSets)
 
UG::BbParaSolutiongetGlobalBestIncumbentSolution ()
 
int getNSolutions ()
 
double convertToExternalValue (double internalValue)
 
double convertToInternalValue (double externalValue)
 
char * getSolutionFileName ()
 
double getAbsgap (double dualBoundValue)
 
double getGap (double dualBoundValue)
 
double getAbsgapValue ()
 
double getAbsgapValue (SCIP *inScip)
 
double getGapValue ()
 
double getGapValue (SCIP *inScip)
 
double getEpsilon ()
 
void writeSolution (const std::string &message)
 
void writeParaInstance (const std::string &filename)
 
void writeSolverParameters (std::ostream *os)
 
void writeCheckpointSolution (const std::string &filename)
 
double readSolutionFromCheckpointFile (char *afterCheckpointingSolutionFileName)
 
std::string getStatus ()
 
void printSolverVersion (std::ostream *os)
 
bool isFeasibleSolution ()
 
void accumulateInitialStat (UG::ParaInitialStat *initialStat)
 
void setInitialStatOnDiffSubproblem (int minDepth, int maxDepth, UG::BbParaDiffSubproblem *diffSubproblem)
 
void setFinalSolverStatus (UG::FinalSolverState status)
 
void setNumberOfNodesSolved (long long n)
 
void setDualBound (double bound)
 
void outputFinalSolverStatistics (std::ostream *os, double time)
 
void setUserPlugins (ScipUserPlugins *inUi)
 
void includeUserPlugins (SCIP *inScip)
 
bool isObjIntegral ()
 
void interrupt ()
 
- Public Member Functions inherited from BbParaInitiator
 BbParaInitiator (ParaComm *inComm, ParaTimer *inTimer)
 constructor More...
 
virtual ~BbParaInitiator ()
 destructor More...
 
BbParaNodereadParaNodeFromCheckpointFile (bool onlyBoundChanges)
 read a ParaNode from checkpoint file More...
 
bool isSolvedAtInit ()
 check if problem is solved at init or not More...
 
bool isSolvedAtReInit ()
 check if problem is solved at reInit or not More...
 
void setTightenedVarLbs (int i, double v)
 set tightened variable lower bound TODO: this function should be in inherited class More...
 
void setTightenedVarUbs (int i, double v)
 set tightened variable upper bound TODO: this function should be in inherited class More...
 
double getTightenedVarLbs (int i)
 get tightened variable lower bound TODO: this function should be in inherited class More...
 
double getTightenedVarUbs (int i)
 get tightened variable upper bound TODO: this function should be in inherited class More...
 
bool areTightenedVarBounds ()
 check if there are tightened lower or upper bound TODO: this function should be in inherited class More...
 
virtual BbParaDiffSubproblemmakeRootNodeDiffSubproblem ()=0
 make DiffSubproblem object for root node More...
 
virtual double convertToExternalValue (double internalValue)=0
 convert objective function value to external value TODO: this function may be in inherited class More...
 
virtual BbParaSolutiongetGlobalBestIncumbentSolution ()=0
 get global best incumbent solution More...
 
virtual int getNSolutions ()=0
 get the number of incumbent solutions More...
 
virtual bool tryToSetIncumbentSolution (BbParaSolution *sol, bool checksol)=0
 try to set incumbent solution More...
 
virtual double getAbsgap (double dualBoundValue)=0
 get absolute gap of dual bound value More...
 
virtual double getGap (double dualBoundValue)=0
 get relative gap of dual bound value More...
 
virtual double getAbsgapValue ()=0
 get absgap value specified More...
 
virtual double getGapValue ()=0
 get gap value specified More...
 
virtual void setFinalSolverStatus (FinalSolverState status)=0
 set final solver status More...
 
virtual void setNumberOfNodesSolved (long long n)=0
 set number of nodes solved More...
 
virtual void setDualBound (double bound)=0
 set final dual bound More...
 
virtual bool isFeasibleSolution ()=0
 check if feasible solution exists or not More...
 
virtual void accumulateInitialStat (ParaInitialStat *initialStat)
 accumulate initial status More...
 
virtual void setInitialStatOnDiffSubproblem (int minDepth, int maxDepth, BbParaDiffSubproblem *diffSubproblem)
 set initial status on DiffSubproblem More...
 
virtual bool isObjIntegral ()
 check if objective function value is always integral or not More...
 
virtual bool canGenerateSpecialCutOffValue ()
 check if solver can generate special cut off value or not More...
 
- Public Member Functions inherited from ParaInitiator
 ParaInitiator (ParaComm *inComm, ParaTimer *inTimer)
 constructor More...
 
virtual ~ParaInitiator ()
 destructor More...
 
bool isWarmStarted ()
 check if the execution is warm started (restarted) or not More...
 
const char * getPrefixWarm ()
 get prefix of warm start (restart) files More...
 
ParaCommgetParaComm ()
 get communicator being used More...
 
virtual int init (ParaParamSet *params, int argc, char **argv)=0
 initialize initiator More...
 
virtual int reInit (int nRestartedRacing)=0
 reinitizalie initiator TODO: this function should be in inherited class More...
 
virtual ParaInstancegetParaInstance ()=0
 get instance object More...
 
virtual void sendSolverInitializationMessage ()=0
 send solver initialization message More...
 
virtual void generateRacingRampUpParameterSets (int nParamSets, ParaRacingRampUpParamSet **racingRampUpParamSets)=0
 generate racing ramp-up parameter sets TODO: this function may be in inherited class More...
 
virtual double getEpsilon ()=0
 get epsilon specified More...
 
virtual void writeSolution (const std::string &message)=0
 write solution More...
 
virtual void writeParaInstance (const std::string &filename)=0
 write ParaInstance More...
 
virtual void writeCheckpointSolution (const std::string &filename)=0
 write checkpoint solution More...
 
virtual double readSolutionFromCheckpointFile (char *afterCheckpointingSolutionFileName)=0
 read solution from checkpoint file More...
 
virtual void writeSolverParameters (std::ostream *os)=0
 write solver runtime parameters More...
 
virtual void outputFinalSolverStatistics (std::ostream *os, double time)=0
 output final solver statistics More...
 
virtual std::string getStatus ()=0
 get solving status string More...
 
virtual void printSolverVersion (std::ostream *os)=0
 print solver version More...
 

Protected Member Functions

bool addRootNodeCuts ()
 
void outputProblemInfo (int *nNonLinearConsHdlrs)
 
bool onlyLinearConsHandler ()
 

Protected Attributes

UG::ParaParamSetparaParams
 
ScipParaInstanceinstance
 
ScipParaSolutionsolution
 
ScipDiffParamSetscipDiffParamSetRoot
 
ScipDiffParamSetscipDiffParamSet
 
SCIP_MESSAGEHDLR * messagehdlr
 
FILE * logfile
 
FILE * solutionFile
 
FILE * transSolutionFile
 
SCIP * scip
 
char * probname
 
char * settingsNameLC
 
char * settingsNameRoot
 
char * settingsName
 
char * racingSettingsName
 
char * logname
 
char * isolname
 
char * generatedIsolname
 
char * solutionFileName
 
ScipUserPluginsuserPlugins
 
SCIP_Real finalDualBound
 
UG::FinalSolverState finalState
 
long long nSolved
 
double absgap
 
double gap
 
double objlimit
 
bool qsol
 
- Protected Attributes inherited from BbParaInitiator
bool solvedAtInit
 solved at init More...
 
bool solvedAtReInit
 solved at reInit More...
 
double * tightenedVarLbs
 array of tightened lower bound of variable More...
 
double * tightenedVarUbs
 array of tightened upper bound of variable More...
 
gzstream::igzstream checkpointTasksStream
 gzstream for checkpoint tasks file More...
 
- Protected Attributes inherited from ParaInitiator
ParaCommparaComm
 communicator used More...
 
ParaTimertimer
 timer used More...
 
char * prefixWarm
 prefix of warm start files More...
 

Detailed Description

Initiator class

Definition at line 60 of file scipParaInitiator.h.

Constructor & Destructor Documentation

◆ ScipParaInitiator()

ScipParaInitiator ( UG::ParaComm inComm,
UG::ParaTimer inTimer 
)

constructor

Definition at line 100 of file scipParaInitiator.h.

◆ ~ScipParaInitiator()

Member Function Documentation

◆ accumulateInitialStat()

void accumulateInitialStat ( UG::ParaInitialStat initialStat)
virtual

◆ addRootNodeCuts()

◆ convertToExternalValue()

double convertToExternalValue ( double  internalValue)
virtual

convert an internal value to external value

Implements BbParaInitiator.

Definition at line 209 of file scipParaInitiator.h.

References ScipParaInstance::convertToExternalValue(), and ScipParaInitiator::instance.

Referenced by ScipParaInitiator::tryToSetIncumbentSolution().

◆ convertToInternalValue()

double convertToInternalValue ( double  externalValue)

convert an external value to internal value

Definition at line 217 of file scipParaInitiator.h.

References ScipParaInstance::convertToInternalValue(), and ScipParaInitiator::instance.

Referenced by ScipParaInitiator::tryToSetIncumbentSolution().

◆ generateRacingRampUpParameterSets()

void generateRacingRampUpParameterSets ( int  nParamSets,
UG::ParaRacingRampUpParamSet **  racingRampUpParamSets 
)
virtual

◆ getAbsgap()

double getAbsgap ( double  dualBoundValue)
virtual

◆ getAbsgapValue() [1/2]

double getAbsgapValue ( )
virtual

get absgap value specified

Implements BbParaInitiator.

Definition at line 238 of file scipParaInitiator.h.

References ScipParaInitiator::absgap, and ScipParaInitiator::scip.

Referenced by ScipParaInitiator::init().

◆ getAbsgapValue() [2/2]

double getAbsgapValue ( SCIP *  inScip)

get absgap value for a specific SCIP

Definition at line 248 of file scipParaInitiator.h.

◆ getEpsilon()

double getEpsilon ( )
virtual

get epsilon

Implements ParaInitiator.

Definition at line 1812 of file scipParaInitiator.cpp.

References ScipParaInitiator::scip.

Referenced by ScipParaInitiator::tryToSetIncumbentSolution().

◆ getGap()

◆ getGapValue() [1/2]

double getGapValue ( )
virtual

get gap value specified

Implements BbParaInitiator.

Definition at line 257 of file scipParaInitiator.h.

References ScipParaInitiator::gap, and ScipParaInitiator::scip.

Referenced by ScipParaInitiator::init().

◆ getGapValue() [2/2]

double getGapValue ( SCIP *  inScip)

get gap value for a specific SCIP

Definition at line 267 of file scipParaInitiator.h.

◆ getGlobalBestIncumbentSolution()

UG::BbParaSolution * getGlobalBestIncumbentSolution ( )
virtual

Implements BbParaInitiator.

Definition at line 198 of file scipParaInitiator.h.

References ScipParaInitiator::solution.

◆ getNSolutions()

int getNSolutions ( )
virtual

Implements BbParaInitiator.

Definition at line 203 of file scipParaInitiator.h.

References ScipParaInitiator::scip.

◆ getParaInstance()

UG::ParaInstance * getParaInstance ( )
virtual

get instance

Implements ParaInitiator.

Definition at line 176 of file scipParaInitiator.h.

References ScipParaInitiator::instance.

Referenced by main(), outputParaParamSet(), and outputSolverParams().

◆ getSolutionFileName()

char * getSolutionFileName ( )

get solution file name

Definition at line 225 of file scipParaInitiator.h.

References ScipParaInitiator::solutionFileName.

◆ getStatus()

std::string getStatus ( )
virtual

get solving status string

Implements ParaInitiator.

Definition at line 2204 of file scipParaInitiator.cpp.

References ScipParaInitiator::scip.

◆ includeUserPlugins()

void includeUserPlugins ( SCIP *  inScip)

include user plugins

Definition at line 334 of file scipParaInitiator.h.

References ScipParaInitiator::userPlugins.

Referenced by ScipParaInitiator::init().

◆ init()

int init ( UG::ParaParamSet paraParams,
int  argc,
char **  argv 
)
virtual

init function

the first argument is runtime parameter file for ParaSCIP

the second argument is problem file name

to omit this parameter

to omit this parameter and the following value

user include plugins

user include plugins

user include plugins

instance needs to be generated befor presolving

check if feasible solution is found or not. If it was found, then generate paraSolution

In ParaSCIP case, instance have to provided for the presolved instance

Implements ParaInitiator.

Definition at line 205 of file scipParaInitiator.cpp.

References ScipParaInitiator::addRootNodeCuts(), ParaComm::bcast(), BbParaInitiator::checkpointTasksStream, ScipParaInstance::convertToInternalValue(), DEF_SCIP_PARA_COMM, EPSLT, ScipParaInitiator::finalDualBound, ScipParaInitiator::getAbsgapValue(), ParaParamSet::getBoolParamValue(), ParaTimer::getElapsedTime(), ScipParaInitiator::getGapValue(), ParaParamSet::getIntParamValue(), ScipParaInstance::getProbName(), ParaComm::getRank(), ParaParamSet::getRealParamValue(), ParaComm::getSize(), ParaParamSet::getStringParamValue(), UG::HardTimeLimitIsReached, ScipParaInitiator::includeUserPlugins(), ScipParaInitiator::instance, UG::InstanceTransferMethod, ScipParaInitiator::isolname, ScipParaInitiator::logfile, ScipParaInitiator::logname, UG::LogSolvingStatusFilePath, ParaSCIP::MemoryLimit, UG::MemoryLimitIsReached, memoryLimitOfSolverSCIP, ScipParaInitiator::messagehdlr, MINEPSILON, UG::NoPreprocessingInLC, ScipParaInitiator::objlimit, ScipParaInitiator::onlyLinearConsHandler(), UG::OutputPresolvedInstance, ScipParaInitiator::outputProblemInfo(), PARA_COMM_CALL, ParaInitiator::paraComm, UG::ParaINT, ScipParaInitiator::paraParams, ParaInitiator::prefixWarm, ScipParaInitiator::printSolverVersion(), UG::ProblemWasSolved, ScipParaInitiator::probname, ScipParaInitiator::qsol, UG::Quiet, ScipParaInitiator::racingSettingsName, UG::RampUpPhaseProcess, ScipParaInitiator::scip, SCIP_FIXED_MEMORY_FACTOR, SCIP_MEMORY_COPY_FACTOR, SCIP_PRESOLVIG_MEMORY_FACTOR, ScipParaInitiator::scipDiffParamSet, ScipParaInitiator::scipDiffParamSetRoot, ScipParaInitiator::setFinalSolverStatus(), ParaParamSet::setIntParamValue(), ScipParaInitiator::settingsName, ScipParaInitiator::settingsNameLC, ScipParaInitiator::settingsNameRoot, ScipParaInitiator::solution, ScipParaInitiator::solutionFile, ScipParaInitiator::solutionFileName, UG::SolutionFilePath, BbParaInitiator::solvedAtInit, UG::SolverSettingsAtRacing, UG::SolverSettingsAtRootNode, UG::SolverSettingsExceptRootNode, UG::SolverSettingsForInitialPresolving, THROW_LOGICAL_ERROR1, THROW_LOGICAL_ERROR3, UG::TimeLimit, ParaInitiator::timer, ScipParaInitiator::transSolutionFile, UG::UseRootNodeCuts, virtualMemUsedAtLc, and ScipParaInitiator::writeSolution().

Referenced by main().

◆ interrupt()

void interrupt ( )

Definition at line 345 of file scipParaInitiator.h.

References ScipParaInitiator::scip.

◆ isFeasibleSolution()

bool isFeasibleSolution ( )
virtual

check if feasilbe soltuion exists or not

Implements BbParaInitiator.

Definition at line 301 of file scipParaInitiator.h.

References ScipParaInitiator::scip.

◆ isObjIntegral()

bool isObjIntegral ( )
virtual

returns whether the objective value is known to be integral in every feasible solution

Reimplemented from BbParaInitiator.

Definition at line 343 of file scipParaInitiator.h.

References ScipParaInitiator::scip.

◆ makeRootNodeDiffSubproblem()

UG::BbParaDiffSubproblem * makeRootNodeDiffSubproblem ( )
virtual

make DiffSubproblem object for root node

Implements BbParaInitiator.

Definition at line 183 of file scipParaInitiator.h.

Referenced by main().

◆ onlyLinearConsHandler()

bool onlyLinearConsHandler ( )
protected

◆ outputFinalSolverStatistics()

◆ outputProblemInfo()

void outputProblemInfo ( int *  nNonLinearConsHdlrs)
protected

◆ printSolverVersion()

void printSolverVersion ( std::ostream *  os)
virtual

print solver version output file (or NULL for standard output)

print solver version

Parameters
osoutput file (or NULL for standard output)

Implements ParaInitiator.

Definition at line 2220 of file scipParaInitiator.cpp.

References ScipParaInitiator::scip.

Referenced by ScipParaInitiator::init().

◆ readSolutionFromCheckpointFile()

double readSolutionFromCheckpointFile ( char *  afterCheckpointingSolutionFileName)
virtual

read solution from checkpoint file

check if after checkpoing solution file exists or not

set up from after checkpointing solution file

Implements ParaInitiator.

Definition at line 1997 of file scipParaInitiator.cpp.

References ParaSolution::clone(), ParaComm::createParaSolution(), ScipParaSolution::getObjectiveFunctionValue(), ParaInitiator::paraComm, ParaInitiator::prefixWarm, ScipParaSolution::read(), ScipParaInitiator::solution, and ScipParaInitiator::tryToSetIncumbentSolution().

◆ reInit()

◆ sendSolverInitializationMessage()

◆ setDualBound()

void setDualBound ( double  bound)
virtual

set final dual bound

Implements BbParaInitiator.

Definition at line 2291 of file scipParaInitiator.cpp.

References ScipParaInitiator::finalDualBound.

◆ setFinalSolverStatus()

void setFinalSolverStatus ( UG::FinalSolverState  status)
virtual

set final solver status

Implements BbParaInitiator.

Definition at line 2273 of file scipParaInitiator.cpp.

References ScipParaInitiator::finalState.

Referenced by ScipParaInitiator::init(), and ScipParaInitiator::reInit().

◆ setInitialStatOnDiffSubproblem()

void setInitialStatOnDiffSubproblem ( int  minDepth,
int  maxDepth,
UG::BbParaDiffSubproblem diffSubproblem 
)
virtual

◆ setNumberOfNodesSolved()

void setNumberOfNodesSolved ( long long  n)
virtual

set number of nodes solved

Implements BbParaInitiator.

Definition at line 2282 of file scipParaInitiator.cpp.

References ScipParaInitiator::nSolved.

◆ setUserPlugins()

void setUserPlugins ( ScipUserPlugins inUi)

set user plugins

Definition at line 2511 of file scipParaInitiator.cpp.

References ScipParaInitiator::userPlugins.

Referenced by setUserPlugins().

◆ tryToSetIncumbentSolution()

◆ writeCheckpointSolution()

void writeCheckpointSolution ( const std::string &  filename)
virtual

write checkpoint solution

empty solution file is necessary, because it is removed next at the next checkpoint

Implements ParaInitiator.

Definition at line 1978 of file scipParaInitiator.cpp.

References ScipParaInitiator::solution, and ScipParaSolution::write().

◆ writeParaInstance()

void writeParaInstance ( const std::string &  filename)
virtual

◆ writeSolution()

◆ writeSolverParameters()

void writeSolverParameters ( std::ostream *  os)
virtual

Member Data Documentation

◆ absgap

double absgap
protected

Definition at line 86 of file scipParaInitiator.h.

Referenced by ScipParaInitiator::getAbsgapValue().

◆ finalDualBound

◆ finalState

◆ gap

double gap
protected

Definition at line 87 of file scipParaInitiator.h.

Referenced by ScipParaInitiator::getGapValue().

◆ generatedIsolname

char* generatedIsolname
protected

◆ instance

◆ isolname

char* isolname
protected

Definition at line 79 of file scipParaInitiator.h.

Referenced by ScipParaInitiator::init(), and ScipParaInitiator::reInit().

◆ logfile

FILE* logfile
protected

◆ logname

char* logname
protected

Definition at line 78 of file scipParaInitiator.h.

Referenced by ScipParaInitiator::init().

◆ messagehdlr

SCIP_MESSAGEHDLR* messagehdlr
protected

◆ nSolved

long long nSolved
protected

◆ objlimit

double objlimit
protected

◆ paraParams

◆ probname

char* probname
protected

Definition at line 73 of file scipParaInitiator.h.

Referenced by ScipParaInitiator::init(), and ScipParaInitiator::reInit().

◆ qsol

bool qsol
protected

◆ racingSettingsName

char* racingSettingsName
protected

◆ scip

◆ scipDiffParamSet

◆ scipDiffParamSetRoot

◆ settingsName

char* settingsName
protected

Definition at line 76 of file scipParaInitiator.h.

Referenced by ScipParaInitiator::init().

◆ settingsNameLC

char* settingsNameLC
protected

◆ settingsNameRoot

char* settingsNameRoot
protected

Definition at line 75 of file scipParaInitiator.h.

Referenced by ScipParaInitiator::init().

◆ solution

◆ solutionFile

◆ solutionFileName

char* solutionFileName
protected

◆ transSolutionFile

◆ userPlugins