ItemFlowRateLogic module¶
- class ItemFlowRateLogic.ItemFlowRateLogic(width, height, in_out_pos, inserter, conveyor, route)[source]¶
Bases:
DirectionalElement,GridElementThis class contains all the constraints that implement the logic of the flow rate of items. Note that all the constraints of the model are explained in detail in the project report.
- Parameters:
width (Int) – Width of the blueprint
height (Int) – Height of the blueprint
route (Arrat[Array] EnumSort) – reference to the route variable
conveyor (Arrat[Array] EnumSort) – reference to the variable conveyor
inserter (Arrat[Array] EnumSort) – reference to the inserter variable
recipes (Dictionary) – Contains the recipes that the assemblers in the blueprint will use, for each recipe it has a list of the items it requires and which rate in items/min needs and the outputting item and rate.
- belt_item_flow_propagation()[source]¶
Creates a constraint that encodes the behaviour of how the amount of items a conveyor carries is propagated. The input rate of a conveyor is the sum of all the outputs of the neighbouring cells (inserter or conveyor) pointing towards the conveyor. The output rate of a conveyor is its input minus the sum of inputs of inserters taking items from the conveyor.
- Returns:
List with all the logic regarding the constraint
- Return type:
Array
- constraints()[source]¶
Creates a list of all the constraints representing the logic of the class
- Returns:
class constraints compacted in a single list
- Return type:
Array
- inserter_item_flow_propagation()[source]¶
Creates a constraint that encodes the behaviour of how the amount of items an inserter carries is propagated. The input rate of an inserter is at max 50 if the input cell carries 50 or more items, in the other hand if the input cell carries less than 50 the inserter will carry at most the same amount of items. The output flow rate of the inserter will always be the same as the input.
- Returns:
List with all the logic regarding the constraint
- Return type:
Array
- item_input_rate()[source]¶
The input cells rate is the rate specified in the input coordinates
- Returns:
List with all the logic regarding the constraint
- Return type:
Array
- item_loss()[source]¶
Sums the number of items that are not getting used by assemblers (loss), the loss happens when the flow rate of a conveyor feeding an inserter feeding an assembler is greater than 0.
- Returns:
sum of unused items, used for optimization
- Return type:
Array
- item_output()[source]¶
Sums the number of output items produced by the blueprint.
- Returns:
sum of produced items, used for optimization
- Return type:
Array