Skip to main content

Adding constraints in R

Answered

Comments

1 comment

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

Please sign in to leave a comment.