I have written a mosel code to solve a problem using the BIG M linearisation approach.

My code contains over 7,000 binary variables and is taking too long to compute (47 minutes).

Without using binary variables, it computes in 1.6 seconds but the binary variables are essential to get the perfect result(integer).

How can I reformulate the binary variables such that the model will have a faster execution time?

Which other way can I use to code the BIG M linearisation approach?

Portions of the code are written below.

declarations

I: set of integer

T:set of integer

B: set of integer

g: array (I,T,B) of mpvar

mewmin: array (I,T,B) of mpvar

w1: array (I,T,B) of mpvar

end-declarations

M:=100000

forall (i in I, t in T, b in B)do

w1(i,t,b) is_binary

mewmin(i,t,b)>=0; g(i,t,b)>=0

mewmin(i,t,b)<=w1(i,t,b)*M

g(i,t,b)<=(1-w1(i,t,b))*M

end-do

You might want to try using indicator constraints instead of the bigM formulation by replacing these 2 lines:

mewmin(i,t,b)<=w1(i,t,b)*M

g(i,t,b)<=(1-w1(i,t,b))*M

by the following:

indicator(-1, w1(i,t,b), mewmin(i,t,b)<=0)

indicator(1, w1(i,t,b), g(i,t,b)<=0)