Class NearbyDistanceMatrixDemand<Solution_,Origin_,Destination_>
java.lang.Object
org.optaplanner.core.impl.heuristic.selector.common.nearby.NearbyDistanceMatrixDemand<Solution_,Origin_,Destination_>
- Type Parameters:
Solution_
-Origin_
-Destination_
-
- All Implemented Interfaces:
Demand<MemoizingSupply<NearbyDistanceMatrix<Origin_,
Destination_>>>
public final class NearbyDistanceMatrixDemand<Solution_,Origin_,Destination_>
extends Object
implements Demand<MemoizingSupply<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
.
-
Constructor Summary
ConstructorDescriptionNearbyDistanceMatrixDemand
(NearbyDistanceMeter<Origin_, Destination_> meter, Selector<Solution_> childSelector, EntitySelector<Solution_> replayingOriginEntitySelector, ToIntFunction<Origin_> destinationSizeFunction) -
Method Summary
Modifier and TypeMethodDescriptioncreateExternalizedSupply
(SupplyManager supplyManager) Only called if the domain model doesn't already support the demand (through a shadow variable usually).boolean
Two instances of this class are consider equal if and only if: Their meter instances are equal. Their child selectors are equal. Their replaying origin entity selectors are equal. Otherwise as defined byObject.equals(Object)
.int
hashCode()
-
Constructor Details
-
NearbyDistanceMatrixDemand
public NearbyDistanceMatrixDemand(NearbyDistanceMeter<Origin_, Destination_> meter, Selector<Solution_> childSelector, EntitySelector<Solution_> replayingOriginEntitySelector, ToIntFunction<Origin_> destinationSizeFunction)
-
-
Method Details
-
createExternalizedSupply
public MemoizingSupply<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<Solution_>
- Parameters:
supplyManager
- never null- Returns:
- never null
-
equals
Two instances of this class are consider equal if and only if:- Their meter instances are equal.
- Their child selectors are equal.
- Their replaying origin entity selectors are equal.
Object.equals(Object)
. -
hashCode
public int hashCode()
-