3

I'm using GLPK under Linux to solve some linear programming problems. In one of my restrictions I have:

s.t. example: binary_var+binary_val <=1;

Where binary_val is a variable defined as 'binary'.

If binary_val takes the value 1, will its sum be 2, or as it is in binary, will it return either 0 or 1?

1
  • Forgot to say that I searched in the official reference, without luck Commented Feb 19, 2012 at 16:02

1 Answer 1

2

If binary_var + binary_val <= 1 then here's what that constraint means:

Either binary_var or binary_val can be 1, but both cannot be simultaneously 1. Both can be zero, since the constraint is satisfied.

To answer your specific question, a binary variable can only assume values 0 or 1. But the sum of two binary variables can be 2.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you, that last paragrapph was the answer I was looking for!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.