param a{0..1};
param b{0..1};
param c{0..1};
param n;
var x {j in 0..n};
var y {j in 0..n};
var z {j in 0..n};
subject to X {j in 0..n} :
sum {j in 0..n} (x[j]) = a[1] - a[0]; ERROR!!!
subject to Y {j in 0..n} :
sum {j in 0..n} (y[j]) = b[1] - b[0];
subject to Z {j in 0..n} :
sum {j in 0..n} (z[j]) = c[1] - c[0];
minimize length: (sum {j in 1..n} (sqrt( ((x[j]-x[j-1])/(1/n))^2 +
((y[j]-y[j-1])/(1/n))^2 +
((z[j]-z[j-1])/(1/n))^2) + 10^-6) /n )
subject to speed {j in 1..n} :
sqrt( (x[j] - x[j-1])^2 + (y[j] - y[j-1])^2 + (z[j] - z[j-1])^2 + 10^-6) = sqrt( (x[j+1] - x[j])^2 + (y[j+1] - y[j])^2 + (z[j+1] - z[j])^2 + 10^-6)
data;
param a :=
0 0
1 1 ;
param b :=
0 0
1 1 ;
param c :=
0 0
1 1 ;
param n := 1;
option minos_options "superbasic_limit=500";
solve;
display length;
I'm trying to find the shortest length between 2 points through a finite approximation method of the infinite dimensional problem.
All tips are welcomed!
Thank you!
amplin, line 22 (offset 292):
syntax error
context: sum {j >>> in <<< 0..n} (x[j]) = abs( a[1] - a[0] );Error (2) in /opt/ampl/ampl -R amplin
You are trying to redefine dummy index j in a nested indexing expression which is not allowed:
subject to X {j in 0..n} :
sum {j in 0..n} ...
subject to X {i in 0..n} :
sum {j in 0..n} ...
--
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 ampl+uns...@googlegroups.com.
To post to this group, send email to am...@googlegroups.com.
Visit this group at http://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.