ItemFlowLogic module

class ItemFlowLogic.ItemFlowLogic(width, height, route, inserter, conveyor, in_out_pos, recipes)[source]

Bases: DirectionalElement, GridElement, RecipeElement

This class contains all the constraints that implement the logic of the flow 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

  • in_out_pos (Dictionary) – Contains the input and output positions and type of item carrying

  • 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.

constraints()[source]

Creates a list of all the constraints representing the logic of the class

Returns:

all the constraint of the class logic in a single array

Return type:

Array

domain_constraint()[source]

Creates a constraint that ensures teh variable item_flow only takes values inside the domain [0..self.max_items]

Returns:

List with all the logic regarding the constraint

Return type:

Array

item_carry()[source]

Creates a constraint that encode the behaviour of how items are carryed between cells that transport them. If a cell contains an inserter or a conveyor, its item_flow value will propagate to the cell its pointing. Also, if the cell has an inserter, the item_flow value will not be propagated if the output of the inserter is an assembler.

Returns:

List with all the logic regarding the constraint

Return type:

Array

item_input()[source]

The input cells carry the item specified in the input coordinates

Returns:

List with all the logic regarding the constraint

Return type:

Array

item_output()[source]

The input cells carry the item specified in the input coordinates

Returns:

List with all the logic regarding the constraint

Return type:

Array

part_of_route()[source]

If a cell is part of route, then that cell must carry an item

Returns:

List with all the logic regarding the constraint

Return type:

Array