Class AbstractNearbyDistanceMatrixDemand<Origin_,Destination_,ChildSelector_,ReplayingSelector_>
java.lang.Object
org.optaplanner.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_>>
Calculating
NearbyDistanceMatrix
is 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)
)
the SupplyManager
ensures that the same supply instance is returned
with the pre-computed NearbyDistanceMatrix
.
-
Field Summary
Modifier and TypeFieldDescriptionprotected final ChildSelector_
protected final NearbyDistanceMeter<Origin_,
Destination_> protected final NearbyRandom
protected final ReplayingSelector_
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractNearbyDistanceMatrixDemand
(NearbyDistanceMeter<Origin_, Destination_> meter, NearbyRandom random, ChildSelector_ childSelector, ReplayingSelector_ replayingSelector) -
Method Summary
Modifier and TypeMethodDescriptioncreateExternalizedSupply
(SupplyManager supplyManager) Only called if the domain model doesn't already support the demand (through a shadow variable usually).final boolean
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)
.final int
hashCode()
protected abstract NearbyDistanceMatrix<Origin_,
Destination_>
-
Field Details
-
meter
-
random
-
childSelector
-
replayingSelector
-
-
Constructor Details
-
AbstractNearbyDistanceMatrixDemand
protected AbstractNearbyDistanceMatrixDemand(NearbyDistanceMeter<Origin_, Destination_> meter, NearbyRandom random, ChildSelector_ childSelector, ReplayingSelector_ replayingSelector)
-
-
Method Details
-
createExternalizedSupply
public final NearbyDistanceMatrix<Origin_,Destination_> createExternalizedSupply(SupplyManager supplyManager) Description copied from interface:Demand
Only called if the domain model doesn't already support the demand (through a shadow variable usually). Equal demands share the sameSupply
.- Specified by:
createExternalizedSupply
in interfaceDemand<Origin_>
- Parameters:
supplyManager
- never null- Returns:
- never null
-
supplyNearbyDistanceMatrix
-
equals
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)
. -
hashCode
public final int hashCode()
-