How to enforce a specific list of combination for an intVar[] in order to decrease the size of the explored domain

45 views
Skip to first unread message

Nicolas PRODANIC

unread,
May 14, 2023, 7:10:05 PM5/14/23
to choco-solver
Hello,

I am a new user of choco solver and I have some issues to optimize my modelisation of the problem.

I have N IntVar[] which I already now at start have a finite number of valid combination. 

For exemple, 5 combinations are possible : 
  - [2, 2, 2, 1, 1]
  - [1, 2, 2, 2, 1]
  - [1, 1, 2, 2, 2]
  - [2, 1, 1, 2, 2]
  - [2, 2, 1, 1, 2]

I have a implementation that works using model.intVarArray(locDuration, 1, 2);

I also used the regular method from the Model class to check that the pattern is correct.

The problem is that the execution is too long beacause all the combinations are tested (or at least far too much than we could anticipate).

Could you help me find a more optimized way to do the exploration ?

Thank you !

-- 
Nicolas Prodanic

cpru...@gmail.com

unread,
Jun 15, 2023, 3:19:00 AM6/15/23
to choco-solver
Hello

You can have a look at Table constraints which fit your need.
Then, performance issues also depend on your objective (finding a solution, an optimal one, all solutions, ...)

Plus, if you can share code, that would be easier.
Last: there is a Discord channel, it is more reactive : https://discord.gg/pk94kMzN

Best
Charles P

Reply all
Reply to author
Forward
0 new messages