$\begingroup$
$\endgroup$
6
How can one model the following condition in an integer linear program? $$ y = \begin{cases} 1 & \text{if } x > 0\\ 0 & \text{otherwise}\end{cases} $$ Where $y \in \{0,1\}$ and $x \in \mathbb N$.
-
$\begingroup$ What do you think? What have you tried? This site encourages you to show your thoughts and partial progress towards solving the problems. People can then make the answers more helpful for you and for future readers. $\endgroup$喜欢算法和数学– 喜欢算法和数学2019年02月18日 17:11:35 +00:00Commented Feb 18, 2019 at 17:11
-
$\begingroup$ Would this question help you? $\endgroup$喜欢算法和数学– 喜欢算法和数学2019年02月18日 17:12:03 +00:00Commented Feb 18, 2019 at 17:12
-
$\begingroup$ Whether this is possible depends on additional context, such as whether you have an upper bound on $x$ and whether you already have an objective function. See "Cast to boolean" at cs.stackexchange.com/q/12102/755. Is your question answered by any of those? If not, can you edit your question to provide additional context and explain why those solutions are not applicable here? $\endgroup$D.W.– D.W. ♦2019年02月18日 20:17:32 +00:00Commented Feb 18, 2019 at 20:17
-
$\begingroup$ @Apass.Jack Actually my question is based on the one you linked. I tried the most voted solution, but apparently C cannot be 0. $\endgroup$Swaz– Swaz2019年02月19日 10:06:49 +00:00Commented Feb 19, 2019 at 10:06
-
$\begingroup$ @D.W. I have a lower (0) and upper bound for x. The "Cast to boolean (version 1)" solution in the page you linked seems to work perfectly fine. Thanks. $\endgroup$Swaz– Swaz2019年02月19日 10:06:53 +00:00Commented Feb 19, 2019 at 10:06
Explore related questions
See similar questions with these tags.