set already under control
set already under control
I am new to gams (so probably a stupid question) and trying to set up a model with the main error being "set is already under control". I can easily create the model in excel, but can't here. Here is the following code that I am trying to use to solve whether or not to keep or cull a cow to reach a specific threshold. All the values need to be summed over all cows i. Thanks for all your help!
Set
i cows / cowone, cowtwo, cowthree / ;
Parameters
a(i) net present value of cow i in cases
/ cowone 500
cowtwo 400
cowthree 450 /
b(i) yield of cow i in cases
/ cowone 10000
cowtwo 8000
cowthree 9000 /
c(i) SCC of cow i in cases
/ cowone 5900000
cowtwo 3500000
cowthree 2500000 /
d(i) Cull vlaue of cow i in cases
/ cowone 100
cowtwo 90
cowthree 80 /;
Variables
vc(i) Value of cow i if culled in all cases
vr(i) Value of cow i if retained in all cases
*this is an attempt at a binary constraint
z total net present value ;
Equations
NPV define objective function
SCC(i) SCC for all cows i
Yield(i) milk for all cows i
Mix(i) mix in bulk tank;
NPV .. z =e= sum(i, (a(i)*vr(i))+ (d(i)*vc(i)));
SCC(i) .. sum(i, vr(i)*c(i)) =E= "SCC";
Yield(i) .. sum(i, vr(i)*b(i)) =E= "Yield";
Mix(i) .. "SCC"/"Yield" =l= 400;
Value .. sum(i, vc(i)+vr(i)) =E= 1;
Model dairy /all/ ;
Solve dairy using nlp maximizing z ;
Display y.l, y.m ;

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
Re: set already under control
you have defined SCC(i) as an equation, then what do you mean by "SCC" ?
On Sat, Nov 21, 2015 at 7:55 AM, Jason Troendle wrote:
I am new to gams (so probably a stupid question) and trying to set up a model with the main error being "set is already under control". I can easily create the model in excel, but can't here. Here is the following code that I am trying to use to solve whether or not to keep or cull a cow to reach a specific threshold. All the values need to be summed over all cows i. Thanks for all your help!
Set
i cows / cowone, cowtwo, cowthree / ;
Parameters
a(i) net present value of cow i in cases
/ cowone 500
cowtwo 400
cowthree 450 /
b(i) yield of cow i in cases
/ cowone 10000
cowtwo 8000
cowthree 9000 /
c(i) SCC of cow i in cases
/ cowone 5900000
cowtwo 3500000
cowthree 2500000 /
d(i) Cull vlaue of cow i in cases
/ cowone 100
cowtwo 90
cowthree 80 /;
Variables
vc(i) Value of cow i if culled in all cases
vr(i) Value of cow i if retained in all cases
*this is an attempt at a binary constraint
z total net present value ;
Equations
NPV define objective function
SCC(i) SCC for all cows i
Yield(i) milk for all cows i
Mix(i) mix in bulk tank;
NPV .. z =e= sum(i, (a(i)*vr(i))+ (d(i)*vc(i)));
SCC(i) .. sum(i, vr(i)*c(i)) =E= "SCC";
Yield(i) .. sum(i, vr(i)*b(i)) =E= "Yield";
Mix(i) .. "SCC"/"Yield" =l= 400;
Value .. sum(i, vc(i)+vr(i)) =E= 1;
Model dairy /all/ ;
Solve dairy using nlp maximizing z ;
Display y.l, y.m ;

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

Partha Das
Junior Research Fellow MNRE, MNIT Jaipur
+91 8239 375 906  partha67@gmail.com  Skype: daspartha22  Center for Energy and Environment, MNIT Jaipur, â€‹Rajasthan (India)  302017

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
Re: set already under control
hi Jason
you defined your equation over i and then sum over i. the equation should be without index i
cheers
renger
sent from my iPad
On 21 Nov 2015, at 11:10, Jason Troendle wrote:
> I am new to gams (so probably a stupid question) and trying to set up a model with the main error being "set is already under control". I can easily create the model in excel, but can't here. Here is the following code that I am trying to use to solve whether or not to keep or cull a cow to reach a specific threshold. All the values need to be summed over all cows i. Thanks for all your help!
>
> Set
> i cows / cowone, cowtwo, cowthree / ;
>
> Parameters
>
> a(i) net present value of cow i in cases
> / cowone 500
> cowtwo 400
> cowthree 450 /
>
> b(i) yield of cow i in cases
> / cowone 10000
> cowtwo 8000
> cowthree 9000 /
>
> c(i) SCC of cow i in cases
> / cowone 5900000
> cowtwo 3500000
> cowthree 2500000 /
>
> d(i) Cull vlaue of cow i in cases
> / cowone 100
> cowtwo 90
> cowthree 80 /;
>
>
> Variables
> vc(i) Value of cow i if culled in all cases
> vr(i) Value of cow i if retained in all cases
> *this is an attempt at a binary constraint
> z total net present value ;
>
> Equations
> NPV define objective function
> SCC(i) SCC for all cows i
> Yield(i) milk for all cows i
> Mix(i) mix in bulk tank;
>
> NPV .. z =e= sum(i, (a(i)*vr(i))+ (d(i)*vc(i)));
>
> SCC(i) .. sum(i, vr(i)*c(i)) =E= "SCC";
>
> Yield(i) .. sum(i, vr(i)*b(i)) =E= "Yield";
>
> Mix(i) .. "SCC"/"Yield" =l= 400;
>
> Value .. sum(i, vc(i)+vr(i)) =E= 1;
>
> Model dairy /all/ ;
>
> Solve dairy using nlp maximizing z ;
>
> Display y.l, y.m ;
>
> 
> To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
> To post to this group, send email to gamsworld@googlegroups.com.
> Visit this group at http://groups.google.com/group/gamsworld.
> For more options, visit https://groups.google.com/d/optout.

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

 User
 Posts: 1
 Joined: 1 month ago
Re: set already under control
Such a really nice post This is good for me Thank you!!
skype for iphone
skype for iphone
Who is online
Users browsing this forum: No registered users and 2 guests