Compound contraint

This forum is for posts that specifically focus on the Windows desktop version of Ngene (i.e. all version 1.x releases).

Moderators: Andrew Collins, Michiel Bliemer, johnr

Post Reply
paulm
Posts: 25
Joined: Wed Jan 09, 2013 3:51 am

Compound contraint

Post by paulm »

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.
Michiel Bliemer
Posts: 2056
Joined: Tue Mar 31, 2009 4:13 pm

Re: Compound contraint

Post by Michiel Bliemer »

I think there is an easier way, namely:

;require:
a1.att1 + a1.att2 + a1.att3 + a1.att4 + a1.att5 + ... <= 3

You also need to use another algorithm for this, namely:
;alg = mfederov(candidates = xxxx)

This algorithm lets go of attribute level balance, but this is typically not problematic, especially if you are using dummy or effects coding.

Michiel
paulm
Posts: 25
Joined: Wed Jan 09, 2013 3:51 am

Re: Compound contraint

Post by paulm »

Thanks. I didn't realize it was that simple to use ;require. Fingers crossed the mfederov algorithm finds a useful design.
Post Reply