java.lang.Object
es.urjc.etsii.grafo.algorithms.vns.VNSBuilder<S,I>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the VNS algorithm with the configured parameters.Builds the VNS algorithm with the configured parameters.VNSBuilder<S, I> withConstructive(Constructive<S, I> constructive) Creates a new VNSBuilder instance.VNSBuilder<S, I> Optimize default objective function, which is the main objective declared in the current Context.VNSBuilder<S, I> withImprover(Improver<S, I> improver) Configures the improvement procedureVNSBuilder<S, I> withNeighChange(int maxK) Configures the neighborhood change strategy with a maximum K value.VNSBuilder<S, I> withNeighChange(int maxK, int increment) Configures the neighborhood change strategy with a maximum K value and a one-by-one increment.VNSBuilder<S, I> withNeighChange(VNSNeighChange<S, I> neighChange) Configures the neighborhood change strategy.VNSBuilder<S, I> withObjective(Objective<?, S, I> objective) Configures the objective function to optimize.VNSBuilder<S, I> Configures the shake procedure.
-
Field Details
-
objective
-
-
Constructor Details
-
VNSBuilder
public VNSBuilder()
-
-
Method Details
-
withConstructive
Creates a new VNSBuilder instance.- Parameters:
constructive- Constructive procedure to use when generating initial solutions.- Returns:
- This builder instance for method chaining
-
withImprover
-
withShake
-
withDefaultObjective
Optimize default objective function, which is the main objective declared in the current Context. Note that calling this method is optional, if the objective is not set it will default to the main objective.- Returns:
- This builder instance for method chaining
-
withObjective
-
withNeighChange
Configures the neighborhood change strategy. Provide a custom implementation of VNSNeighChange to define how the k value should change. And when the VNS should stop.- Parameters:
neighChange- Custom neighborhood change strategy. This should implement the VNSNeighChange interface, or be a lambada function that takes a solution and an integer k, and returns an integer k value (the updated k value). Example: withNeighChange((solution, k) -> k+1); // note that in this example k will keep increasing forever if the solution does not improve- Returns:
- This builder instance for method chaining
-
withNeighChange
Configures the neighborhood change strategy with a maximum K value. Increment defaults to 1.- Parameters:
maxK- Maximum K value for the neighborhood change. When k reaches this value, the VNS will stop.- Returns:
- This builder instance for method chaining
-
withNeighChange
Configures the neighborhood change strategy with a maximum K value and a one-by-one increment.- Parameters:
maxK- Maximum K value for the neighborhood change. When k reaches this value, the VNS will stop.increment- Increment to apply to K when the solution does not improve- Returns:
- This builder instance for method chaining
-
build
-
build
-