Ask Your Question
2

values of variables from points in the polyhedron defined by a linear program

asked 4 years ago

Max Alekseyev gravatar image

updated 4 years ago

SageMath provides a function for constructing the polyhedron defined by a linear program. Given a point in such a polyhedron, how can I tell which coordinate of the point corresponds to which variable of the linear program?

ADDED: The documentation suggests that "the polyhedron is built from the variables stored by the LP solver" and that "they usually match the ones created explicitly when defining the LP", except possibly for Gurobi solver. So, the question seems to reduce to finding the order number of each variable in LP (or an accurate bookkeeping of their creations). Things are even more fuzzy for Gurobi, which one of the best solvers out there.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
0

answered 0 years ago

Max Alekseyev gravatar image

updated 0 years ago

It seems that the order number (backend index) of a MIP variable can be obtained from its string representation as follows:

def get_backend_index(mip_var):
    return int(str(mip_var)[2:])

I've added a request for an "official" way to get this index at https://github.com/sagemath/sage/issu...

Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 4 years ago

Seen: 339 times

Last updated: Oct 10 '24