Class AbstractNearbyDistanceMatrixDemand<Origin_,Destination_,ChildSelector_,ReplayingSelector_>
- java.lang.Object
-
- ai.timefold.solver.core.impl.heuristic.selector.common.nearby.AbstractNearbyDistanceMatrixDemand<Origin_,Destination_,ChildSelector_,ReplayingSelector_>
-
- Type Parameters:
Origin_- planning entitiesDestination_- planning entities XOR planning valuesChildSelector_-ReplayingSelector_-
- All Implemented Interfaces:
Demand<NearbyDistanceMatrix<Origin_,Destination_>>
public abstract class AbstractNearbyDistanceMatrixDemand<Origin_,Destination_,ChildSelector_,ReplayingSelector_> extends Object implements Demand<NearbyDistanceMatrix<Origin_,Destination_>>
CalculatingNearbyDistanceMatrixis very expensive, therefore we want to reuse it as much as possible.In cases where the demand represents the same nearby selector (as defined by
equals(Object)) theSupplyManagerensures that the same supply instance is returned with the pre-computedNearbyDistanceMatrix.
-
-
Field Summary
Fields Modifier and Type Field Description protected ChildSelector_childSelectorprotected NearbyDistanceMeter<Origin_,Destination_>meterprotected NearbyRandomrandomprotected ReplayingSelector_replayingSelector
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractNearbyDistanceMatrixDemand(NearbyDistanceMeter<Origin_,Destination_> meter, NearbyRandom random, ChildSelector_ childSelector, ReplayingSelector_ replayingSelector)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description NearbyDistanceMatrix<Origin_,Destination_>createExternalizedSupply(SupplyManager supplyManager)Only called if the domain model doesn't already support the demand (through a shadow variable usually).booleanequals(Object o)Two instances of this class are considered equal if and only if: Their meter instances are equal. Their nearby randoms represent the same distribution. Their child selectors are equal. Their replaying origin entity selectors are equal. Otherwise as defined byObject.equals(Object).inthashCode()protected abstract NearbyDistanceMatrix<Origin_,Destination_>supplyNearbyDistanceMatrix()
-
-
-
Field Detail
-
meter
protected final NearbyDistanceMeter<Origin_,Destination_> meter
-
random
protected final NearbyRandom random
-
childSelector
protected final ChildSelector_ childSelector
-
replayingSelector
protected final ReplayingSelector_ replayingSelector
-
-
Constructor Detail
-
AbstractNearbyDistanceMatrixDemand
protected AbstractNearbyDistanceMatrixDemand(NearbyDistanceMeter<Origin_,Destination_> meter, NearbyRandom random, ChildSelector_ childSelector, ReplayingSelector_ replayingSelector)
-
-
Method Detail
-
createExternalizedSupply
public final NearbyDistanceMatrix<Origin_,Destination_> createExternalizedSupply(SupplyManager supplyManager)
Description copied from interface:DemandOnly called if the domain model doesn't already support the demand (through a shadow variable usually). Equal demands share the sameSupply.- Specified by:
createExternalizedSupplyin interfaceDemand<Origin_>- Parameters:
supplyManager- never null- Returns:
- never null
-
supplyNearbyDistanceMatrix
protected abstract NearbyDistanceMatrix<Origin_,Destination_> supplyNearbyDistanceMatrix()
-
equals
public final boolean equals(Object o)
Two instances of this class are considered equal if and only if:- Their meter instances are equal.
- Their nearby randoms represent the same distribution.
- Their child selectors are equal.
- Their replaying origin entity selectors are equal.
Object.equals(Object).- Overrides:
equalsin classObject- See Also:
for how we ensure equality for meter instances in particular and selectors in general.
-
-