[AMPL 16085] computing euclidean distance of two points using their set of coordinates

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

[AMPL 16085] computing euclidean distance of two points using their set of coordinates

Nasiru Abdullahi
Hello Sirs;

If I have two sets , set of sources and set of destination, and each source has a pair of x and y coordinates, like wise the destination, each has a pair of x and y coordinates. see the attached document which is the mathematical representation of the euclidean distance.

how do I computes the distance in ampl given the set of coordinates of the sources and destinations ?

Thanks
Nasir A.

--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.

Euclidean distance.docx (18K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [AMPL 16088] computing euclidean distance of two points using their set of coordinates

AMPL mailing list
You need a param for x and y
Below is an example:
param n:=2;

param xa{1..n};
param ya{1..n};
param xb{1..n};
param yb{1..n};
param d{i in 1..n} := sqrt( ((xa[i]-xb[i])^2+(ya[i]-yb[i])^2) );

data;

param xa:= 1 1 2 2;
param ya := 1 3 2 4;
param xb := 1 4 2 5;
param yb := 1 6 2 7;




--
Paras Tiwari
[hidden email]
{#HS:554625591-4464#}
On Wed, Apr 4, 2018 at 3:50 PM UTC, <[hidden email]> wrote:
Hello Sirs;

If I have two sets , set of sources and set of destination, and each source has a pair of x and y coordinates, like wise the destination, each has a pair of x and y coordinates. see the attached document which is the mathematical representation of the euclidean distance.

how do I computes the distance in ampl given the set of coordinates of the sources and destinations ?

Thanks
Nasir A.
--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.



--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [AMPL 16091] computing euclidean distance of two points using their set of coordinates

Nasiru Abdullahi
thanks, it realy works

On Wed, 4 Apr 2018 18:51 AMPL Google Group, <[hidden email]> wrote:
You need a param for x and y
Below is an example:
param n:=2;

param xa{1..n};
param ya{1..n};
param xb{1..n};
param yb{1..n};
param d{i in 1..n} := sqrt( ((xa[i]-xb[i])^2+(ya[i]-yb[i])^2) );

data;

param xa:= 1 1 2 2;
param ya := 1 3 2 4;
param xb := 1 4 2 5;
param yb := 1 6 2 7;




--
Paras Tiwari
[hidden email]
{#HS:554625591-4464#}
On Wed, Apr 4, 2018 at 3:50 PM UTC, <[hidden email]> wrote:
Hello Sirs;

If I have two sets , set of sources and set of destination, and each source has a pair of x and y coordinates, like wise the destination, each has a pair of x and y coordinates. see the attached document which is the mathematical representation of the euclidean distance.

how do I computes the distance in ampl given the set of coordinates of the sources and destinations ?

Thanks
Nasir A.
--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.



--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [AMPL 16138] computing euclidean distance of two points using their set of coordinates

Nasiru Abdullahi
Good day sirs,
How do I define the euclidean distance having two subscripts , I.e. a pair, one from set plants and the second from city, each of plants and city have pairs of coordinates ?
Thanks
Nasir Abdullahi

On Wed, 4 Apr 2018 20:08 Nasiru Abdullahi, <[hidden email]> wrote:
thanks, it realy works

On Wed, 4 Apr 2018 18:51 AMPL Google Group, <[hidden email]> wrote:
You need a param for x and y
Below is an example:
param n:=2;

param xa{1..n};
param ya{1..n};
param xb{1..n};
param yb{1..n};
param d{i in 1..n} := sqrt( ((xa[i]-xb[i])^2+(ya[i]-yb[i])^2) );

data;

param xa:= 1 1 2 2;
param ya := 1 3 2 4;
param xb := 1 4 2 5;
param yb := 1 6 2 7;




--
Paras Tiwari
[hidden email]
{#HS:554625591-4464#}
On Wed, Apr 4, 2018 at 3:50 PM UTC, <[hidden email]> wrote:
Hello Sirs;

If I have two sets , set of sources and set of destination, and each source has a pair of x and y coordinates, like wise the destination, each has a pair of x and y coordinates. see the attached document which is the mathematical representation of the euclidean distance.

how do I computes the distance in ampl given the set of coordinates of the sources and destinations ?

Thanks
Nasir A.
--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.



--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [AMPL 16141] computing euclidean distance of two points using their set of coordinates

AMPL mailing list
You can define a two dimensional set for plants and city and define a param over plants and city as follows:

set plants dimen 2;
set city dimen 2;
set distance{plants,city};

However, it's not clear to me how you are calculating the distance.

--
Paras Tiwari
[hidden email]
{#HS:554625591-4464#}
On Tue, Apr 10, 2018 at 10:56 PM UTC, Zeyad Kassem' Via Ampl Modeling Language <[hidden email]> wrote:
Good day sirs,
How do I define the euclidean distance having two subscripts , I.e. a pair, one from set plants and the second from city, each of plants and city have pairs of coordinates ?
Thanks
Nasir Abdullahi



On Wed, Apr 4, 2018 at 10:35 PM UTC, Zeyad Kassem' Via Ampl Modeling Language <[hidden email]> wrote:
thanks, it realy works



On Wed, Apr 4, 2018 at 5:50 PM UTC, AMPL Google Group <[hidden email]> wrote:
You need a param for x and y
Below is an example:
param n:=2;

param xa{1..n};
param ya{1..n};
param xb{1..n};
param yb{1..n};
param d{i in 1..n} := sqrt( ((xa[i]-xb[i])^2+(ya[i]-yb[i])^2) );

data;

param xa:= 1 1 2 2;
param ya := 1 3 2 4;
param xb := 1 4 2 5;
param yb := 1 6 2 7;




--
Paras Tiwari
[hidden email]


On Wed, Apr 4, 2018 at 3:50 PM UTC, Zeyad Kassem' Via Ampl Modeling Language <[hidden email]> wrote:
Hello Sirs;

If I have two sets , set of sources and set of destination, and each source has a pair of x and y coordinates, like wise the destination, each has a pair of x and y coordinates. see the attached document which is the mathematical representation of the euclidean distance.

how do I computes the distance in ampl given the set of coordinates of the sources and destinations ?

Thanks
Nasir A.
--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.



--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [AMPL 16143] computing euclidean distance of two points using their set of coordinates

Nasiru Abdullahi
On 4/11/18, Nasiru Abdullahi <[hidden email]> wrote:

> Thanks;
> This is how I want to calculate the distance..see the attached
> mathematical expression.
> the two sets has pairs of coordinates, for each "X" and "Y"
>
> In otherwords, each set "plants" has pairs x and y coordinates, like
> wise for each set "city" has pairs x and y coordinates
>
> how to write a computed parameter of the distance formula using these
> sets and how to to write the data for these sets
>
> Thanks
> I appreciates
> Nasir A.
>
>
>
> On 4/11/18, AMPL Google Group <[hidden email]> wrote:
>> -- Please reply above this line --
>>
>>
>> You can define a two dimensional set for plants and city and define a
>> param over plants and city as follows:
>>
>> set plants dimen 2;
>>  set city dimen 2;
>>  set distance{plants,city};
>>
>> However, it's not clear to me how you are calculating the distance.
>> --
>> Paras Tiwari
>> [hidden email]
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>> On Tue, Apr 10, 2018 at 10:56 PM UTC, Zeyad Kassem' Via Ampl Modeling
>>> Language &lt;[hidden email]&gt; wrote:
>>>
>>> Good day sirs,
>>> How do I define the euclidean distance having two subscripts , I.e. a
>>> pair, one from set plants and the second from city, each of plants and
>>> city have pairs of coordinates ?
>>> Thanks
>>> Nasir Abdullahi
>>>
>>>
>>>> On Wed, Apr 4, 2018 at 10:35 PM UTC, Zeyad Kassem' Via Ampl Modeling
>>>> Language &lt;[hidden email]&gt; wrote:
>>>>
>>>> thanks, it realy works
>>>>
>>>>
>>>>> On Wed, Apr 4, 2018 at 5:50 PM UTC, AMPL Google Group
>>>>> &lt;[hidden email]&gt; wrote:
>>>>>
>>>>> You need a param for x and y
>>>>> Below is an example:
>>>>> param n:=2;
>>>>>
>>>>> param xa{1..n};
>>>>> param ya{1..n};
>>>>> param xb{1..n};
>>>>> param yb{1..n};
>>>>> param d{i in 1..n} := sqrt( ((xa[i]-xb[i])^2+(ya[i]-yb[i])^2) );
>>>>>
>>>>> data;
>>>>>
>>>>> param xa:= 1 1 2 2;
>>>>> param ya := 1 3 2 4;
>>>>> param xb := 1 4 2 5;
>>>>> param yb := 1 6 2 7;
>>>>>
>>>>>
>>>>> --
>>>>> Paras Tiwari
>>>>> [hidden email]
>>>>>
>>>>>
>>>>>
>>>>>> On Wed, Apr 4, 2018 at 3:50 PM UTC, Zeyad Kassem' Via Ampl Modeling
>>>>>> Language &lt;[hidden email]&gt; wrote:
>>>>>>
>>>>>> Hello Sirs;
>>>>>> If I have two sets , set of sources and set of destination, and each
>>>>>> source has a pair of x and y coordinates, like wise the destination,
>>>>>> each has a pair of x and y coordinates. see the attached document
>>>>>> which is the mathematical representation of the euclidean distance.
>>>>>> how do I computes the distance in ampl given the set of coordinates
>>>>>> of the sources and destinations ?
>>>>>> Thanks Nasir A.  --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "AMPL Modeling Language" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to [hidden email] [1].
>>>>>> To post to this group, send email to [hidden email] [2].
>>>>>> Visit this group at https://groups.google.com/group/ampl [3].
>>>>>> For more options, visit https://groups.google.com/d/optout [4].
>>>>>>
>>>>>>
>>>>>> Links:
>>>>>> ------
>>>>>> [1] mailto:[hidden email]
>>>>>> [2] mailto:[hidden email]
>>>>>> [3] https://groups.google.com/group/ampl
>>>>>> [4] https://groups.google.com/d/optout
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "AMPL Modeling Language" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [hidden email].
>> To post to this group, send email to [hidden email].
>> Visit this group at https://groups.google.com/group/ampl.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.

Euclidean distance.docx (19K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [AMPL 16148] computing euclidean distance of two points using their set of coordinates

AMPL mailing list
One possibility would be to define "set A; set B;" (sets of origins and destinations) and then "param xA {A}; param yA {A};" (x and y coordinates of origins) and "param xB {B}; param yB {B};" (x and y coordinates of destinations. Then you could write the formula for "param dist {a in A, b in B} = . . .". The data for A, xA, yA can be combined in a single data statement, and similarly for B, xB, yB.

Thanks
Paras

--
Paras Tiwari
[hidden email]
{#HS:554625591-4464#}
On Wed, Apr 11, 2018 at 12:42 PM UTC, Zeyad Kassem' Via Ampl Modeling Language <[hidden email]> wrote:



On Wed, Apr 11, 2018 at 12:17 AM UTC, AMPL Google Group <[hidden email]> wrote:
You can define a two dimensional set for plants and city and define a param over plants and city as follows:

set plants dimen 2;
set city dimen 2;
set distance{plants,city};

However, it's not clear to me how you are calculating the distance.

--
Paras Tiwari
[hidden email]


On Tue, Apr 10, 2018 at 10:56 PM UTC, Zeyad Kassem' Via Ampl Modeling Language <[hidden email]> wrote:
Good day sirs,
How do I define the euclidean distance having two subscripts , I.e. a pair, one from set plants and the second from city, each of plants and city have pairs of coordinates ?
Thanks
Nasir Abdullahi



On Wed, Apr 4, 2018 at 10:35 PM UTC, Zeyad Kassem' Via Ampl Modeling Language <[hidden email]> wrote:
thanks, it realy works



On Wed, Apr 4, 2018 at 5:50 PM UTC, AMPL Google Group <[hidden email]> wrote:
You need a param for x and y
Below is an example:
param n:=2;

param xa{1..n};
param ya{1..n};
param xb{1..n};
param yb{1..n};
param d{i in 1..n} := sqrt( ((xa[i]-xb[i])^2+(ya[i]-yb[i])^2) );

data;

param xa:= 1 1 2 2;
param ya := 1 3 2 4;
param xb := 1 4 2 5;
param yb := 1 6 2 7;




--
Paras Tiwari
[hidden email]


--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.