Skip to main content

Reading matrix variables in in callback / Python matrix API

Answered

Comments

5 comments

  • Matthias Miltenberger
    Gurobi Staff Gurobi Staff

    Hi Sven,

    Thank you for pointing this out! This is indeed a missing feature and we will most likely add it for the next version.

    Cheers,
    Matthias

    0
  • Robert Luce
    Gurobi Staff Gurobi Staff

    I wonder about one detail in your message though:  In your callback you do

        v = m.cbGetNodeRel([m._visitors])
    vv = v.getAttr('x')

    where m._visitors is an MVar object, so my expectation would be that v (and not vv) is an ndarray containing the relaxation values for m._visitors.  What would you expect v to be instead?

    0
  • Sven Rahmann
    Gurobi-versary
    First Comment
    First Question

    Dear Robert,

    probably you're right. I thought that v would be something like an Mvar populated with the values in attribute x, but I suppose cbGet NodeRel gives you directly the ndarray? In any case, the error suggests that this is indeed not implemented yet.

    Thanks for the observation.

    Best,

    Sven

    0
  • Robert Luce
    Gurobi Staff Gurobi Staff

    Hello Sven,

    in the next bugfix release 9.0.1 (due in the next few weeks or so), you'll be able to query relaxation and solution values on MVar objects in the callback. The result of such a query is an ndarray of the same shape as the MVar itself.

    Robert

    0
  • Sven Rahmann
    Gurobi-versary
    First Comment
    First Question

    Hello Robert,

    that is excellent news; thank you.

    Sven

    0

Please sign in to leave a comment.

Powered by Zendesk