Excluding Zeroes
Excluding Zeroes
Dear all.
I have an equation which looks like this:
eq1.. R=E= a(i)/b(i);
And an objective function:
obj.. z =E= sum(i, a(i)/b(i));
Is there a way to sum only the terms with b(i) not equal to zero? I tried using conditionals on the R equation, but when I try to run I get an
***Error 52 Endogenous $-control not allowed.
Any help is appreciated.
Tks
Bruno
--
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 https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
RE: Excluding Zeroes
Hi Bruno
You could define a third variable m(i) and an equation eq_m(i):
Eq_m(i).. m(i)*b(i) =E= a(i);
Obj.. z= E= sum(I, m(i));
Cheers
Renger
From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of Bruno Hannud
Sent: Samstag, 6. Februar 2016 00:19
To: gamsworld
Subject: Excluding Zeroes
Dear all.
I have an equation which looks like this:
eq1.. R=E= a(i)/b(i);
And an objective function:
obj.. z =E= sum(i, a(i)/b(i));
Is there a way to sum only the terms with b(i) not equal to zero? I tried using conditionals on the R equation, but when I try to run I get an
***Error 52 Endogenous $-control not allowed.
Any help is appreciated.
Tks
Bruno
--
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 https://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 https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
Re: Excluding Zeroes
Tks a lot for your reply Renger.
I have a query. If b(i)=0, isn't m(i) undefined? Or will GAMS automatically attribute the value zero to m(i)?
Rgds
Bruno
On Sunday, February 7, 2016 at 6:59:10 PM UTC-2, Renger van Nieuwkoop wrote:
Hi Bruno
You could define a third variable m(i) and an equation eq_m(i):
Eq_m(i).. m(i)*b(i) =E= a(i);
Obj.. z= E= sum(I, m(i));
Cheers
Renger
From: gams...@googlegroups.com [mailto:gams...@googlegroups.com] On Behalf Of Bruno Hannud
Sent: Samstag, 6. Februar 2016 00:19
To: gamsworld
Subject: Excluding Zeroes
Dear all.
I have an equation which looks like this:
eq1.. R=E= a(i)/b(i);
And an objective function:
obj.. z =E= sum(i, a(i)/b(i));
Is there a way to sum only the terms with b(i) not equal to zero? I tried using conditionals on the R equation, but when I try to run I get an
***Error 52 Endogenous $-control not allowed.
Any help is appreciated.
Tks
Bruno
--
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at https://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 https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
Re: Excluding Zeroes
Renger, I think I made a mistake.
If b(i)=0, the equation might be undefined (if a(i)=0) or will have no solution (if a(i) 0).
Rgds
Bruno
On Sunday, February 7, 2016 at 6:59:10 PM UTC-2, Renger van Nieuwkoop wrote:
Hi Bruno
You could define a third variable m(i) and an equation eq_m(i):
Eq_m(i).. m(i)*b(i) =E= a(i);
Obj.. z= E= sum(I, m(i));
Cheers
Renger
From: gams...@googlegroups.com [mailto:gams...@googlegroups.com] On Behalf Of Bruno Hannud
Sent: Samstag, 6. Februar 2016 00:19
To: gamsworld
Subject: Excluding Zeroes
Dear all.
I have an equation which looks like this:
eq1.. R=E= a(i)/b(i);
And an objective function:
obj.. z =E= sum(i, a(i)/b(i));
Is there a way to sum only the terms with b(i) not equal to zero? I tried using conditionals on the R equation, but when I try to run I get an
***Error 52 Endogenous $-control not allowed.
Any help is appreciated.
Tks
Bruno
--
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at https://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 https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
Re: Excluding Zeroes
Hi Bruno: You need to think what values of b are allowed (feasible). If you are asking for a(i)/b(i) to be equal to a scalar (R), then b cannot be zero for any index. If the solver takes you there, you can use a small artificial bound (b.lo(i) =1E-6).
If you want different equations in the model according to the value of variables (if b=0 is allowed, and eq1 doesn't apply to those indexes ) , that is called "disjunctive programming", look it up.
Best regards!
Claudio
El 07/02/2016 16:38, "Bruno Hannud" escribió:
Dear all.
I have an equation which looks like this:
eq1.. R=E= a(i)/b(i);
And an objective function:
obj.. z =E= sum(i, a(i)/b(i));
Is there a way to sum only the terms with b(i) not equal to zero? I tried using conditionals on the R equation, but when I try to run I get an
***Error 52 Endogenous $-control not allowed.
Any help is appreciated.
Tks
Bruno
--
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 https://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 https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
Re: Excluding Zeroes
Thanks Claudio.
Sent with Unibox
> On Feb 14, 2016, at 8:11 PM, Claudio Delpino wrote:
>
> Hi Bruno: You need to think what values of b are allowed (feasible). If you are asking for a(i)/b(i) to be equal to a scalar (R), then b cannot be zero for any index. If the solver takes you there, you can use a small artificial bound (b.lo(i) =1E-6).
>
> If you want different equations in the model according to the value of variables (if b=0 is allowed, and eq1 doesn't apply to those indexes ) , that is called "disjunctive programming", look it up.
>
> Best regards!
> Claudio
> El 07/02/2016 16:38, "Bruno Hannud" escribió:
>
> Dear all.
>
> I have an equation which looks like this:
>
> eq1.. R=E= a(i)/b(i);
>
> And an objective function:
>
> obj.. z =E= sum(i, a(i)/b(i));
>
> Is there a way to sum only the terms with b(i) not equal to zero? I tried using conditionals on the R equation, but when I try to run I get an
>
> ***Error 52 Endogenous $-control not allowed.
>
> Any help is appreciated.
>
> Tks
>
> Bruno
>
> --
> 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 https://groups.google.com/group/gamsworld.
> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to a topic in the Google Groups "gamsworld" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/gamsw ... nsubscribe.
> To unsubscribe from this group and all its topics, send an email to gamsworld+unsubscribe@googlegroups.com.
> To post to this group, send email to gamsworld@googlegroups.com.
> Visit this group at https://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 https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
Re: Excluding Zeroes
Dear Claudio, in my model, if b(i)=0, I attribute a(i)/b(i) = 0, otherwise, the answer is the normal one. Does this still classify in disjunctive programming?
Thanks.
Bruno
Sent with Unibox
> On Feb 14, 2016, at 8:11 PM, Claudio Delpino wrote:
>
> Hi Bruno: You need to think what values of b are allowed (feasible). If you are asking for a(i)/b(i) to be equal to a scalar (R), then b cannot be zero for any index. If the solver takes you there, you can use a small artificial bound (b.lo(i) =1E-6).
>
> If you want different equations in the model according to the value of variables (if b=0 is allowed, and eq1 doesn't apply to those indexes ) , that is called "disjunctive programming", look it up.
>
> Best regards!
> Claudio
> El 07/02/2016 16:38, "Bruno Hannud" escribió:
>
> Dear all.
>
> I have an equation which looks like this:
>
> eq1.. R=E= a(i)/b(i);
>
> And an objective function:
>
> obj.. z =E= sum(i, a(i)/b(i));
>
> Is there a way to sum only the terms with b(i) not equal to zero? I tried using conditionals on the R equation, but when I try to run I get an
>
> ***Error 52 Endogenous $-control not allowed.
>
> Any help is appreciated.
>
> Tks
>
> Bruno
>
> --
> 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 https://groups.google.com/group/gamsworld.
> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to a topic in the Google Groups "gamsworld" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/gamsw ... nsubscribe.
> To unsubscribe from this group and all its topics, send an email to gamsworld+unsubscribe@googlegroups.com.
> To post to this group, send email to gamsworld@googlegroups.com.
> Visit this group at https://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 https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
Re: Excluding Zeroes
Bruno: I'm not an expert on that approach, someone else around here can help you better, but:
Is b(i) a parameter or a variable ?
If it is a variable: I read from your last mail that b(i)=0 => a(i)=0. If that's the case, I guess you'll be fine (if the model is not large) introducing binary variables and use something like a "big M" formulation. Like I said before, I'm not an expert. If I remember correctly, EMP has some facilities for that kind of reformulations, so perhaps lloking through its manual will give you some ideas.
Best Regards
Claudio
On Mon, Feb 15, 2016 at 7:26 AM, Bruno Hannud wrote:
Dear Claudio, in my model, if b(i)=0, I attribute a(i)/b(i) = 0, otherwise, the answer is the normal one. Does this still classify in disjunctive programming?
Thanks.
Bruno
Sent with Unibox
> On Feb 14, 2016, at 8:11 PM, Claudio Delpino wrote:
>
> Hi Bruno: You need to think what values of b are allowed (feasible). If you are asking for a(i)/b(i) to be equal to a scalar (R), then b cannot be zero for any index. If the solver takes you there, you can use a small artificial bound (b.lo(i) =1E-6).
>
> If you want different equations in the model according to the value of variables (if b=0 is allowed, and eq1 doesn't apply to those indexes ) , that is called "disjunctive programming", look it up.
>
> Best regards!
> Claudio
> El 07/02/2016 16:38, "Bruno Hannud" escribió:
>
> Dear all.
>
> I have an equation which looks like this:
>
> eq1.. R=E= a(i)/b(i);
>
> And an objective function:
>
> obj.. z =E= sum(i, a(i)/b(i));
>
> Is there a way to sum only the terms with b(i) not equal to zero? I tried using conditionals on the R equation, but when I try to run I get an
>
> ***Error 52 Endogenous $-control not allowed.
>
> Any help is appreciated.
>
> Tks
>
> Bruno
>
> --
> 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 https://groups.google.com/group/gamsworld.
> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to a topic in the Google Groups "gamsworld" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/gamsw ... nsubscribe.
> To unsubscribe from this group and all its topics, send an email to gamsworld+unsubscribe@googlegroups.com.
> To post to this group, send email to gamsworld@googlegroups.com.
> Visit this group at https://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 https://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 https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
Re: Excluding Zeroes
Claudio thanks for your answer. In my problem:
b(i) is a variable.
If b(i) = 0, a(i) is not necessarily zero, but I must impose that a(i)/b(i) =0
meaning that in the case b(i)=0, we exlude these values of a(i)/b(i) from the sum(i, a(i)/b(i)).
Bruno
Sent with Unibox
> On Feb 15, 2016, at 1:07 PM, Claudio Delpino wrote:
>
> Bruno: I'm not an expert on that approach, someone else around here can help you better, but:
>
> Is b(i) a parameter or a variable ?
>
> If it is a variable: I read from your last mail that b(i)=0 => a(i)=0. If that's the case, I guess you'll be fine (if the model is not large) introducing binary variables and use something like a "big M" formulation. Like I said before, I'm not an expert. If I remember correctly, EMP has some facilities for that kind of reformulations, so perhaps lloking through its manual will give you some ideas.
>
> Best Regards
> Claudio
>
> On Mon, Feb 15, 2016 at 7:26 AM, Bruno Hannud wrote:
>
> Dear Claudio, in my model, if b(i)=0, I attribute a(i)/b(i) = 0, otherwise, the answer is the normal one. Does this still classify in disjunctive programming?
>
> Thanks.
>
> Bruno
>
>
> Sent with Unibox
>
>> On Feb 14, 2016, at 8:11 PM, Claudio Delpino wrote:
>>
>> Hi Bruno: You need to think what values of b are allowed (feasible). If you are asking for a(i)/b(i) to be equal to a scalar (R), then b cannot be zero for any index. If the solver takes you there, you can use a small artificial bound (b.lo(i) =1E-6).
>>
>> If you want different equations in the model according to the value of variables (if b=0 is allowed, and eq1 doesn't apply to those indexes ) , that is called "disjunctive programming", look it up.
>>
>> Best regards!
>> Claudio
>> El 07/02/2016 16:38, "Bruno Hannud" escribió:
>>
>> Dear all.
>>
>> I have an equation which looks like this:
>>
>> eq1.. R=E= a(i)/b(i);
>>
>> And an objective function:
>>
>> obj.. z =E= sum(i, a(i)/b(i));
>>
>> Is there a way to sum only the terms with b(i) not equal to zero? I tried using conditionals on the R equation, but when I try to run I get an
>>
>> ***Error 52 Endogenous $-control not allowed.
>>
>> Any help is appreciated.
>>
>> Tks
>>
>> Bruno
>>
>> --
>> 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 https://groups.google.com/group/gamsworld.
>> For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> You received this message because you are subscribed to a topic in the Google Groups "gamsworld" group.
>> To unsubscribe from this topic, visit https://groups.google.com/d/topic/gamsw ... nsubscribe.
>> To unsubscribe from this group and all its topics, send an email to gamsworld+unsubscribe@googlegroups.com.
>> To post to this group, send email to gamsworld@googlegroups.com.
>> Visit this group at https://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 https://groups.google.com/group/gamsworld.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to a topic in the Google Groups "gamsworld" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/gamsw ... nsubscribe.
> To unsubscribe from this group and all its topics, send an email to gamsworld+unsubscribe@googlegroups.com.
> To post to this group, send email to gamsworld@googlegroups.com.
> Visit this group at https://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 https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.