k88
k88

Reputation: 1934

Nullable chained planning variable in Optaplanner

So I am looking at modelling an overconstrained routing problem, where not all tasks have to be picked up in that specific planning problem. Rather the objective will be to maximise the tasks picked up in that planning problem.

I was thinking this should be easy to achieve by allowing the planning variable to be nullable, but it seems that Optaplanner does not allow this on chained planning variables.

So the workaround I am thinking about would be to devise a Dummy/Ghost vehicle for which the objective be to rather minimise the tasks assigned to this vehicle. This approach seems to echo what has been said here.

Alternatively, I think I can put the value null in the valueRangeProvider but I am not sure if this would work as intended.

Is this a reasonable approach, or are there caveats using this approach ?

Upvotes: 5

Views: 435

Answers (1)

Geoffrey De Smet
Geoffrey De Smet

Reputation: 27312

null in ValueRangeProvider doesn't work.

The Dummy workaround is very, very common - I did it a few times myself (including for the RH summit demo). But once PLANNER-226 is fixed, we can get rid of that dummy workaround.

Upvotes: 5

Related Questions