Class InstanceManager<I extends Instance>

java.lang.Object
es.urjc.etsii.grafo.io.InstanceManager<I>
Type Parameters:
I - Instance class

@Service public class InstanceManager<I extends Instance> extends Object
Class to manage instances during the solving lifecycle
  • Field Details

  • Constructor Details

    • InstanceManager

      @Autowired public InstanceManager(InstanceConfiguration instanceConfiguration, SolverConfig solverConfig, InstanceImporter<I> instanceImporter)
      Build instance manager
      Parameters:
      instanceConfiguration - instance configuration
      solverConfig - solver configuration
      instanceImporter - instance importer
  • Method Details

    • getInstanceSolveOrder

      public List<String> getInstanceSolveOrder(String expName)
    • getInstanceSolveOrder

      public List<String> getInstanceSolveOrder(String expName, boolean preload)
      Get which instances have to be solved for a given experiment
      Parameters:
      expName - experiment name as string
      preload - if true load instances to use comparator to sort them, if false uses lexicograph sort by path name
      Returns:
      Ordered list of instance load paths, that can be later used by the getInstance method. Instances should be solved in the returned order.
    • validateAndSort

      protected List<String> validateAndSort(String expName, List<String> instancePaths)
    • getWarmupInstancePath

      public String getWarmupInstancePath(String expName, List<String> instancePaths)
      Select the instance path that should be used for JVM warm-up.
      Parameters:
      expName - experiment name
      instancePaths - solve order load paths for the experiment
      Returns:
      warm-up instance load paths
    • lexicSort

      protected List<String> lexicSort(List<String> instancePaths)
    • requireConfiguredInstancePath

      public String requireConfiguredInstancePath(String expName, String requestedPath)
      Verify that a user supplied load path belongs to the configured instance source for an experiment. This is intended for external callbacks, where the path is supplied by a client instead of being produced by getInstanceSolveOrder(String).
      Parameters:
      expName - experiment name
      requestedPath - user supplied instance load path
      Returns:
      the canonical configured load path that should be used for loading
    • validate

      protected void validate(List<I> instances, String expName)
    • getInstance

      public I getInstance(String path)
      Returns an instance given a load path.
      Parameters:
      path - path or compressed load path of the instance to load
      Returns:
      Loaded instance
    • loadInstance

      protected I loadInstance(String path)
    • purgeCache

      public void purgeCache()
      Purge instance cache
    • getUserImporterImplementation

      public InstanceImporter<I> getUserImporterImplementation()