Class Executor<S extends Solution<S,I>,I extends Instance>

java.lang.Object
es.urjc.etsii.grafo.executors.Executor<S,I>
Type Parameters:
S - Solution class
I - Instance class
Direct Known Subclasses:
ConcurrentExecutor, SequentialExecutor

public abstract class Executor<S extends Solution<S,I>,I extends Instance> extends Object
Processes work units
  • Field Details

  • Constructor Details

  • Method Details

    • endTimeControl

      public static <S extends Solution<S, I>, I extends Instance> void endTimeControl(Optional<TimeLimitCalculator<S,I>> timeLimitCalculator, WorkUnit<S,I> workUnit)
      If time control is enabled, remove it and check ellapsed time to see if too many time has been spent
      Type Parameters:
      S - Solution class
      I - Instance class
      Parameters:
      timeLimitCalculator - time limit calculator if implemented
      workUnit - current work unit
    • executeExperiment

      public abstract void executeExperiment(Experiment<S,I> experiment, List<String> instanceNames, long startTimestamp)
    • startup

      public abstract void startup()
      Allocate resources and prepare for execution
    • shutdown

      public abstract void shutdown()
      Finalize and destroy all resources, we have finished and are shutting down now.
    • doWork

      protected WorkUnitResult<S,I> doWork(WorkUnit<S,I> workUnit)
      Execute a single iteration for the given (experiment, instance, algorithm, iterationId)
      Parameters:
      workUnit - Minimum unit of work, cannot be divided further.
    • processWorkUnitResult

      protected void processWorkUnitResult(WorkUnitResult<S,I> r, me.tongfei.progressbar.ProgressBar pb)
    • exportAlgorithmInstanceSolution

      protected void exportAlgorithmInstanceSolution(WorkUnitResult<S,I> r)
    • exportInstanceSolution

      protected void exportInstanceSolution(WorkUnitResult<S,I> r)
    • getOrderedWorkUnits

      protected Map<String,Map<Algorithm<S,I>,List<WorkUnit<S,I>>>> getOrderedWorkUnits(Experiment<S,I> experiment, List<String> instancePaths, int repetitions)
      Create workunits with solve order
      Parameters:
      experiment - experiment definition
      instancePaths - instance name list
      repetitions - how many times should we repeat the (instance, algorithm) pair
      Returns:
      Map of workunits per instance
    • improves

      protected boolean improves(WorkUnitResult<S,I> candidate, WorkUnitResult<S,I> best)
    • instanceName

      public String instanceName(String instancePath)
    • getPBarBuilder

      public static me.tongfei.progressbar.ProgressBarBuilder getPBarBuilder(String taskname)
    • getGlobalSolvingProgressBar

      public me.tongfei.progressbar.ProgressBar getGlobalSolvingProgressBar(String expName, Map<String,Map<Algorithm<S,I>,List<WorkUnit<S,I>>>> workUnits)