0

I am trying to maximize the absolute distance of binary variables from 0.5 in a relaxed form of a MIP model to push the solution to integer values as much as possible. For that I have linearized the absolute expressions (|0.5-y|) using the conventional variable change technique. To avoid the non-linear constraints (x_plus * x_minus=0) I intend to use SOS sets. But add_sos1 method functions super slow for some reason. Is this normal or a bug or common mistake I am possibly making causes it?

I looked up to see if there is other way of adding SOS sets to the model, but found nothing.

TVijpt =  MODEL.continuous_var_dict({(i,j,p,t) for i in NN for j in AA_Plus[i] for p in PP for t in TT if ValidEdge[i,j,p]}, name = 'TV', ub = .5)       
TVPijpt =  MODEL.continuous_var_dict({(i,j,p,t) for i in NN for j in AA_Plus[i] for p in PP for t in TT if ValidEdge[i,j,p]}, name = 'TVP', ub = .5)
expr = 0
for k in Yijpt.keys():
    expr += (TVijpt[k] + TVPijpt[k] )


for k in Yijpt.keys():
    MODEL.add_constraint(TVijpt[k] - TVPijpt[k] == .5-Yijpt[k])
    MODEL.add_sos1([TVijpt[k],TVPijpt[k]])  # The line is taking too long. 

Vahid
  • 1
  • 1
  • I have two question: first, did you try the Model.abs() construct of Docplex to express absolute values? and second, how many SOS constraints do you have? – Philippe Couronne Apr 16 '23 at 11:17
  • Please provide enough code so others can better understand or reproduce the problem. – Community Apr 16 '23 at 15:40
  • @PhilippeCouronne, no, I have used the conventional variable change. The number of SOS constraints is high, around 600K which can be even higher for larger instances. I should probably add that the same model in Pulp works a lot faster. – Vahid Apr 17 '23 at 05:17
  • I also tried Model.abs() to model the absolute expressions, but the solution time unreasonably climbs up. – Vahid Apr 17 '23 at 15:22

0 Answers0