문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top