Dear Prateek,
What is your problem statement? What is your objective?
In the previous code, since the objective value is set at 1, the variables become zero.
On Sun, Jan 4, 2015 at 4:15 PM, Prateek Mittal wrote:
Dear Karimi,
Wish you a happy new year !!
Thank you for a kind reply, I have modified the code in a way you suggested, but it is showing all the values of X and Y as zero. Can you please help me I have also tried the following lines for a solver
sets i /1*20/;
alias(i,j);
variables x(i), y(i),dist(i,j),z,maxdist;
x.lo(i) = 0;x.up(i) = 500;
y.lo(i) = 0;y.up(i) =500;
equations obj,eq1,eq2(i,j),eq3(i,j);
obj … z =e= 1;
eq1 … 3*52 -maxdist =l= 0;
eq2(i,j)…dist(i,j)=e= sqrt( power((x(i) - x(j)),2) + power((y(i) - y(j)),2) );
eq3(i,j)…dist(i,j)=l=maxdist;
model eucledian /ALL/;
$onecho >bench.opt
solvers conopt knitro minos snopt
$offecho
eucledian.optfile = 1;
option nlp=bench
solve eucledian using NLP minimizing z;
display x.l,y.l;
On Mon, Dec 29, 2014 at 2:46 PM, Prateek Mittal wrote:
Dear Karimi,
Thank you so much for the reply,
no X and Y are decision variables
On Monday, December 29, 2014 3:38:53 PM UTC+5:30, hossein karimi wrote:
Dear Prateek
Do you have the vectors of X and Y?
It is simple, if they are not decision variables.
On 12/29/14, Prateek Mittal wrote:
Dear,
I am new to GAMS, I need your help to solve this simple model of eucledian
distance
I want to determine an euclidean distance between two location coordinates
say x and y, where both varies from 0 to 500m, later on determine the
maximum value of distance among all.
here is my GAMS code
GAMS : eucledian.gms
sets i /120/
j /120/
variables x(i), y(i),dist(i,j),z;
x.lo(i) = 0;x.up(i) = 500;
y.lo(i) = 0;y.up(i) =500;
loop (i,
loop(j,
dist(i,j)= sqrt( power((x(i) - x(j)),2) + power((y(i) - y(j)),2)
);
);
);
equations obj,eq1;
obj … z =e= 1;
*set a virtual objective
eq1 … 3*52 - smax((i,j),dist(i,j) =l= 0;
model eucledian /ALL/;
solve eucledian using NLP minimizing z;
Error am getting in dist(i,j) … line, it is showing suffix is missing,
or if there is any other error in syntax please help me
Thank you so much for your kind help
Prateek
Research Scholar
–
“gamsworld” group.
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 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.