Class DefaultMoveStreamFactory<Solution_>
- All Implemented Interfaces:
MoveStreamFactory<Solution_>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordstatic final record -
Constructor Summary
ConstructorsConstructorDescriptionDefaultMoveStreamFactory(SolutionDescriptor<Solution_> solutionDescriptor, EnvironmentMode environmentMode) -
Method Summary
Modifier and TypeMethodDescriptioncreateSession(SessionContext<Solution_> context) <A> UniEnumeratingStream<Solution_,A> Start aEnumeratingStreamof all instances of the sourceClass that are known asproblem factsorplanning entities.<Entity_,Value_>
UniEnumeratingStream<Solution_,ElementPosition> forEachAssignablePosition(PlanningListVariableMetaModel<Solution_, Entity_, Value_> variableMetaModel) Enumerate all possible positions of a list variable to which a value can be assigned.<Entity_,Value_>
UniEnumeratingStream<Solution_,Value_> forEachAssignedValue(PlanningListVariableMetaModel<Solution_, Entity_, Value_> variableMetaModel) Enumerate all values assigned to any entity'sPlanningListVariable.<Entity_,Value_>
UniEnumeratingStream<Solution_,Value_> forEachAssignedValueUnfiltered(PlanningListVariableMetaModel<Solution_, Entity_, Value_> variableMetaModel) Enumerate all values assigned to any entity'sPlanningListVariable.<Entity_,Value_>
UniEnumeratingStream<Solution_,PositionInList> forEachDestination(PlanningListVariableMetaModel<Solution_, Entity_, Value_> variableMetaModel) Enumerate all possible positions of a list variable to which a value can be assigned.<Entity_,Value_>
UniEnumeratingStream<Solution_,ElementPosition> forEachDestinationIncludingUnassigned(PlanningListVariableMetaModel<Solution_, Entity_, Value_> variableMetaModel) As defined byMoveStreamFactory.forEachDestination(PlanningListVariableMetaModel), but also includes a singleUnassignedElementposition if the list variable allows unassigned values.<A> UniEnumeratingStream<Solution_,A> forEachUnfiltered(Class<A> sourceClass, boolean includeNull) Start aEnumeratingStreamof all instances of the sourceClass that are known asproblem factsorplanning entities.<Entity_,Value_>
DefaultMoveStreamFactory.ListVariableNodeSharingSupportFunctions<Solution_,Entity_, Value_> getNodeSharingSupportFunctions(PlanningListVariableMetaModel<Solution_, Entity_, Value_> variableMetaModel) <Entity_,Value_>
DefaultMoveStreamFactory.NodeSharingSupportFunctions<Solution_,Entity_, Value_> getNodeSharingSupportFunctions(PlanningVariableMetaModel<Solution_, Entity_, Value_> variableMetaModel) <A> UniSamplingStream<Solution_,A> pick(UniEnumeratingStream<Solution_, A> enumeratingStream)
-
Constructor Details
-
DefaultMoveStreamFactory
public DefaultMoveStreamFactory(SolutionDescriptor<Solution_> solutionDescriptor, EnvironmentMode environmentMode)
-
-
Method Details
-
createSession
-
forEach
Description copied from interface:MoveStreamFactoryStart aEnumeratingStreamof all instances of the sourceClass that are known asproblem factsorplanning entities.If the sourceClass is a
PlanningEntity, then it is automaticallyfilteredto only contain entities which are not pinned.If the sourceClass is a shadow entity (an entity without any genuine planning variables), and if there exists a genuine
PlanningEntitywith aPlanningListVariablewhich accepts instances of this shadow entity as values in that list, then this stream will filter out all sourceClass instances which are pinned in that list.This stream returns genuine entities regardless of whether they have any null genuine planning variables. This stream returns shadow entities regardless of whether they are assigned to any genuine entity. They can easily be
filtered out.- Specified by:
forEachin interfaceMoveStreamFactory<Solution_>- Parameters:
sourceClass- the class of the instances to enumerateincludeNull- if true, the stream will include a single null element- Returns:
- A stream containing a tuple for each of the entities as described above.
- See Also:
-
forEachUnfiltered
public <A> UniEnumeratingStream<Solution_,A> forEachUnfiltered(Class<A> sourceClass, boolean includeNull) Description copied from interface:MoveStreamFactoryStart aEnumeratingStreamof all instances of the sourceClass that are known asproblem factsorplanning entities. If the sourceClass is a genuine or shadow entity, it returns instances regardless of their pinning status. Otherwise as defined byMoveStreamFactory.forEach(Class, boolean).- Specified by:
forEachUnfilteredin interfaceMoveStreamFactory<Solution_>
-
getNodeSharingSupportFunctions
public <Entity_,Value_> DefaultMoveStreamFactory.NodeSharingSupportFunctions<Solution_,Entity_, getNodeSharingSupportFunctionsValue_> (PlanningVariableMetaModel<Solution_, Entity_, Value_> variableMetaModel) -
forEachAssignedValueUnfiltered
public <Entity_,Value_> UniEnumeratingStream<Solution_,Value_> forEachAssignedValueUnfiltered(PlanningListVariableMetaModel<Solution_, Entity_, Value_> variableMetaModel) Description copied from interface:MoveStreamFactoryEnumerate all values assigned to any entity'sPlanningListVariable. UnlikeMoveStreamFactory.forEachAssignedValue(PlanningListVariableMetaModel), this will include pinned values. You can useSolutionView.getPositionOf(PlanningListVariableMetaModel, Object)later downstream to get the position of the value in an entity's list variable, if needed.- Specified by:
forEachAssignedValueUnfilteredin interfaceMoveStreamFactory<Solution_>- Parameters:
variableMetaModel- the meta model of the list variable to enumerate- Returns:
- enumerating stream with all values as defined above
- See Also:
-
forEachAssignedValue
public <Entity_,Value_> UniEnumeratingStream<Solution_,Value_> forEachAssignedValue(PlanningListVariableMetaModel<Solution_, Entity_, Value_> variableMetaModel) Description copied from interface:MoveStreamFactoryEnumerate all values assigned to any entity'sPlanningListVariable. This will not include any pinned positions or fully pinned entities. You can useSolutionView.getPositionOf(PlanningListVariableMetaModel, Object)later downstream to get the position of the value in an entity's list variable, if needed.- Specified by:
forEachAssignedValuein interfaceMoveStreamFactory<Solution_>- Parameters:
variableMetaModel- the meta model of the list variable to enumerate- Returns:
- enumerating stream with all values as defined above
- See Also:
-
forEachDestination
public <Entity_,Value_> UniEnumeratingStream<Solution_,PositionInList> forEachDestination(PlanningListVariableMetaModel<Solution_, Entity_, Value_> variableMetaModel) Description copied from interface:MoveStreamFactoryEnumerate all possible positions of a list variable to which a value can be assigned. This will include one position past the current end of the list, allowing for assigning at the end of a list. It will not include any pinned positions or fully pinned entities, as well asUnassignedElement. To includeUnassignedElement, useMoveStreamFactory.forEachDestinationIncludingUnassigned(PlanningListVariableMetaModel)instead.- Specified by:
forEachDestinationin interfaceMoveStreamFactory<Solution_>- Parameters:
variableMetaModel- the meta model of the list variable to enumerate- Returns:
- enumerating stream with positions as defined above
- See Also:
-
forEachDestinationIncludingUnassigned
public <Entity_,Value_> UniEnumeratingStream<Solution_,ElementPosition> forEachDestinationIncludingUnassigned(PlanningListVariableMetaModel<Solution_, Entity_, Value_> variableMetaModel) Description copied from interface:MoveStreamFactoryAs defined byMoveStreamFactory.forEachDestination(PlanningListVariableMetaModel), but also includes a singleUnassignedElementposition if the list variable allows unassigned values. If the list variable does not allow unassigned values, then this method behaves exactly the same asMoveStreamFactory.forEachDestination(PlanningListVariableMetaModel).- Specified by:
forEachDestinationIncludingUnassignedin interfaceMoveStreamFactory<Solution_>
-
getNodeSharingSupportFunctions
public <Entity_,Value_> DefaultMoveStreamFactory.ListVariableNodeSharingSupportFunctions<Solution_,Entity_, getNodeSharingSupportFunctionsValue_> (PlanningListVariableMetaModel<Solution_, Entity_, Value_> variableMetaModel) -
pick
- Specified by:
pickin interfaceMoveStreamFactory<Solution_>
-
getSolutionDescriptor
-
forEachAssignablePosition
public <Entity_,Value_> UniEnumeratingStream<Solution_,ElementPosition> forEachAssignablePosition(PlanningListVariableMetaModel<Solution_, Entity_, Value_> variableMetaModel) Description copied from interface:MoveStreamFactoryEnumerate all possible positions of a list variable to which a value can be assigned. This will eliminate all positions onpinned entities, as well as allpinned indexes. If the list variableallows unassigned values, the resulting stream will include a single instance ofUnassignedElementinstance.Will be removed right before this API is moved out of preview.
- Specified by:
forEachAssignablePositionin interfaceMoveStreamFactory<Solution_>- Parameters:
variableMetaModel- the meta model of the list variable to enumerate- Returns:
- enumerating stream with all assignable positions of a given list variable
- See Also:
-