This project contains a Quarkus application with OptaPlanner's constraint solving Artificial Intelligence (AI) integrated with a database and exposed through a REST API.
This web application optimizes a wings schedule for students and mentors.
It assigns Timeslot
and Mentor
values to MentorAssignment
instances automatically
by using AI to adhere to hard and soft scheduling constraints, such as:
- Calendar conflict: Mentor (or the student presenter) is unavailable for the requested timeslot (Google calendar integration).
- Mentor conflict: A mentor cannot have multiple assignments in the same timeslot.
- Self assignment conflict: A student cannot be assigned to the panel of their own wings run.
- Mentor pairing constraint: Prefer to pair mentors with their mentees.
- Max assignments: Prefer mentors not to have more than [5] assignments per week.
- Mentor affinity: Prefer assignments to more actively engaged mentors.
The calendar conflict constraint requires read-only access to your Google calendar. The mentors you add as ProblemFacts
should be named according to their email address. At the moment, GoogleCalendarIntegration.fetchSchedules()
suffixes the provided username with @redhat.com
.
-
Clone this repository, and
cd
into it:git clone https://github.com/andykrohg/popinjay.git cd popinjay
-
Create an Oauth Client for Red Hat's GSuite:
- Visit https://console.cloud.google.com/apis/credentials, and login with your Red Hat google account.
- Click the Project dropdown in the top left, and click NEW PROJECT in the top-right of the modal that pops up. Name the project anything you like (e.g. "Popinjay-akrohg").
- Click the hamburger in the top left and visit APIs & Services -> Credentials
- Click CREATE CREDENTIALS and choose type Oauth client
- Use Applictation type: Desktop app, and use any name you like.
- Open the newly created client and click DOWNLOAD JSON. Move/rename the resultant file to
popinjay/src/main/resources/credentials.json
-
Run the app using the maven wrapper:
./mvnw quarkus:dev
-
Visit http://localhost:8080 in your browser. You'll see a schedule beginning the first Monday following the current date.
-
Modify the week's Timeslots, Mentors, and Wings Runs as you see fit. Be sure to use mentor's user ID from Rover so that calendar's are accessed correctly.
-
Click Solve. The app will open a new tab requesting write access to your Calendar. This is required for sending meeting invites for the generated schedule.
-
After granting permissions, go back to your other tab. If it displays an error, click Solve again. The solver will run for 60 seconds, attempting to build the best-scoring solution.
-
If you're satisfied with the output, click Send Meeting Invites and confirm to send out meeting invites for the generated schedule.