Class ScatterSearch<S extends Solution<S,I>,I extends Instance>

java.lang.Object
es.urjc.etsii.grafo.algorithms.Algorithm<S,I>
es.urjc.etsii.grafo.algorithms.scattersearch.ScatterSearch<S,I>

public class ScatterSearch<S extends Solution<S,I>,I extends Instance> extends Algorithm<S,I>
  • Constructor Details

    • ScatterSearch

      @AutoconfigConstructor public ScatterSearch(@ProvidedParam String name, @RealParam(min=1.0,max=10.0) double initialRatio, @IntegerParam(min=10,max=30) int refsetSize, Constructive<S,I> constructiveGoodValues, Constructive<S,I> constructiveGoodDiversity, Improver<S,I> improver, SolutionCombinator<S,I> combinator, @ProvidedParam Objective<?,S,I> objective, @IntegerParam(min=1) int maxIterations, @RealParam(min=0.0,max=1.0) double diversityRatio, SolutionDistance<S,I> solutionDistance, @CategoricalParam(strings={"true","false"}) boolean softRestartEnabled)
      Parameters:
      initialRatio - During refset initialization, create initialRefset size * INITIAL_RATIO solutions, to ensure we have enough non repeated and diverse solutions
      refsetSize - Number of solutions to keep in refset
      constructiveGoodValues - Method used to generate the initial refset
      constructiveGoodDiversity - Method used to generate diverse solutions
      improver - Method to improve any given solution, such as a local search
      combinator - Creates a solution as a combination of two different solutions
      diversityRatio - Porcentage of diverse solution to use relaive to the refset size. 0 means use only best value criteria, 1 use only diversity criteria, 0.5 half the refset uses diversity criteria, the other half best value criteria.
      solutionDistance - How to calculate distance between a given set of solutions. See SolutionDistance for more details.
  • Method Details

    • initializeRefset

      protected RefSet<S,I> initializeRefset(Class<?> clazz, I instance)
    • forceFill

      protected void forceFill(I instance, Set<S> alreadyUsed, S[] initialRefsetArray, int offset, int assignedSolutions, int nRequiredSolutions, int nInitialSolutions)
    • softRestart

      protected RefSet<S,I> softRestart(Class<?> clazz, I instance, RefSet<S,I> current)
    • replaceWorstNearest

      protected void replaceWorstNearest(RefSet<S,I> refset, S solution)
      Try to insert the given solution in the refset. If the solution is better than all in refset it is always inserted. if it is better than some, replace the nearest solution to given solution, and keep refset sorted If the solution is worse than all in refset, the refset remains unchanged
      Parameters:
      refset - Reference Set
      solution - Solution to try to insert in refset
    • algorithm

      public S algorithm(I instance)
      Description copied from class: Algorithm
      Runs the algorithm
      Specified by:
      algorithm in class Algorithm<S extends Solution<S,I>,I extends Instance>
      Parameters:
      instance - Instance to solve
      Returns:
      Built solution
    • debugStatus

      protected void debugStatus(int iterations, RefSet<S,I> refsets, Set<S> newSet, Set<S> insertedSolutions)
    • minDistanceToSolList

      protected double minDistanceToSolList(S referenceSolution, S[] initialDiverseSolutions)
    • initializeSolutions

      protected List<S> initializeSolutions(I instance, int size, boolean diverse)
    • initializeSolution

      protected S initializeSolution(I instance, boolean diverse)
    • mergeToSetByScore

      protected Set<S> mergeToSetByScore(RefSet<S,I> refset, Set<S> newSolutions)
    • toString

      public String toString()
      Overrides:
      toString in class Algorithm<S extends Solution<S,I>,I extends Instance>