Skip to main content

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

Answered

Comments

3 comments

  • Official comment
    Simranjit Kaur
    • Gurobi Staff
    This post is more than two years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support.
  • Maliheh Aramon
    • 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
    • First Comment
    • First Question

    Dear Ms. Maliheh,

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

    Best Regards,

    0

Post is closed for comments.