Hi,

I was trying a Max Min problem and was wondering if anyone could help

me out.

Scenario: consider a 2-D point say X to be found out by optimization.

I have a set of say 100 points which i already know.

The objective is to find the minimum distance between X and all the

100 other points and then in the end maximize this distance.

For the above i write the following OBJ equation.

set n/1*100/;*

set d/12/;

…

…

…

…

variable x(d);

OBJ… Z=l= sqrt ( sqr(x(‘1’)-tp(n,‘1’) ) + sqr(x(‘2’)-

tp(n,‘2’) );

model value/All/

solve value maximizing Z using NLP;

Note: x is a variable to be found out.

tp is the array of 100 numbers i.e. table tp(n,d)

The problem that i am facing is that i am unable to control the value

of ‘n’ in the equation OBJ. How do i run the value of ‘n’ from 1 to

100 in the equation.

I tried the following

OBJ(n)… Z=l= sqrt ( sqr(x(‘1’)-tp(n,‘1’) ) + sqr(x(‘2’)-

tp(n,‘2’) );

and it worked , but i do not want to follow this method.

Is there any other method how i can control the value of n in the

equation. GAMS does not allow me to use LOOPS inside equations. Any

help will be appreciated.

Sumit

–~–~---------~–~----~------------~-------~–~----~

To post to this group, send email to gamsworld@googlegroups.com

To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com

For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en

-~----------~----~----~----~------~----~------~–~—

\

Hi,

Thanks for the prompt reply. Yes what you have said is correct i am

actually looking for an alternative method.

I do not want to create ‘n’ OBJ equations. I want just one OBJ eqn and

then control the value of ‘n’ inside this eqn…

If i put OBJ(n)… it means that i have

OBJ(1)…

OBJ(2)…

…

…

OBJ(n)…

but i dont want this, i want just one OBJ… and then i want to control

‘n’ inside this equation.So essentially i am looking out for an

alternative.

Regards

Sumit

On Sep 14, 3:50 am, “Arne Stolbjerg Drud” wrote:

I do not understand your problem. You essentially say: “I have a method that

works, but I do not want to use it. Please suggest an alternative.”

The method you suggest and that works is in my mind the way to do it.

Regards

Arne Stolbjerg Drud

Arne Stolbjerg Drud

ARKI Consulting & Development A/S

Bagsvaerdvej 246A, DK-2880 Bagsvaerd, Denmark

Phone: (+45) 44 49 03 23, Fax: (+45) 44 49 03 33, email: ad…@arki.dk

-----Oprindelig meddelelse-----

Fra: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] PÃ¥ vegne

af sskhera

Sendt: 14. september 2008 01:29

Til: gamsworld

Emne: Distance MAX-MIN problem

Hi,

I was trying a Max Min problem and was wondering if anyone could help

me out.

Scenario: consider a 2-D point say X to be found out by optimization.

I have a set of say 100 points which i already know.

The objective is to find the minimum distance between X and all the

100 other points and then in the end maximize this distance.

For the above i write the following OBJ equation.

set n/1*100/;*

set d/12/;

…

…

…

…

variable x(d);

OBJ… Z=l= sqrt ( sqr(x(‘1’)-tp(n,‘1’) ) + sqr(x(‘2’)-

tp(n,‘2’) );

model value/All/

solve value maximizing Z using NLP;

Note: x is a variable to be found out.

tp is the array of 100 numbers i.e. table tp(n,d)

The problem that i am facing is that i am unable to control the value

of ‘n’ in the equation OBJ. How do i run the value of ‘n’ from 1 to

100 in the equation.

I tried the following

OBJ(n)… Z=l= sqrt ( sqr(x(‘1’)-tp(n,‘1’) ) + sqr(x(‘2’)-

tp(n,‘2’) );

and it worked , but i do not want to follow this method.

Is there any other method how i can control the value of n in the

equation. GAMS does not allow me to use LOOPS inside equations. Any

help will be appreciated.

Sumit

–~–~---------~–~----~------------~-------~–~----~

To post to this group, send email to gamsworld@googlegroups.com

To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com

For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en

-~----------~----~----~----~------~----~------~–~—

\

Hi,

Thanks for the reply. Yes i had also tried the same i.e.

OBJ… smin(n,expression in n);

and used the DNLP solver but it showed the error “cannot handle

function min” which stopped me from going ahead this way.

Will the use of external equations help in any way?

Regards,

Sumit

On Sep 15, 12:17 am, “Arne Stolbjerg Drud” wrote:

From a syntax point of view you can write:

OBJ … Z =E= smax(n, expression in n );

However, Smax is a non-differentiable function so you will also have to

change the solve statement to

Solve … using DNLP;

The DNLP solvers we have are trying to solve the model as if it was an NLP

model, ignoring any non-differentiable properties. In your case this means

that the solver probably would get stuck somewhere on the way to an optimal

solution. The non-differentiable property also means, that a locally optimal

solution may not be recognized as locally optimal since there are no

well-defined gradients.

So again I will encourage you to use your original formulation with N

constraints defining the objective.

Regards

Arne Stolbjerg Drud

Arne Stolbjerg Drud

ARKI Consulting & Development A/S

Bagsvaerdvej 246A, DK-2880 Bagsvaerd, Denmark

Phone: (+45) 44 49 03 23, Fax: (+45) 44 49 03 33, email: ad…@arki.dk

-----Oprindelig meddelelse-----

Fra: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] PÃ¥ vegne

af sskhera

Sendt: 14. september 2008 19:21

Til: gamsworld

Emne: Re: Distance MAX-MIN problem

Hi,

Thanks for the prompt reply. Yes what you have said is correct i am

actually looking for an alternative method.

I do not want to create ‘n’ OBJ equations. I want just one OBJ eqn and

then control the value of ‘n’ inside this eqn…

If i put OBJ(n)… it means that i have

OBJ(1)…

OBJ(2)…

…

…

OBJ(n)…

but i dont want this, i want just one OBJ… and then i want to control

‘n’ inside this equation.So essentially i am looking out for an

alternative.

Regards

Sumit

On Sep 14, 3:50 am, “Arne Stolbjerg Drud” wrote:

I do not understand your problem. You essentially say: “I have a method

that

works, but I do not want to use it. Please suggest an alternative.”

The method you suggest and that works is in my mind the way to do it.

Regards

Arne Stolbjerg Drud

Arne Stolbjerg Drud

ARKI Consulting & Development A/S

Bagsvaerdvej 246A, DK-2880 Bagsvaerd, Denmark

Phone: (+45) 44 49 03 23, Fax: (+45) 44 49 03 33, email: ad…@arki.dk

-----Oprindelig meddelelse-----

Fra: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] PÃ¥

vegne

af sskhera

Sendt: 14. september 2008 01:29

Til: gamsworld

Emne: Distance MAX-MIN problem

Hi,

I was trying a Max Min problem and was wondering if anyone could help

me out.

Scenario: consider a 2-D point say X to be found out by optimization.

I have a set of say 100 points which i already know.

The objective is to find the minimum distance between X and all the

100 other points and then in the end maximize this distance.

For the above i write the following OBJ equation.

set n/1*100/;*

set d/12/;

…

…

…

…

variable x(d);

OBJ… Z=l= sqrt ( sqr(x(‘1’)-tp(n,‘1’) ) + sqr(x(‘2’)-

tp(n,‘2’) );

model value/All/

solve value maximizing Z using NLP;

Note: x is a variable to be found out.

tp is the array of 100 numbers i.e. table tp(n,d)

The problem that i am facing is that i am unable to control the value

of ‘n’ in the equation OBJ. How do i run the value of ‘n’ from 1 to

100 in the equation.

I tried the following

OBJ(n)… Z=l= sqrt ( sqr(x(‘1’)-tp(n,‘1’) ) + sqr(x(‘2’)-

tp(n,‘2’) );

and it worked , but i do not want to follow this method.

Is there any other method how i can control the value of n in the

equation. GAMS does not allow me to use LOOPS inside equations. Any

help will be appreciated.

Sumit

–~–~---------~–~----~------------~-------~–~----~

To post to this group, send email to gamsworld@googlegroups.com

To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com

For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en

-~----------~----~----~----~------~----~------~–~—

\