Skip to main content

Adding constraints in R

Answered

Comments

2 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.
  • Riley Clement
    • Gurobi Staff

    Hi Siddhaarth,

    1) You would have to adjust model$A, model$rhs, model$sense to incorporate the new constraint and then call gurobi(model) to reoptimize.  There is no equivalent of the addConstr/AddConstr functions found in the other APIs.

    2) This should work

    model$vbasis <- temp_vbasis
    model$cbasis <- temp_cbasis

    # Optimize the model with the warm start
    result <- gurobi(model)


    Your wings are certainly clipped when using R.  I've seen it said that Julia is the spiritual successor to R.  Not sure if this is the case or not but it may be worth considering switching, if Python is not an attractive choice.  Julia has a relatively strong optimization community (https://jump.dev/ https://discourse.julialang.org/c/domain/opt/13).

    - Riley

     

    0

Post is closed for comments.