Automatic assignation of places using ASP/clingo.
Run with:
clingo 0 data-examples/humans.lp data-examples/offices.lp engine.lp -W no-atom-undefined
See Makefile for further usage information.
Clone the repository or copy the source code. Use the Makefile or copy-paste commands you found here.
You will need python 3.6+, and some tierce-party packages installable with pip install -r requirements.txt
.
See the requirements.txt for exact dependencies.
You will also need the clingo solver to be installed in your $PATH.
Finally, create a data folder (or a symlink to existing data folder somewhere else) and populate it with files:
map.png
: a map of the office/lab, something like this one for instancehumans.lp
: as described lateroffices.lp
: as described later
The data folder does not exists in this repo and is marked by .gitignore
. You can therefore safely build your own with your private data.
In files data/humans.lp
and data/offices.lp
, the final user can specify
its problem using the DSL.
He should not modify engine.lp
, that contains the expension of the DSL, and the problem encoding.
User can define humans using the human(agnan,team_01).
expression. Team is here just for some features, like optimization of team mixing.
User can also:
- place manually peoples at specific places
- specify that a particular human must be alone in its room
- declare incompatibilities between peoples
- declare incompatibilities between peoples and properties
- declare a property implied by a human on its room
- declare relations between peoples, that will be later translated into constraints
- provides some options, to help choose the best assignation of desks.
Few examples:
incompatible(michel,geraldine)
: Michel can't stand Géraldineimply(cunegonde,cold)
: Cunégonde makes its room cold (by opening the window, even in winter)friend(gislaine,roger)
: Gislaine is friend with Rogerincompatible(eugene,sunny)
: Eugène can't be in a sunny room
User can work either at room or desk level, or a mix of the two.
He will define rooms and desks as shown in offices.lp
,
for instance with room(a100,2)
indicating that room a100 can contains two humans.
Rooms and/or desks can also hold arbitrary properties. Some typical
properties may be sunny, south-oriented or noisy. For instance, property(a100,sunny)
defines room a100 as sunny, making it unsuitable for Eugène.
Note that the GUI may help to build these data automatically.
Two GUI currently coexist, offering the same features : one in tkinter, one in Qt,
than can be launched using either python -m tkgui
or python -m qtgui
.
With the GUI, it's quite simple to:
- design the search space about desks and rooms, by adding desks on the map, and indicating where places for human are.
- visualize the output of Cathplace program
For the tkinter GUI, you need Tcl/Tk, that is often shipped with python. For the Qt GUI, you need PyQt5. See installation.
- implement the team mixing optimization
- #project for non-differenciated desks
- need/2 handling in DSL