[Cbc] multidimentionnal array in lp file format

Hervé BOUVART hrvbvrt at gmail.com
Sun May 28 10:44:39 EDT 2017


Hi,
Just use GLPK to transform your problem into an .lp file, then analyze it.
I use to always run a first step with glpk in order to generate either a
.mps or a .lp file, that I pass to CBC. Most of the time, it would take you
hours to manually write a .lp file, as it extensively describes the problem.

Hervé

On Sun, May 28, 2017 at 4:32 PM, binome SIR <binome.sir2017 at gmail.com>
wrote:

> Hello,
> I am starting with the cbc solver after using GLPK solver, i need to
> transforme the model i had wrote in .mod format to a .lp file format, the
> problem is that a can't find how to declare arrays in lp farmat.
> my .mod file is the following:
> set coh dimen 2;
> set noncoh dimen 2;
>
> param M>0;
> param N>0;
> param ncmax>0;
>
> param traf{1..M,1..M}>=0;
>
> var x{1..M,1..ncmax}binary;
>
> var u{i in 1..M-1,k in i+1..M,j in 1..ncmax}binary;
>
> minimize trafInt:
> sum{j in 1..ncmax}sum{i in 1..M-1}sum {k in i+1..M} traf[i,k]* u[i,k,j];
>
>
>
> subject to cont2{i in 1..M}:
> sum{j in 1..ncmax}x[i,j]=1;
>
> subject to cont3{j in 1..ncmax}:
> sum{i in 1..M}x[i,j]<=N;
>
>
> subject to const5{(i,k) in noncoh,j in 1..ncmax}:
> x[i,j]+x[k,j]<=1;
>
> subject to const6{(i,k)in coh,j in 1..ncmax}:
> x[i,j]-x[k,j]=0;
> subject to const7 {i in 1..M-1,k in i+1..M,j in 1..ncmax}:
> x[i,j]+(1-x[k,j])-u[i,k,j]<=1;
> end;
>
>
> as you could see, this model contain lot of arrays declaration, so how can
> I transforme it to CBC LP file format.
> thank you.
>
> _______________________________________________
> Cbc mailing list
> Cbc at list.coin-or.org
> https://list.coin-or.org/mailman/listinfo/cbc
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/cbc/attachments/20170528/b27785f6/attachment.html>


More information about the Cbc mailing list