This project is a Java-based desktop and server application that matches volunteers to community services based on their personal preferences. The backend uses a genetic algorithm to optimize these assignments based on availability and rankings.
The system consists of:
- A Swing-based UI client for volunteers to enter their preferences and view their assignments.
- A multithreaded HTTP server to store submissions and perform optimization in memory.
- A genetic algorithm that computes near-optimal matches considering service capacity constraints.
src/
├── main/
│ └── java/
│ ├── org.example.client/ # Client-side (UI + networking)
│ │ └── api/ # HTTP client logic
│ │ └── ui/ # Swing-based UI
│ ├── org.example.server/ # Server-side
│ │ └── network/ # HTTP endpoints
│ │ └── logic/ # Optimization engine
│ └── org.example.domain/ # Shared domain classes (Volunteer, Service, Assignment)
- Java 21 or higher
- Maven 3.6+
- No database required — all data is stored in-memory
mvn clean compilemvn exec:java@run-servermvn exec:java@run-clientYou can open multiple terminals and repeat step 3 to simulate multiple volunteers.
- Launch the client.
- Go to My Preferences.
- Enter your name and select 5 unique preferences from the dropdowns.
- Click Submit Preferences.
- Switch to the My Assignments tab.
- Press Run Optimization.
- Your assignment will appear shortly.
Example of 5 unique preferences:
- Soup Kitchen
- Beach Cleanup
- Animal Shelter
- Community Garden
- Youth Mentor
The server runs a genetic algorithm that:
- Tries to assign each volunteer one of their top preferences.
- Respects the capacity constraints of each service.
- Minimizes total dissatisfaction by assigning higher weight to top-ranked choices.
- Every time the client starts, a new unique volunteer ID is generated automatically using
System.nanoTime(). - Assignments are refreshed automatically via polling.
- All state is reset when the server is restarted.