Compound contraint

This forum is for posts that specifically focus on Ngene.

Moderators: Andrew Collins, Michiel Bliemer, johnr

Compound contraint

Postby paulm » Wed Nov 23, 2016 9:36 am

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.
paulm
 
Posts: 25
Joined: Wed Jan 09, 2013 3:51 am

Re: Compound contraint

Postby Michiel Bliemer » Wed Nov 23, 2016 3:50 pm

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

Re: Compound contraint

Postby paulm » Thu Nov 24, 2016 1:50 am

Thanks. I didn't realize it was that simple to use ;require. Fingers crossed the mfederov algorithm finds a useful design.
paulm
 
Posts: 25
Joined: Wed Jan 09, 2013 3:51 am


Return to Choice experiments - Ngene

Who is online

Users browsing this forum: Google [Bot] and 6 guests

cron