= Partner Units general = <> == Problem Description == A given people counting system includes three types of components, namely door sensor, zone, and communication unit. The problem requirements are: 1. Each zone as well as each door sensor must be connected to exactly one unit; 2. Each unit can control at most two door sensors and at most two zones; 3. If a unit controls a door sensor that contributes to a zone controlled by another unit, then the two units must be connected directly, i.e. one unit becomes a partner unit of the other and vice versa; 4. Each unit can have at most maxPU (>2) partner units. The solution of the PartnerUnits problem is defined as follows: Given a consistent configuration of door sensors and zones (encoded in the binary predicate zone2sensor/2), a set of available units (comUnit/1), and a maximum number of allowed partnerunits (maxPU/1), find a valid assignment of units that satisfies all requirements. == Predicates == * '''Input''': {{{comUnit/1, maxPU/1, zone2sensor/2}}} * '''Output''': {{{unit2zone/2, unit2sensor/2, partnerunits/2}}} == Input format == The predicates comUnit/1 and maxPU/1 define available units and the number of allowed partner units respectively. The fact that a door sensor belongs to a zone is given by means of zone2sensor/2 predicate, e.g. {{{zone2sensor(1,1)}}} means that {{{doorSensor(1)}}} belongs to zone(1). == Output format == A solution to the problem is an assignment of each zone and each sensor to a unit, e.g. {{{unit2sensor(2,1)}}}, {{{unit2zone(2,1)}}} means that zone(1) and doorSensor(1) are assigned to the second unit {{{comUnit(2)}}}. Connections between partner units are given by the partnerunits/2 predicate, e.g. partnerunits(2,1) indicates a connection between {{{comUnit(2)}}} and {{{comUnit(1)}}}. == Example(s) == INPUT {{{ comUnit(1).comUnit(2).comUnit(3).comUnit(4). maxPU(2). zone2sensor(1,1). zone2sensor(1,2). zone2sensor(2,2).zone2sensor(2,4). zone2sensor(2,3). zone2sensor(3,3). zone2sensor(3,5).zone2sensor(4,5). zone2sensor(4,6). zone2sensor(4,7). }}} OUTPUT {{{ unit2sensor(1,1). unit2sensor(1,4). unit2sensor(2,3). unit2sensor(2,7). unit2sensor(3,2). unit2sensor(3,5). unit2sensor(4,6). unit2zone(1,1). unit2zone(1,2). unit2zone(4,3). unit2zone(4,4). partnerunits(2,1). partnerunits(3,1). partnerunits(1,2). partnerunits(4,2). partnerunits(1,3). partnerunits(4,3). partnerunits(2,4). partnerunits(3,4). }}} == Notes and updates == This is the general version of the twin problem [[https://www.mat.unical.it/aspcomp2011/FinalProblemDescriptions/PartnerUnitsPolynomial|Partner Units (polynomial)]]. == Author(s) == * Anna Ryabokon * Alpen-Adria University, Austria * Andreas Falkner * Siemens AG * Gerhard Friedrich * Alpen-Adria University, Austria