Huge flattened instance (and RAM used)

30 views
Skip to first unread message

Luca Allulli

unread,
Jan 31, 2025, 4:40:20 AM1/31/25
to MiniZinc

Hi,

I have modeled a problem in MiniZinc, which I solve using OR-Tools CP-SAT. The solver is quite efficient, taking only a few seconds to solve an instance with 354 decision variables (see below). However, MiniZinc takes significantly longer—several minutes—and consumes a large amount of RAM (several gigabytes) to flatten the instance.

For example, flattening an instance with:

  • 70072 parameters
  • 354 decision variables
  • 708 derived variables

results in a flattened .fzn file of 183 MB and requires approximately 12 GB of RAM (6 GB for flattening + 6 GB for loading the flattened instance into the solver).

For comparison, the file sizes of my model and instance are:

  • 4.2 KB (model.mzn)
  • 493 KB (data.json)

Am I doing anything wrong? Given these numbers, and considering that I may need to solve much larger instances, using MiniZinc might be impractical. I may need to model the problem directly in OR-Tools instead.

Thanks,
Luca

Luca Allulli

unread,
Jan 31, 2025, 5:30:57 AM1/31/25
to MiniZinc
Hi, I've improved the situation by converting the derived variables into functions. Now, MiniZinc uses approximately 1.5 GB of RAM to flatten the instance and 1.5 GB to load the flattened instance.

Luca
Reply all
Reply to author
Forward
0 new messages