Issue while creating variables

12 views
Skip to first unread message

Nageswara Reddy Kondreddy (Product Architecture)

unread,
Jan 27, 2026, 12:48:05 AM (3 days ago) Jan 27
to or-tools-discuss
Hi Team

I am creating a MILP model using Google OR Tools and failing while creating variables. 

x = {(k, s): solver.IntVar(0, 99999, f"x_{k}_{s}") for k in K for s in S}
where
len(K)
18304
len(S)
80000
That means 1.46432 billion of x variables has to create, could you please suggest how I can handle/fix this issue?

Laurent Perron

unread,
Jan 27, 2026, 2:00:01 AM (3 days ago) Jan 27
to or-tools...@googlegroups.com
do not use a naive model
Laurent Perron | Operations Research | lpe...@google.com | (33) 1 42 68 53 00



--
You received this message because you are subscribed to the Google Groups "or-tools-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools-discu...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/or-tools-discuss/1d7f9b3d-ae84-4a73-91b4-ccbf9a07c32dn%40googlegroups.com.

Nageswara Reddy Kondreddy (Product Architecture)

unread,
Jan 27, 2026, 2:29:33 AM (3 days ago) Jan 27
to or-tools-discuss
Laurent, then how to use

Laurent Perron

unread,
Jan 27, 2026, 2:45:31 AM (3 days ago) Jan 27
to or-tools...@googlegroups.com
It is not a question of usage, it is a question of model.

Imagine a variable takes 100 bytes (which is too low), you would need 146GB of memory just to store the variables. And I am not talking of constraints.

So you need to create a better/smaller model.
Laurent Perron | Operations Research | lpe...@google.com | (33) 1 42 68 53 00


Reply all
Reply to author
Forward
0 new messages