[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] Test a model with random data on GLPK
From: |
Heinrich Schuchardt |
Subject: |
Re: [Help-glpk] Test a model with random data on GLPK |
Date: |
Wed, 22 Jul 2015 07:52:05 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.7.0 |
Dear Shaghayegh,
glpsol cannot iterate over multiple models or data sets by itself.
https://en.wikibooks.org/wiki/GLPK/Scripting_plus_MathProg
shows how to use a scripting language to call glpsol multiple times.
You can pass the seed value for the random number generator like this
glpsol --seed SEEDVALUE
In Visual Basic Script you can create random numbers with the Rnd(1)
function, cf
https://msdn.microsoft.com/en-us/library/f7s023d2%28v=vs.90%29.aspx
In awk you can use function rand() to create random numbers.
Best regards
Heinrich Schuchardt
On 22.07.2015 01:12, Shaghayegh Mokarami wrote:
> Hi
>
> Im new on GLPK, I want to test my simple model, I use this comment to
> generate different random data:
>
> param seed:=gmtime();
> param u{(i,j) in E}:=(round(seed*Uniform01())) mod 40 ;
>
> and I want to solve model for 100 times and obtain the average value of
> optimal value of objective function.
>
> I don't know how to code iterated expression to repeat solving model in .mod
> file. Could you please help me?
>
> This is my model:
>
> ### VARIABLES ###
> var x{(i,j) in E} >= 0, <= u[i,j];
> ### OBJECTIVE ###
> maximize Val: sum {(1,j) in E} x[1,j];
> ### CONSTRAINTS ###
> subject to Balance {i in V diff {1,n}}:
> sum {(j,i) in E} x[j,i] = sum {(i,k) in E} x[i,k];
> solve;
>
>
>
>
> _______________________________________________
> Help-glpk mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-glpk
>