Skip to main content

Find the coefficient of a variable in a complex (very large) objective function

Answered

Comments

2 comments

  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    Hi Chris,

    Given only the name of a variable, you can get the variable object using the getVarByName function. You can then look up the objective coefficient of a given variable directly via variable attributes.

    Best regards,
    Jaromił

    0
  • Chris Domnisoru
    Gurobi-versary
    First Comment
    First Question

    Thank you.

    Indeed, I overlooked the obj attribute and ended up with a more complex solution using the functionality of the linear expression object representing the objective.

    Thank you,

    Chris

    0

Please sign in to leave a comment.