Skip to content

Optimizing WasteContainer Location

Repository

Optimizing WasteContainer Location

Introduction

This AI services optimizes the placement of used cooking oil (UCO) containers in Valencia to improve urban recycling accessibility and promote environmental sustainability. The service dresses the maximum covering location problem by proposing a genetic algorithm that utilizes context information to strategically position UCO recycling bins throughout the city. The goal is to enhance accessibility for residents while reducing operational costs and environmental impact.

graph TD;
    A[Web Frontend] -->|Sends optimization task| B[REST API];
    B -->|Submits task to| C[Celery];
    C -->|Assigns to a worker| D[Optimization Task];
    D -->|Fetches data from| G[Redis];
    C -->|Publishes tasks status updates to| F[MQTT Broker];

    C -->|Assigns to a worker| H[Periodically Update Data Task ];
    H -->|Gets data from| I[City Data Platform];
    H -->|Stores data in| G[Redis];

Deploy

  1. Clone the repository and navigate to its root folder:

    git clone https://github.com/CitCom-VRAIN/optimizing-container-location.git && cd optimizing-container-location
    

  2. Create and activate a Python virtual environment:

    python3 -m venv ./venv && source ./venv/bin/activate
    

  3. Install all requirements:

    pip install -r requirements.txt
    

  4. Create an .env file using .env.example as a guide:

    cp .env.example .env
    

  5. Then edit the .env file and replace the OPENROUTESERVICE_API_KEY value with your own Openroute service API key.

    ENDPOINT_CB="127.0.0.1"
    ENDPOINT_CB_PORT="9090"
    ENDPOINT_REDIS="localhost"
    REDIS_PORT="6379"
    ENDPOINT_CELERY_BROKER="pyamqp://guest@localhost//"
    

  6. Run Redis Container

    docker run --name ocl-redis -d -p 6379:6379 redis
    

  7. Run RabbitMQ Container

    docker run --name ocl-rabbitmq -d -p 5672:5672 rabbitmq
    

  8. Start Celery Worker

    celery -A tasks worker --loglevel=info
    

  9. Finally, start the server and open http://127.0.0.1:5000 in your browser:

    flask --app server run