<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi Anna,<div><br></div><div>I apologize the very delayed answer. There was obesely a misunderstanding between me and Thomas (my teammate) who shout answer you.</div><div> Please see my answers below:</div><div> <br><div><div>Am 30.04.2014 um 17:24 schrieb Anna Tarantini <<a href="mailto:anna.tarantini@hotmail.it">anna.tarantini@hotmail.it</a>>:</div><br class="Apple-interchange-newline"><blockquote type="cite">
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style>
<div class="hmmessage"><div dir="ltr">Hi, we're trying to formulate a simple model to get the layout of a MAN. <div>While compiling the CMPL we get some errors:</div><div><br></div><div>error(compiler): file prova.cmpl line 55: syntax error, unexpected SYMBOL_VAR</div><div>error(compiler): file prova.cmpl line 64: syntax error, unexpected ASSIGN_ITER, expecting ':'</div>error(compiler): file prova.cmpl line 64: syntax error, unexpected '}', expecting end of file<div><br></div><div>here's the CMPL file </div><div><br></div><div><div><br></div><div><br></div><div>%arg -ignoreZeros</div><div><br></div><div><br></div><div><br></div><div>parameters:</div><div><br></div><div>f:=30;</div><div>alfa:=40;</div><div>r:=(1,2,3,4,5);</div><div>beta:=20;</div><div>omega:=10;</div><div><br></div><div>seed:=srand(100);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>M:=10000;</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>nrOfCities:=5;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>NODES:=1..nrOfCities;</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>{i in NODES:</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> xp[i]:=rand(100);</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> yp[i]:=rand(100);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>{i in NODES, j in NODES:</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> {i==j: </div><div><span class="Apple-tab-span" style="white-space:pre">                </span>dist[i,j]:=M; |</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> default: </div><div><span class="Apple-tab-span" style="white-space:pre">                </span>dist[i,j]:= sqrt( (xp[i]-xp[j])^2 + (yp[i]-yp[j])^2 );</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>dist[j,i]:= dist[i,j]+rand(10)-rand(10);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> }</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div><br></div><div><br></div><div>#include "istanza0.cmpl"</div><div><br></div><div><br></div><div>variables:</div><div><br></div><div><br></div><div><br></div><div>w[NODES, NODES]: integer[0..];</div><div><br></div><div>y[NODES, NODES]: integer[0..1];</div><div><br></div><div>x[NODES, NODES]: integer[0..];</div><div><br></div><div><br></div><div><br></div><div>objectives:</div><div><br></div><div><br></div><div><br></div><div>cost: (sum{j:=1..nrOfCities : sum{i:=1..(j-1): y[i,j] }} * f) +</div><div> </div><div> (alfa * sum{j:=1..nrOfCities: sum{i:=1..(j-1): d[i,j] * w[i,j] }}) -> min;</div></div></div></div></blockquote><div><br></div><div>The parameter array <i>d[,] </i>is not defined. I would assume that you want to use <i>dist[,]</i>. You can additionally simplify your objective function because the two sums run over the same sets.</div><div><br></div><div>This is my proposal:</div><div><br><i>cost: sum{j in 1..nrOfCities, i in 1..(j-1): y[i,j]* f + alfa * dist[i,j] * w[i,j] } -> min;</i></div><div><br></div><div><br></div><br><blockquote type="cite"><div class="hmmessage"><div dir="ltr"><div><div><br></div><div><br></div><div><br></div><div><br></div><div>constraints:</div><div><br></div><div>strands { i in NODES, j in NODES : w[i,j] <= k * y[i,j]; }</div></div></div></div></blockquote><div><br></div><div><i>k </i>is not defined.</div><div><br></div><div><br></div><br><blockquote type="cite"><div class="hmmessage"><div dir="ltr"><div><div><br></div><div>flow { j in NODES-1 : sum{ j in NODES, i in NODES : x[j,i] } - sum{ i in NODES, j in NODES : x[i,j] } = r[j] * beta; }</div></div></div></div></blockquote><br><blockquote type="cite"><div class="hmmessage"><div dir="ltr"><div><div>hubFlow { j in NODES-1 : sum{ j in NODES : x[j, NODES] } - sum{ j in NODES : x[NODES,j] } = - sum{ j in NODES-1 : r[j] * beta }; }</div></div></div></div></blockquote><div><br></div><div>This is a little bit more difficult to answer:</div><div>Do you want really to use the index <i>j</i> in the outer and the inner sums? If not please use another index for the outer sum. Do you mean <i>j in (1..nrOfCities-1)</i> instead <i>j in NODES-1</i>. In my mind does make <i>NODES-1</i> not really sense. </div><div><br></div><div><div class="hmmessage"><div dir="ltr">I do not understand the idea of<i> x[j, NODES]. </i> Do you want to address a single element of the array <i>x[,] </i>or the vector out of the matrix<i> x[,]</i>?</div></div></div><div> </div><div><br></div><blockquote type="cite"><div class="hmmessage"><div dir="ltr"><div><div><br></div><div>capacity { i in NODES, j in NODES : x[j,i] + x[i,j] <= w[i,j] * omega; }</div><div><br></div><div><br></div><div><br></div><div>Any clue of how to resolve those errors?</div></div><div>Greetings</div><div><br></div></div></div></blockquote><div><br></div><div>Thanks,</div><div><br></div><div>Mike</div><div><br></div><div><br></div><div><br></div><br><blockquote type="cite"><div class="hmmessage"><div dir="ltr"><div>Anna</div>                                            </div></div>
_______________________________________________<br>Cmpl mailing list<br><a href="mailto:Cmpl@list.coin-or.org">Cmpl@list.coin-or.org</a><br>http://list.coin-or.org/mailman/listinfo/cmpl</blockquote></div><br></div></body></html>