Skip to content

ferr0s04/feup-ia-project-1

Repository files navigation

Patient Allocation Optimization using Metaheuristics

This project attempts to solve the problem of allocating patients to hospital wards, considering their admission days, and surgery days, using metaheuristic algorithms such as Hill Climbing, Simulated Annealing, Tabu Search, and Genetic Algorithm.
It includes a graphical interface to easily load instances and visualize the evolution of solution costs.


Installation

Requirements

  • Python 3.8 or higher
  • matplotlib
  • tkinter (usually included in Python on Windows/macOS; may need to be installed manually on Linux)

How to Run

Simply run the main script:

python main.py

This will launch a graphical interface (built with tkinter) where you can:

  • Load .dat instance files.
  • Choose one of the metaheuristic algorithms.
  • Select the initialization strategy (Worst, Random, Optimized).
  • Visualize the cost evolution over iterations.
  • View the final patient allocation (ward, admission day, surgery day).
  • Save results to a text file in the results/ folder.

Project Structure

├── main.py                       # GUI + control logic
├── algorithms/
│   ├── genetic_algorithm.py
│   ├── simulated_annealing.py
│   ├── tabu_search.py
│   ├── hill_climbing.py
│   └── genetic_utils.py
├── allocation/
│   ├── patient_allocation.py
│   └── allocation_criteria.py
├── solution_utils/
│   ├── solution_generator.py
│   └── evaluation_criteria.py
├── parser/
│   └── parser.py
├── results/                      # Saved output files
├── data/                         # For instance files
└── requirements.txt

Algorithms Supported

  • Hill Climbing
  • Simulated Annealing
  • Tabu Search
  • Genetic Algorithm
    • Includes support for memetic enhancement (hybrid with local search)

Each algorithm evaluates cost based on:

  • Delay in admission
  • OT over/underuse
  • Bed overflow
  • Workload excess and workload distribution

Output

For each execution:

  • The solution is printed in the GUI.
  • The cost evolution is plotted.
  • A summary is saved to results/, including:
    • Initial cost
    • Final cost
    • Absolute and relative improvement
    • Final allocation of each patient

Notes

  • Input files must be in .dat format.
  • The project handles both feasible and infeasible solutions and applies penalties accordingly.
  • This system is designed for experimentation and comparison of different metaheuristic strategies.

Author(s)

Developed By:
Sofia Reis, up201905450
Miguel Valente, up201704608
Gonçalo Ferros, up202207592
For the IART (Artificial Intelligence) course at FEUP.
Supervised by Luís Paulo Reis.

About

Repository for IA (Artificial Intelligence) course 1st project of LEIC FEUP, for year 2024-25

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages