Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I'm solving an optimization problem in Mathematica with binary integer constraints. It works alright with other constraints.

But the only problem is that both NMaximize and NArgMax are not treating the variable with binary integer correctly. When it's done finding a solution, some of the numbers are actually 0.4881, 1, 0, and 0.00154, and so on.

This is how I've currently set the variable with the binary constraints:

binconst = Table[Subscript[\[Beta], v], {v, 5}]
Join[Thread[0 <= binconst <= 1], {binconst \[Element] Integers}]

this gives:

$$\left\{0\leq \beta _1\leq 1,0\leq \beta _2\leq 1,0\leq \beta _3\leq 1,0\leq \beta _4\leq 1,0\leq \beta _5\leq 1,\left(\beta _1\left|\beta _2\right|\beta _3|\beta _4|\beta _5\right)\in \mathbb{Z}\right\}$$

I could approximate, but this is not good for my model. So how do I make the function recognize the binary constraints.

share|improve this question
Please post at least a minimal but complete example. Much more likely to get answers. –  rasher Apr 11 '14 at 7:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.