Harish Garg
Harish Garg

Reputation: 139

Optaplanner: work with multiple users submitting from multiple threads

I would like to know if we have a planning problem that can be used by many users at a single time. How we can handle this using optaplanner and get optimal solution for all the users?

Upvotes: 2

Views: 322

Answers (1)

Geoffrey De Smet
Geoffrey De Smet

Reputation: 27312

If every user (or group of users) have their own isolated Solution instance, that's called multi-tenancy. For example: a nurse scheduling web app which services multiple independent hospitals. The planning of 1 hospital (=tenant) does not affect the planning of other hospitals (=other tenants). Basically, every tenant gets their own Solver instance.

If multiple users collaborate on the same Solution instance, then there's only 1 Solver instance which solves that. Either all users have submitted their demands and wishes before Solver.solve() starts, or - in the case of real-time planning - they add/change their demands/wishes from a different thread with Solver.addProblemFactChange() while it's solving. For example: all nurses in a hospital submit their free off day requests before midnight. After midnight, the Solver schedules the hospital, taking those requests into account.

Neither of this is about multi-threaded solving, which is a different topic (but not related to users, so not relevant to your question).

Upvotes: 1

Related Questions