Search code examples
optaplannerdrools-planner

Multiple Planning Variables in OptaPlanner


I have solved a problem using optaPlanner using incremental java in which one planning variable and one planning Entity, But now in our project there is requirement in which many planning variables like we have to find the best Room(capacity, isAC etc etc) , Car(totalSeatsLeft , isAC etc etc ) and we do not know how many of resources are , Because everyday we need to add more resources as per the user requirement like conference room facility etc, So give me some idea so that we can make the Domain for Opta Planner. Thanks.


Solution

  • Each planning variable in an entity needs to be field. Currently OptaPlanner does not support having an array (or list) which is a planning variable. It's unclear if we 'll ever want to do that (because it introduces other issues).

    Why doesn't something like this work?

    @PlanningEntity class Event {
        long eventId;
        long eventName;
        @PlanningVariable Car car;
        @PlanningVariable Room room;
    }