InserterLogic module

class InserterLogic.InserterLogic(width, height, conveyor, assembler, in_out_pos)[source]

Bases: DirectionalElement, GridElement

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

  • conveyor (Array[Array] EnumSort) – reference to the variable conveyor

  • assembler (Array[Array] EnumSort) – reference to the collision variable of the assembler

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

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

inserter_input()[source]

Creates the constraint that ensures the input of an inserter is a valid element, the cell the inserter takes input can only be a conveyor pointing any direction or an assembler

Returns:

List with all the logic regarding the constarint

Return type:

Array

inserter_output()[source]

Creates the constraint that ensures the output of an inserter is a valid element, the output cell of an inserter can only be a conveyor pointing a direction that it’s not the opposite direction of the inserter, or an assembler.

Returns:

List with all the logic regarding the constraint

Return type:

Array

prevent_redundant_inserter()[source]

Creates the constraint prevents redundant combination between inserters and conveyors, precisely when the output of an inserter is a conveyor pointing the same direction as the inserter

Returns:

List with all the logic regarding the constraint

Return type:

Array