Error reading LP format file.. Unrecognized constraint RHS or sense
AnsweredHi,
any ideas why I get the following error:
"Error reading LP format file Steiner1.lp at line 11
Unrecognized constraint RHS or sense
Neighboring tokens: " >= x_12 y_1 >= x_13 y_2 >= x_12 "
Error 10012: Unable to read file"
upon command: "gurobi_cl resultfile=Steiner1.sol Steiner1.lp"
The content of the Steiner1.lp file is:
\Decision variables: edge-selected: x_ij; node-selected: y_j
Minimize 3 x_12 + 3 x_13 + 3 x_23 + 3 x_24 + 3 x_35 - 10 y_1 - 2 y_2 - 2 y_3 - 2 y_4 - 2 y_5
subject to
x_24 >= 1 \edges to terminal
x_35 >= 1 \edges to terminal
y_4 >= 1 \terminal
y_5 >= 1 \terminal
x_13 + x_23 + x_35 >= 1 \root
y_1 >= x_12 \select node if connected
y_1 >= x_13 \select node if connected
y_2 >= x_12 \select node if connected
y_2 >= x_23 \select node if connected
y_2 >= x_24 \select node if connected
y_3 >= x_13 \select node if connected
y_3 >= x_23 \select node if connected
y_3 >= x_35 \select node if connected
y_4 >= x_24 \select node if connected
y_5 >= x_35 \select node if connected
y_1 <= 1/2 x_12 + x_13 \Steiner node
y_2 <= 1/2 x_12 + x_23 + x_24 \Steiner node
y_3 <= 1/2 x_13 + x_23 + x_35 \Steiner node
binary
x_12
x_13
x_23
x_24
x_35
y_1
y_2
y_3
y_4
y_5
End
Thank you!
-
Official comment
This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support. -
Hi Michael,
From the LP format documentation:
Each constraint starts with an optional label (constraint name, followed by a colon, followed by a space), continues with a linear expression, followed by an optional quadratic expression (enclosed in square brackets), and ends with a comparison operator, followed by a numerical value, followed by a line break.
So a constraint in the form
y_1 >= x_12 \select node if connected
is not accepted and has to be written as
y_1 - x_12 >= 0 \select node if connected
Moreover, please note that \(\texttt{1/2}\) will not be interpreted as \(\texttt{0.5}\) but as \(\texttt{1}\) by the LP format. Thus, you should always use floating point numbers when working with optimization file formats.
Best regards,
Jaromił0 -
Thank you!
0
Post is closed for comments.
Comments
3 comments