An open API service indexing awesome lists of open source software.

https://github.com/aluriak/cathplace

Helper for placement of humans in their offices according to various constraints
https://github.com/aluriak/cathplace

answer-set-programming python qt5 tkinter

Last synced: 11 months ago
JSON representation

Helper for placement of humans in their offices according to various constraints

Awesome Lists containing this project

README

          

# Cathplace
Automatic assignation of places using [ASP/clingo](https://github.com/potassco/clingo/releases/).

Run with:

clingo 0 data-examples/humans.lp data-examples/offices.lp engine.lp -W no-atom-undefined

See [Makefile](Makefile) for further usage information.

## installation
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](requirements.txt) for exact dependencies.

You will also need the [clingo](https://github.com/potassco/clingo/releases/) 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](http://oi45.tinypic.com/fk5rbs.jpg) for instance
- `humans.lp`: as described [later](#humans)
- `offices.lp`: as described [later](#offices)

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.

## DSL
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.

### humans
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éraldine
- `imply(cunegonde,cold)`: Cunégonde makes its room cold (by opening the window, even in winter)
- `friend(gislaine,roger)`: Gislaine is friend with Roger
- `incompatible(eugene,sunny)`: Eugène can't be in a sunny room

### desk
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`](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](#GUIs) may help to build these data automatically.

## GUIs
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](#installation).

## Future work
- implement the team mixing optimization
- #project for non-differenciated desks
- *need/2* handling in DSL