Package es.urjc.etsii.grafo.io
Class InstanceManager<I extends Instance>
java.lang.Object
es.urjc.etsii.grafo.io.InstanceManager<I>
- Type Parameters:
I
- Instance class
Class to manage instances during the solving lifecycle
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Map
<String, SoftReference<I>> protected final SoftReference
<I> static final String
protected final InstanceConfiguration
protected final InstanceImporter
<I> -
Constructor Summary
ConstructorsConstructorDescriptionInstanceManager
(InstanceConfiguration instanceConfiguration, InstanceImporter<I> instanceImporter) Build instance manager -
Method Summary
Modifier and TypeMethodDescriptiongetInstance
(String path) Returns an instance given a pathgetInstanceSolveOrder
(String expName) getInstanceSolveOrder
(String expName, boolean preload) Get which instances have to be solved for a given experimentprotected I
loadInstance
(String path) void
Purge instance cacheprotected void
validateAndSort
(String expName, List<String> instancePaths)
-
Field Details
-
INDEX_SUFFIX
- See Also:
-
EMPTY
-
instanceConfiguration
-
instanceImporter
-
cacheByPath
-
solveOrderByExperiment
-
-
Constructor Details
-
InstanceManager
public InstanceManager(InstanceConfiguration instanceConfiguration, InstanceImporter<I> instanceImporter) Build instance manager- Parameters:
instanceConfiguration
- instance configurationinstanceImporter
- instance importer
-
-
Method Details
-
getInstanceSolveOrder
-
getInstanceSolveOrder
Get which instances have to be solved for a given experiment- Parameters:
expName
- experiment name as stringpreload
- if true load instances to use comparator to sort them, if false uses lexicograph sort by path name- Returns:
- Ordered list of instance identifiers, that can be later used by the getInstance method. Instances should be solved in the returned order.
-
validateAndSort
-
lexicSort
-
validate
-
getInstance
Returns an instance given a path- Parameters:
path
- Path of instance to load- Returns:
- Loaded instance
-
loadInstance
-
purgeCache
public void purgeCache()Purge instance cache -
getUserImporterImplementation
-