Class CMSAConstructive<S extends Solution<S,I>, I extends Instance, C>

java.lang.Object
es.urjc.etsii.grafo.create.Constructive<S,I>
es.urjc.etsii.grafo.algorithms.cmsa.CMSAConstructive<S,I,C>
Type Parameters:
S - Solution class
I - Instance class
C - Solution component class
Direct Known Subclasses:
MVCConstructive

public abstract class CMSAConstructive<S extends Solution<S,I>, I extends Instance, C> extends Constructive<S,I>
Constructive method used by CMSA to probabilistically build complete solutions. Solutions built by this method are only used to sample which solution components (edges, assignments, items, etc.) look promising: they are never returned as the algorithm result directly.

Besides building a solution as any other Constructive, implementations must be able to identify which solution components were used to build a given solution, so CMSA can add them to the restricted sub-instance solved at every iteration, and track their age.

Solution components can be represented using any type that correctly implements equals and hashCode, for example a record such as record Edge(int from, int to), or an autoboxed primitive such as Integer when components are simply indexes.

  • Constructor Details

    • CMSAConstructive

      public CMSAConstructive()
  • Method Details

    • usedComponents

      public abstract Set<C> usedComponents(S solution)
      Returns the solution components used to build the given solution. This method is usually called immediately after Constructive.construct(Solution), but implementations should not assume this and must be able to work with any feasible solution to the problem, as it is also used to identify which components are part of the solution returned by the CMSASolver.
      Parameters:
      solution - a feasible solution to the problem
      Returns:
      the set of solution components used in the given solution