Hi there,
I'm working on a design with a counter constraint (similar in a way to partial profile). there are many attributes but one set of 7 has the following constraint. I can allow 0, 1, 2, or 3 of the 7 binary attributes to be 1.
A snippit of code.
U(A) = ... +
b1.d[0]*att1[0,1] +
b2.d[0]*att2[0,1] +
...
b7.d[0]*att7[0,1] +
... (more attributes)
etc.
I have in mind:
;cond:
if (a1.att1 = 1 and a1.att2 = 1 and a1.att3 = 1, a1.att4 = 0),
if (a1.att1 = 1 and a1.att2 = 1 and a1.att3 = 1, a1.att5 = 0),
for many lines.
Is there a simpler way to count the number of 1s and set a cap at 3? How do I do that?
Thanks for your help.