Fractions
回答済みIf the coefficient of a variable in an LP file is a fraction (like 1/3) or an irrational number (e.g., sqt(2)), how do you correctly write that? I.e., what syntax is correct?
Is the only option to use decimals? Is there no better way?
-
正式なコメント
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 why not try our AI Gurobot?. -
For fractions you can of course just multiply the whole constraint by the smallest common multiplier of your denominators. So, instead of writing 1/3x + 2y <= 7 you would write x + 6y <= 21. For roots or other irrational numbers, there is no better way than using floating points.
In any case, you should always use double precision in your calculations to get the floating point values, and you should not truncate digits. So, please don't write 1.414214x + y <= 5, but instead write 1.414213562373095x + y <= 5.
Regards,
Tobias
1
投稿コメントは受け付けていません。
コメント
2件のコメント