Search code examples
optaplanner

chained variable with a non chained?


is it OK to have a chained variable field + another, non chained one, in the same planning entity ?

example :

@PlanningVariable(valueRangeProviderRefs = {"amountToTradeRange"})
long amountToTrade;  

@PlanningVariable(valueRangeProviderRefs = {"componentsRange", "transactionsRange"}, graphType = PlanningVariableGraphType.CHAINED)
ITransactionComponent prevComponent;

Solution

  • yes, an entity can have as many planning variables as you need and they can combine any type.

    That being said, it does impact the search space.