Skip to main content

Retrieve an existing solution of decision variables and and assing it to another one

Answered

Comments

2 comments

  • Maliheh Aramon
    Gurobi Staff Gurobi Staff

    Hi Abde, 

    To fix the variable \(\texttt{S2[s,t]}\) to the value of the variable \(\texttt{S1[s,t]}\) already optimized, you can use one of the approaches below:

    • Via setting the lower and upper bounds 
    S2[s,t].LB = S1[s,t].X
    S2[s,t].UB = S1[s,t].X
    • Via adding an additional constraint 
    model.addConstr(S2[s,t] == S1[s,t].X)


    Best regards,

    Maliheh

    1
  • Abde
    Gurobi-versary
    Conversationalist
    First Question

    Dear Ms. Maliheh,

    Thank you so much for your kind reply, I really appreciate your help.

    Best Regards,

    0

Please sign in to leave a comment.