ahmetesat
ahmetesat

Reputation: 73

How to apply overconstrained planning in OptaPlanner in a better way?

In meeting scheduling example I'm trying to apply overconstrained planning. I've checked documentation and also answers in stackoverflow, then applied nullable = true to the @PlanningVariable which is in the MeetingAssignment:

   @PlanningVariable(valueRangeProviderRefs = { "roomRange" }, nullable = true)
   public Room getRoom() {
      return room;
   }

Also I've added a rule to the drool:

rule "Assign Every Person To A Room"
    when
        $meetingAssignment : MeetingAssignment(room == null)
    then
        scoreHolder.addMediumConstraintMatch(kcontext, -100);
end

My scoreholder is: HardMediumSoftScoreHolder

However when I run the application, only one person out of six different person can be assigned. This doesn't occure if nullable is false and every person can be assigned. Also this six person doens't break hard constraint. Do you have any idea for overconstraint planning solution problem?

Thank you!

Upvotes: 1

Views: 345

Answers (1)

ahmetesat
ahmetesat

Reputation: 73

Finally I've found a solution. I've only had hard and medium constraint panalties. I've changed my all mediumConstraint penalties as softConstraint except "Assign Every Person To A Room" rule. Now I can assign every person.

Thanks

Upvotes: 1

Related Questions