Class Instance
java.lang.Object
es.urjc.etsii.grafo.io.Instance
- All Implemented Interfaces:
Comparable<Instance>
- Direct Known Subclasses:
__RNAME__Instance, ACInstance, BMSSCInstance, FLPInstance, MSTInstance, TestInstance, TSPInstance, TSPTWInstance, VRPODInstance
Base instance class. All instance subclasses must be immutable after construction
Order defaults to instance name, can be changed by user
(for example, to order by instance size or any other instance property)
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintSort order will determine in which order the instances will be solved Sort defaults to instance nameDefine custom properties for the instancebooleangetId()Returns the logical instance id or name.getPath()Get instance load path.getProperty(String key) Get custom instance property.getPropertyOrDefault(String key, Object defaultValue) Get custom instance property.Get all property keys used so far for all instancesinthashCode()static voidDestroy global memorized property namesprotected voidSet instance load path, used by the framework.voidsetProperty(String key, Object property) Set custom instance property.toString()
-
Field Details
-
LOAD_TIME_NANOS
- See Also:
-
-
Constructor Details
-
Instance
Creates a new instance- Parameters:
id- logical instance id or name. This value is used in results, logs and reference lookups.
-
-
Method Details
-
compareTo
Sort order will determine in which order the instances will be solved Sort defaults to instance name- Specified by:
compareToin interfaceComparable<Instance>
-
getId
-
setPath
Set instance load path, used by the framework.- Parameters:
path- path or compressed load token where it was loaded from. It may be relative.
-
getPath
Get instance load path.- Returns:
- path or compressed load path where it was first loaded from. It may be relative.
-
getProperty
Get custom instance property. For instance, if instance is a graph: number of nodes, number of edges, etc. Properties in this map will be used by the framework to provide additional context in some operations, for example when serializing results.- Parameters:
key- Property name. Must be the same for all instances- Returns:
- Value if property name exists
- Throws:
IllegalArgumentException- if key/property name is not defined for the current instance
-
getPropertyOrDefault
Get custom instance property. For instance, if instance is a graph: number of nodes, number of edges, etc. Properties in this map will be used by the framework to provide additional context in some operations, for example when serializing results.- Parameters:
key- Property name. Must be the same for all instancesdefaultValue- Value to return if key does not exist- Returns:
- Value if property name exists, default value if not
-
setProperty
-
getUniquePropertiesKeys
-
resetProperties
public static void resetProperties()Destroy global memorized property names -
equals
-
hashCode
-
toString
-
customProperties
-