Package es.urjc.etsii.grafo.solution
Class Solution<SELF extends Solution<SELF,I>,I extends Instance>
java.lang.Object
es.urjc.etsii.grafo.solution.Solution<SELF,I>
- Direct Known Subclasses:
__RNAME__Solution
,ACSolution
,TestSolution
,TSPSolution
Abstract Solution class.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected long
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract SELF
Clone the current solution.Define custom properties for the solutiongetInstance.long
When was the last time the current solution was modified.long
Get current solution version.Returns ordered list of oldest to recent moves Note: If assertions are disabled, always returns an empty listGenerate a string representation of the chain of moves used to reach the current solution state.void
notifyUpdate.void
notifyUpdate
(long when) notifyUpdate.abstract String
toString()
Resume this solution Generate a toString method using your IDE
-
Field Details
-
lastMoves
-
lastModifiedTime
protected long lastModifiedTime
-
-
Constructor Details
-
Solution
Create a solution for a given instance- Parameters:
ins
- Instance
-
Solution
Constructor for Solution.
- Parameters:
s
- aSolution
object.
-
-
Method Details
-
notifyUpdate
public void notifyUpdate()notifyUpdate.
-
notifyUpdate
public void notifyUpdate(long when) notifyUpdate.
-
lastExecutesMoves
Returns ordered list of oldest to recent moves Note: If assertions are disabled, always returns an empty list- Returns:
- ordered list of oldest to recent moves
-
lastExecutesMovesAsString
Generate a string representation of the chain of moves used to reach the current solution state.- Returns:
- string representation, each move is separated by a new line
-
cloneSolution
Clone the current solution. Deep clone mutable data or you will regret it.- Returns:
- A deep clone of the current solution
-
toString
Resume this solution Generate a toString method using your IDE -
getInstance
getInstance.
- Returns:
- a I object.
-
getLastModifiedTime
public long getLastModifiedTime()When was the last time the current solution was modified. Has no meaning when used independently, must be used along a reference time (for example, to calculate the TTB, substracting the time at which the current solution was built)- Returns:
- reference time, in nano seconds.
-
getVersion
public long getVersion()Get current solution version. This is an internal ID kept by the framework, which tracks how many times the current solution has been modified. While it currently equals the number of moves that has been applied to the current solution, such behaviour can change in future framework versions and should not be relied on.- Returns:
- current solution version.
-
customProperties
Define custom properties for the solution- Returns:
- Map of properties, where the key is the property name and the value is how to calculate the property value
-