Skip to main content

Extract gurobi 3-dimensional variable value to a ndarray?



1 comment

  • Mario Ruthmair
    Gurobi Staff Gurobi Staff

    Hi Scott,

    The easiest way to get the solution values and access them in the same way as the variables is via:

    values = model.getAttr("X", self.model.getVars())

    The method returns a dictionary with the same keys as the variables. This should also be much faster than using getVarByName() for each variable.

    Best regards,


Please sign in to leave a comment.