Home > Blockchain >  Single Task Assignment with OptaPlanner
Single Task Assignment with OptaPlanner

Time:06-05

I have a customer service application with live messaging feature. When a new conversation is started by a client, I want to assign this single conversation to most available customer service represantative (who has min. nubmer of converastions, min. average conversation length and min. average conversation duration). Also I can get the list of c.s.representatives at a moment and the properties dynamically changes. So every time I get this list, I have different c.s.representatives with different properties. I want to implement this optimization feature with OptaPlanner. How can I write my PlanningEntity, PlanningSolution and ConstraintProvider classes?

public class CustomerServiceRepresantative {
    private String id;
    private int numberOfConversations;
    private int avgConversationLength;
    private int avgConversationDuration;
    public CustomerServiceRepresantative () {}
}
public class ConversationTask {
    private int id;
    public ConversationTask() {}
}

CodePudding user response:

  1. Use @PlanningPin to pin all your existing assignments, so only your one new assignment is unpinned.

  2. Configure the SolverConfig.withPhases(new ConstructionHeuristicPhaseConfig()) to only run the CH. Give it unlimited termination time, it will terminate when the CH terminates.

  • Related