[AMPL 2074] Problem with generating constraints subjected to a condition

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[AMPL 2074] Problem with generating constraints subjected to a condition

Ashu-7

Hi,

I am generating multiple constraints using the following statement

subject to synd_constrt1 {i in FLTS, p in FLTS: p <> i && p > i}: sum
{j in VECS} vect[j] * abs(detection[i,j] - detection[p,j]) >= 1;

Here,
vect -> variables
detection -> parameters

I want to incorporate a condition in this statement so that a
constraint is generated only when that condition is met.
The condition is,
sum {j in VECS} abs(detection[i,j] - detection[p,j]) > 0

I am not able figure out a way to do this. Any help here is
appreciated.

Thanks and regards,
Ashfaq

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/ampl?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

[AMPL 2076] Re: Problem with generating constraints subjected to a condition

Paul A. Rubin



On Nov 9, 5:25 pm, Ashu <[hidden email]> wrote:
>
> I am generating multiple constraints using the following statement
>
> subject to synd_constrt1 {i in FLTS, p in FLTS: p <> i && p > i}: sum
> {j in VECS} vect[j] * abs(detection[i,j] - detection[p,j]) >= 1;

Note here that, while harmless, p <> i is redundant given p > i.

>
> Here,
> vect -> variables
> detection -> parameters
>
> I want to incorporate a condition in this statement so that a
> constraint is generated only when that condition is met.
> The condition is,
> sum {j in VECS} abs(detection[i,j] - detection[p,j]) > 0
>
> I am not able figure out a way to do this. Any help here is
> appreciated.

subject to synd_constrt1 {i in FLTS, p in FLTS: p > i && sum {j in
VECS} abs(detection[i,j] - detection[p,j]) > 0}: sum
 {j in VECS} vect[j] * abs(detection[i,j] - detection[p,j]) >= 1;


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/ampl?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

[AMPL 2077] Re: Problem with generating constraints subjected to a condition

Ashu-7

Paul,

Thanks a lot for helping me out here.

Regards,
Ashfaq

On Nov 10, 9:52 am, Paul <[hidden email]> wrote:

> On Nov 9, 5:25 pm, Ashu <[hidden email]> wrote:
>
>
>
> > I am generating multiple constraints using the following statement
>
> > subject to synd_constrt1 {i in FLTS, p in FLTS: p <> i && p > i}: sum
> > {j in VECS} vect[j] * abs(detection[i,j] - detection[p,j]) >= 1;
>
> Note here that, while harmless, p <> i is redundant given p > i.
>
>
>
> > Here,
> > vect -> variables
> > detection -> parameters
>
> > I want to incorporate a condition in this statement so that a
> > constraint is generated only when that condition is met.
> > The condition is,
> > sum {j in VECS} abs(detection[i,j] - detection[p,j]) > 0
>
> > I am not able figure out a way to do this. Any help here is
> > appreciated.
>
> subject to synd_constrt1 {i in FLTS, p in FLTS: p > i && sum {j in
> VECS} abs(detection[i,j] - detection[p,j]) > 0}: sum
>  {j in VECS} vect[j] * abs(detection[i,j] - detection[p,j]) >= 1;

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/ampl?hl=en
-~----------~----~----~----~------~----~------~--~---