Constraints in Ngene

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
tn73
Posts: 12
Joined: Thu May 16, 2013 9:29 pm

Constraints in Ngene

Post by tn73 »

Hi all
I would like to constrain the attribute levels (percentages) in each alternative (fuel mix) such that they to sum up to 100%. I have tried the syntax below but I get an error: "Error: The ';alg' property contains an unrecognised algorithm type. 'mfederov' "

When I remove the alg property, the model runs but none of the alternatives generated meet the constraint.

;alts = alt1, alt2, alt3
;rows = 12
;eff = (mnl,d)
;alg = mfederov
;require:
alt1.Hydro + alt1.Coal + alt1.Geo + alt1.Wind + alt1.Gas = 100,
alt2.Hydro + alt2.Coal + alt2.Geo + alt2.Wind + alt2.Gas = 100
;model:
U(alt1) = b_Hydro[0.0772] * Hydro[0,10,20,30] + b_Coal[-0.028] * Coal[0,10,20,30] + b_Geo[0.0465] * Geo[0,10,20,30] + b_Wind[0.0784] * Wind[20,40,60,80] + b_Gas[-0.0014] * Gas[0,20,40,60] + b_Cost[-0.0066] *Cost[5,10,15,20] /
U(alt2) = b_Hydro * Hydro + b_Coal * Coal + b_Geo * Geo + b_Wind * Wind + b_Gas * Gas + b_Cost * Cost $

Please help
tn73
Michiel Bliemer
Posts: 2055
Joined: Tue Mar 31, 2009 4:13 pm

Re: Constraints in Ngene

Post by Michiel Bliemer »

Hi,

Which version of Ngene do you use?
I am not able to replicate your error, the syntax you provide runs fine (with the mfederov algorithm) and generates correct choice tasks in which the levels sum up to 100%. I am running version 1.1.1. I am assuming you have place 'Design' at the top of your syntax?

In Ngene 1.1.1, there is a new feature that does actually this, where you can guarantee that attribute levels add up to 1 or 100 or any other number. See Section 8.9 of the Ngene manual. Below I copy the syntax from the manual.

Code: Select all

Design
;alts = alt1, alt2
;rows = 12
;eff = (mnl,d)
;alg = swap
;model:
U(alt1) = b1[0.5] * prEarly[0.2,0.4] * Early[10,12,14] +
b2[0.2] * prOntime[0.5,0.3] * Ontime[20,22,24] +
b3[-0.4] * prLate[fcn(1 - alt1.prEarly - alt1.prOntime)]
* Late[25,27,29] /
U(alt2) = b1 * prEarly * Early +
b2 * prOntime * Ontime +
b3 * prLate[fcn(1 - alt2.prEarly - alt2.prOntime)] * Late
$
tn73
Posts: 12
Joined: Thu May 16, 2013 9:29 pm

Re: Constraints in Ngene

Post by tn73 »

Hi Michiel,
Yes I have 'Design' placed at the top of the syntax. I am running version 1.1.0 and still get the same error as before. Could this be caused by the version I am running?
Thanks
tn73
Andrew Collins
Posts: 77
Joined: Sat Mar 28, 2009 4:48 pm

Re: Constraints in Ngene

Post by Andrew Collins »

There were some changes between 1.1.0 and 1.1.1 that could potentially affect this, so I would certainly suggest upgrading to 1.1.1 and trying with that. If you run the installer, it should just install over the top of the old version without the need to reactivate etc.

Andrew
Gilou
Posts: 3
Joined: Tue Apr 12, 2016 6:37 pm

Re: Constraints in Ngene

Post by Gilou »

Hi all,
I have the same problem than tn73, that is Ngene does not take into account the constraints I specify (though it is not stated that there is an error).

Design
;alts=alt1*, alt2*, alt3*
;rows=18
;block=2
;eff=(mnl,d)

;Model:
U(alt1)= b0 +
b1.dummy[3|2]*zone1[1,2,0] +
b2.dummy[3|2]*zone2[1,2,0] +
b3.dummy[3|2]*zone3[1,2,0] +
b4.dummy[3|2]*zone4[1,2,0] +
b5.dummy[3|2]*zone5[1,2,0] +
b6[-0.2]*taxe[0,5,15,30,60]/

U(alt2)= b0 +
b1.dummy*zone1 +
b2.dummy*zone2 +
b3.dummy*zone3 +
b4.dummy*zone4 +
b5.dummy*zone5 +
b6*taxe

;require:
alt1.zone1<>0,
alt2.zone1<>0,
alt1.zone4<>2,
alt2.zone4<>2
$

I am running Ngene 1.1.2.

Thanks for your help
Gilou
Michiel Bliemer
Posts: 2055
Joined: Tue Mar 31, 2009 4:13 pm

Re: Constraints in Ngene

Post by Michiel Bliemer »

The ;require and ;reject command only work with the modified Federov algorithm (see manual), so please add ;alg = mfederov. You may also want to define the number of candidates as a property in modified Federov.
Post Reply