Hello Heinrich !
That example was a silly one only to do a minimal check that the add
if/then/else was working (properly?).
My implementation doesn't seem to need much code and allow a bit better
expressiveness to GMPL.
Another example from examples/pentomino.mod:
Before:
====
for{i in 1..m}
{ for{j in 1..n}
{ for{0..0: (i,j) in R}
{ for{(c,ii,jj) in S: (i-ii,j-jj) in D[c] and x[c,ii,jj]}
printf" %s", substr(c,1,1);
}
for{0..0: (i,j) not in R}
printf" .";
}
printf"\n";
}
====
After:
====
for{i in M}
{ for{j in N}
{ if(i,j) in R then
{ for{(c,ii,jj) in S: (i-ii,j-jj) in D[c] and x[c,ii,jj]}
printf" %s", substr(c,1,1);
}
else
printf" .";
}
printf"\n";
}
====
Cheers !
On 24/8/20 16:59, Heinrich Schuchardt wrote:
On 24.08.20 16:33, Domingo Alvarez Duarte wrote:
Hello Meketon !
Could you share your view of how it would be expressed (an ideal model
sample) ?
If you want to talk about it, maybe I'll be interested in implement it !
Can you share a collection of models data to be used as base for the
test/implementation ?
Dear Domingo,
I do not yet understand what was you weren't able to express with the
current syntax.
Instead of
if length(p) == 3 then display "true 3"; else display "false 3";
if length(p) == 5 then display "true 5"; else display "false 5";
you can write:
param p,symbolic := "dad";
display if length(p) == 3 then "true 3" else "false 3";
display if length(p) == 5 then "true 5" else "false 5";
solve;
end;
Best regards
Heinrich