[Cmpl] some CMPL errors

Mike Steglich mike.steglich at th-wildau.de
Wed Jul 2 06:40:02 EDT 2014


Hi Anna,

First of all .. please use CMPL 1.10 because in CMPL 1.9 is a bug for the CBC option handling. 

To set a solver option you can specify a CMPL header option for the solvers:

%opt solverName solverOption [solverOptionValue]

I've included selected CBC options in chapter 6.1 of the manual.

Cheers,

Mike  


Am 02.07.2014 um 12:22 schrieb Anna Tarantini <anna.tarantini at hotmail.it>:

> Hello Mike,
> we'd like to ask you a few more things about the usage of CMPL, and in particular how we can manage the solver options.
> We didn't find anything on the web so we need to bother you one last time.
> 
> We'd need to know how to force CBC to use the Primal or the Barrier instead of the Dual (which is default if i remember correctly) 
> and how we can tell the solver to use some cuts more than others and how frequently and, why not, how to disable some of them.
> 
> We truly appreciate the kindness you've shown us and we thank you in advance for the answer to this.
> Greetings.
> 
> Anna
> 
> From: mike.steglich at th-wildau.de
> Subject: Re: [Cmpl] some CMPL errors
> Date: Tue, 17 Jun 2014 13:07:57 +0200
> To: anna.tarantini at hotmail.it
> 
> Hu Anna,
> 
> Am 16.06.2014 um 11:44 schrieb Anna Tarantini <anna.tarantini at hotmail.it>:
> 
> Hello Mike,
> first of all WE DID IT!!!! thanks to you mostly.
> Great!!
> 
> But now we have to bother you again. 
> We'd like to know if there is a way to print the log of the solving execution in a file.
> We have looked around to see if we could find something but no luck.
> Can you help us with that?
> I can suppose two ways. If you work with Coliop then you can mark the CMP and solver output in the message panel in CMPL with Ctrl+A, copy it with CTRL+C and paste it into a text file with CTRL+V.
> 
> If you use the Cmpl binary then you can redirect the stdOut of CMPL and the solver in a text file with the following command:
> 
> cmpl yourFile.cmpl >output.txt. 
> 
> Cheers,
> 
> Mike
> 
> 
> 
> 
> Thank you very much again.
> Greetings
> 
>    Anna
> 
> From: mike.steglich at th-wildau.de
> Subject: Re: [Cmpl] some CMPL errors
> Date: Wed, 21 May 2014 09:56:21 +0200
> To: anna.tarantini at hotmail.it
> 
> Hi Anna,
> 
> 
> Am 19.05.2014 um 09:59 schrieb Anna Tarantini <anna.tarantini at hotmail.it>:
> 
> Hello Professor Steglich, 
> (just Mike ;-))
> Sorry to bother you one last time but we almost made it.
> 
> Don't worry. You can ask whatever and whenever you want.
> 
> We get one last error about an unexpected SYMBOL_VAR (expecting ':') in the following line:
> 
> hubflow { j in NOHUBNODES : sum { x[j, hub] - x[hub, j] } = - sum{ dist[j] * beta }; }
> 
> The sum expression within the loop contains not a index definition. I would like to propose two alternatives:
> 
> hubflow { j in NOHUBNODES :  x[j, hub] - x[hub, j]  = -  dist[j] * beta ; }
> This is the CMPL statement for  x_j_hub - x_hub_j = - dist_j * beta ;  for all j in NOHUBNODES
> 
> or 
> 
> hubflow: sum{ j in NOHUBNODES : x[j, hub] - x[hub, j] } = - sum{ j in NOHUBNODES :  dist[j] * beta }; 
> equivalent for sum_over_j_in_HUBNOTES x_j_hub - x_hub_j = - sum_over_j_in_HUBNOTES  - dist_j * beta
> 
> 
> I'm not sure which constraint fits your model.
> 
> Cheers,
> Mike
> 
> 
> 
> 
> 
> Thank you very much for your time and sorry again.
> 
> Greetings,
> 
> Anna
> 
> Subject: Re: [Cmpl] some CMPL errors
> From: mike.steglich at th-wildau.de
> Date: Sun, 18 May 2014 13:55:23 +0200
> CC: cmpl at list.coin-or.org
> To: anna.tarantini at hotmail.it
> 
> Hi Anna,
> 
> If there is a loop fixing the index j you can use the fixed j also for the inner sum loops:
> 
> flow  { j in NOHUBNODES : sum{ i in NODES : x[j,i] } - sum{ i in NODES : x[i,j] } = dist[j] * beta; } 
> 
> or in short form if both sums uses actually the same set :
> 
> flow  { j in NOHUBNODES : sum{ i in NODES : x[j,i]   -  x[i,j] } = dist[j] * beta; } 
> 
> 
> Cheers, 
> 
> Mike
> 
> 
> Am 16.05.2014 um 16:36 schrieb Anna Tarantini <anna.tarantini at hotmail.it>:
> 
> Hello Professor Steglich,
> Thank you for your answer.
> This is our mathematical model.
> 
> 
> Thank you very much for your time.
> Greetings
> Anna 
> 
> Subject: Re: [Cmpl] some CMPL errors
> From: mike.steglich at stegger.net
> Date: Tue, 13 May 2014 09:57:04 +0200
> CC: cmpl at list.coin-or.org
> To: anna.tarantini at hotmail.it
> 
> Hi Anna,
> 
> The first error is easy to solve:
> 
> Please write 
> cost: sum{j in NODES, i in 1..(j-1):  y[i,j]* f + alfa * dist[i,j] * w[i,j] } -> min;
> 
> instead of:
> cost: sum{j in 1..NODES, i in 1..(j-1):  y[i,j]* f + alfa * dist[i,j] * w[i,j] } -> min;
> 
> The problem for the flow and hubFlow constraints is that you use the same index in the outer loop and in the inner sum loops.
> flow  { j in NOHUBNODES : sum{ j in NODES, i in NODES : x[j,i] } - sum{ i in NODES, j in NODES : x[i,j] } = dist[j] * beta; }
> 
> Can you send a mathematical description for a better understanding? 
> 
> Thanks,
> 
> Mike
> 
> 
> 
> 
> 
> Am 12.05.2014 um 17:38 schrieb Anna Tarantini <anna.tarantini at hotmail.it>:
> 
> Hello Professor Steglich. 
> Thank you for your answer. I've tried to modify my model in order to make him functional but I still get some errors. Firstly now I use an instance in which I retrieve my parameters and then I still get the last two errors. I can easily explain all of this pasting you the code so here it is:
> 
> prova.cmpl
> 
> %arg -ignoreZeros
> 
> 
> parameters:
> 
> include "istanza0.cmpl"
> 
> 
> variables:
> 
> w[NODES, NODES]: integer[0..];
> 
> y[NODES, NODES]: integer[0..1];
> 
> x[NODES, NODES]: integer[0..];
> 
> 
> objectives:
> 
> cost: sum{j in 1..NODES, i in 1..(j-1):  y[i,j]* f + alfa * dist[i,j] * w[i,j] } -> min;
> 
> 
> constraints:
> 
> strands { i in NODES, j in NODES : w[i,j] <= k * y[i,j]; }
> 
> flow  { j in NOHUBNODES : sum{ j in NODES, i in NODES : x[j,i] } - sum{ i in NODES, j in NODES : x[i,j] } = dist[j] * beta; }
> 
> hubFlow  { j in NOHUBNODES : sum{ j in NODES : x[j, hub] } - sum{ j in NODES : x[hub,j] } = - sum{ j in NOHUBNODES : dist[j] * beta }; }
> 
> capacity { i in NODES, j in NODES : x[j,i] + x[i,j] <= w[i,j] * omega; }
> 
> istanza0.cmpl
> 
> NODES := 1..12;
> NOHUBNODES := 1..11;
> hub := 12;
> 
> LINKS := 1..15;
> 
> k := 9;
> 
> links[LINKS, 1(1)3] := ((1, 2, 124.42),
> 		    (2, 5, 6887.90),
> 		    (2, 6, 84.81),
> 		    (2, 12, 944.68),
> 		    (3, 6, 162.52),
> 		    (3, 9, 1518.29),
> 		    (4, 7, 935.30),
> 		    (4, 10, 1898.83),
> 		    (4, 11, 1945.26),
> 		    (5, 7, 161.04),
> 		    (5, 8, 2530.56),
> 		    (6, 7, 1160.86),
> 		    (8, 10, 459.26),
> 		    (9, 12, 344.35),
> 		    (10, 11, 604.96));
> 
> alfa := 133;
> 
> f := 1081;
> 
> beta := 20;
> 
> omega := 7;
> 
> dist[NODES] := (591, 901, 260, 1147, 745, 1516, 1573, 1028, 2196, 903, 505, 0);
> 
> 
> And finally here are the errors:
> 
> error(compiler): file prova.cmpl line 20: A set can contain only integer and strings, but no other sets
> error(compiler): file prova.cmpl line 27: syntax error, unexpected ASSIGN_ITER, expecting ':'
> error(compiler): file prova.cmpl line 29: syntax error, unexpected ASSIGN_ITER, expecting ':'
> error(compiler): file prova.cmpl line 29: syntax error, unexpected '}', expecting end of file
> 
> Thank you very much for your time.
> Greetings
> Anna 
> 
> Subject: Re: [Cmpl] some CMPL errors
> From: mike.steglich at stegger.net
> Date: Mon, 5 May 2014 17:30:30 +0200
> CC: cmpl at list.coin-or.org; t.schleiff at gmail.com
> To: anna.tarantini at hotmail.it
> 
> Hi Anna,
> 
> I apologize the very delayed answer. There was obesely a misunderstanding between me and Thomas (my teammate) who shout answer you.
>  Please see my answers below:
>  
> Am 30.04.2014 um 17:24 schrieb Anna Tarantini <anna.tarantini at hotmail.it>:
> 
> Hi, we're trying to formulate a simple model to get the layout of a MAN. 
> While compiling the CMPL we get some errors:
> 
> error(compiler): file prova.cmpl line 55: syntax error, unexpected SYMBOL_VAR
> error(compiler): file prova.cmpl line 64: syntax error, unexpected ASSIGN_ITER, expecting ':'
> error(compiler): file prova.cmpl line 64: syntax error, unexpected '}', expecting end of file
> 
> here's the CMPL file 
> 
> 
> 
> %arg -ignoreZeros
> 
> 
> 
> parameters:
> 
> f:=30;
> alfa:=40;
> r:=(1,2,3,4,5);
> beta:=20;
> omega:=10;
> 
> seed:=srand(100);
> 	M:=10000;
> 
> 	nrOfCities:=5;
> 	NODES:=1..nrOfCities;
> 
> 	{i in NODES:
> 		  xp[i]:=rand(100);
> 		  yp[i]:=rand(100);
> 	}
> 
> 	{i in NODES, j in NODES:
> 	    {i==j: 
> 		dist[i,j]:=M; |
> 	    default: 
> 		dist[i,j]:= sqrt( (xp[i]-xp[j])^2 + (yp[i]-yp[j])^2 );
> 		dist[j,i]:= dist[i,j]+rand(10)-rand(10);
> 	    }
> 	}
> 
> 
> #include "istanza0.cmpl"
> 
> 
> variables:
> 
> 
> 
> w[NODES, NODES]: integer[0..];
> 
> y[NODES, NODES]: integer[0..1];
> 
> x[NODES, NODES]: integer[0..];
> 
> 
> 
> objectives:
> 
> 
> 
> cost: (sum{j:=1..nrOfCities : sum{i:=1..(j-1):  y[i,j] }} * f) +
>       
>      (alfa * sum{j:=1..nrOfCities: sum{i:=1..(j-1):  d[i,j] * w[i,j] }}) -> min;
> 
> The parameter array d[,] is not defined. I would assume that you want to use dist[,]. You can additionally simplify your objective function because the two sums run over the same sets.
> 
> This is my proposal:
> 
> cost: sum{j in 1..nrOfCities, i in 1..(j-1):  y[i,j]* f + alfa * dist[i,j] * w[i,j] } -> min;
> 
> 
> 
> 
> 
> 
> 
> constraints:
> 
> strands { i in NODES, j in NODES : w[i,j] <= k * y[i,j]; }
> 
> k is not defined.
> 
> 
> 
> 
> 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; }
> 
> 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 }; }
> 
> This is a little bit more difficult to answer:
> Do you want really to use the index j in the outer and the inner sums? If not please use another index for the outer sum. Do you mean j in (1..nrOfCities-1)  instead j in NODES-1. In my mind does make NODES-1 not really sense. 
> 
> I do not understand the idea of  x[j, NODES].  Do you want to address a single element of the array x[,] or the vector out of the matrix x[,]?
>  
> 
> 
> capacity { i in NODES, j in NODES : x[j,i] + x[i,j] <= w[i,j] * omega; }
> 
> 
> 
> Any clue of how to resolve those errors?
> Greetings
> 
> 
> Thanks,
> 
> Mike
> 
> 
> 
> 
> Anna
> _______________________________________________
> Cmpl mailing list
> Cmpl at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/cmpl
> 
> 
> <modIng.pdf>
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/cmpl/attachments/20140702/0aaf20a2/attachment.html>


More information about the Cmpl mailing list