java.lang.Object
es.urjc.etsii.grafo.algorithms.Algorithm<S,I>
es.urjc.etsii.grafo.algorithms.SimpleAlgorithm<S,I>
- Type Parameters:
S- Solution classI- Instance class
Example simple algorithm, executes:
Constructive → (Optional, if present) Local Searches → (Optional, if present) Shake → If did not improve end
^_________________________________________| else repeat
This class can be used to test all the pieces if they are working properly, or as a base for more complex algorithms
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSimpleAlgorithm(String algorithmName, Constructive<S, I> constructive) Constructor for SimpleAlgorithm.SimpleAlgorithm(String algorithmName, Constructive<S, I> constructive, Improver<S, I> improver) Constructor for SimpleAlgorithm. -
Method Summary
Modifier and TypeMethodDescriptionRuns the algorithmprotected Sconstructive(I instance) Construct a solution first by calling the correct Java constructor and then initialize it using the provided constructive method.protected SlocalSearch(S solution) localSearch.protected voidprintStatus(String phase, S solution) printStatus.toString()Methods inherited from class Algorithm
getBuilder, getName, newSolution, setBuilder, setName
-
Field Details
-
constructive
-
improver
-
-
Constructor Details
-
SimpleAlgorithm
Constructor for SimpleAlgorithm.
- Parameters:
constructive- aConstructiveobject.
-
SimpleAlgorithm
@AutoconfigConstructor public SimpleAlgorithm(@ProvidedParam String algorithmName, Constructive<S, I> constructive, Improver<S, I> improver) Constructor for SimpleAlgorithm.
- Parameters:
algorithmName- Algorithm name, uniquely identifies the current algorithm. Tip: If you dont care about the name, generate a random one usingStringUtil.randomAlgorithmName()constructive- aConstructiveobject.improver- aImproverobject.
-
-
Method Details
-
algorithm
-
constructive
-
localSearch
-
printStatus
-
toString
-