A web app to select the best subset of tasks from a given list.
- Clone this repo
$ git clone https://github.com/Bgeninatti/planner
- Enter in the
planner
directory
$ cd planner
- Run docker-compose
$ docker-compose up
- Go to
http://localhost:8000
- Create a virtualenv
$ python3 -m venv venv
- Activate the virtualenv
$ source venv/bin/activate
- Install the dependencies
$ pip install -r requirements.txt
- Run the application using gunicorn
$ gunicorn --bind 0.0.0.0:8000 "planner.wsgi:application"
- Go to
http://localhost:8000
-
Once the application is running go to
http://localhost:8000
-
A form will be displayed with one input to upload a file.
-
The file must contain a JSON string in the following format:
[
{
"name": "some string",
"resources": ["list", "of", "strings"],
"payoff": 1.0
}
...
]
Notice that each task is a dictionary with the following keys (no more, no less): name
, resources
, payoff
A few sample tasks files can be found here.
-
Submit the form.
-
The result with the selected subset of tasks and excluded tasks will be displayed.
- Run docker-compose inside the
planner
directory
$ docker-compose up -d
- Open a bash shell inside the container
$ docker run -it planner_planner:latest bash
- Run pytest inside the shell
/usr/src/app# pytest
- Follow the steps in Using a virtual environment section up to step 5
- Once inside the virtual environment run pytest
$ pytest
The applied strategy consists in build all the possible subsets of tasks (a.k.a ActionPlan
) that accomplish the
restriction of resources, and then select the one with a higher reward
.
The action plans domain is computed in the planner.planning.DomainBuilder
class. The complexity of the
the applied algorithm is less than O(n!)
because the search is bounded by the amount of unique available resources.
Only for the special case where the amount of unique available resources is equal to the number of tasks, and each task requires
only one resource, the complexity will be O(n!)
.
Also, the domain computation has high redundancy, because it will build the same combination of tasks in a different order, but the order of the tasks doesn't matter in the context of this problem.
These points are left as future improvements for the current implementation.