
From:  Heinrich Schuchardt 
Subject:  Re: [Helpglpk] Using the output of an LP as input of another LP in plain format 
Date:  Tue, 22 Dec 2015 21:00:08 +0100 
_______________________________________________ Helpglpk mailing list address@hidden https://lists.gnu.org/mailman/listinfo/helpglpkHi Dear all
Is it possible to use the output (Optimal values) of an LP as input of another LP in plain format? I mean without using Table statements? For example, can I save the output in .dat file and read it when the second LP will be solved?
Here, I'm going to explain my problem in detail.
I’m using GLPK on Mac (ios system).
I use .awk environment, because two LP’s should be solved at the same time.
I’m working on Network Optimization problem, which includes arc set E of dim 2, and some parameters are defined on E (u, tau, delta).
First, the network structure and data are built in .awk file, because I want to consider random networks, and the data of network are saved in Netwok_Data.dat.
After that the first LP, named Nominal.mod is solved by this command: system("glpsol model " modfile_Nominal " data " datfile );
By solving Nominal.mod, the optimal values of problem, are saved in 40_Dense_Nominal_Solution.dat file as x_nominal_opt, which are defined on set E.
To evaluate my study, I need to build several scenarios and compute a value.
These scenarios are built based on parameters tau and delta for each arc, therefore the Netwok_Data.dat file should be included.
So, the file Scenario.mod is considered and new parameters tau_scenario, which defined on E, are built.
Now, I need to compute the value of “param Val := sum {(i,j) in E} tau_scenario[i,j]*x_nominal_opt[i,j];”, which contains the output of previous LP (Nominal.mod).
The main question is how to relate the values of x_nominal_opt (output of Nominal.mod) to new model Scenario.mod?
I couldn’t use Table statement because the set E is already defined in Netwok_Data.dat.
(I think it is impossible to read 2 parameters that both of them defined in set E, but one of them defined in Netwok_Data.dat file (like tau and delta) and another one defined in table (x_nominal_opt). I also couldn’t save Netwok_Data.dat as table, because it’s built in .awk file.)
So, I decided to call model Scenario.mod by two data file as:
system("glpsol model " modfile_Scenario " data " datfile " data " datfile_40_Dense_Nominal_Solution);
But the following error is appeared:
(unknown):0: unable to open 40_Dense_Nominal_Solution.dat  No such file or directory
However the 40_Dense_Nominal_Solution.dat already exist, because the problem Nominal.mod is solved correctly. And in .awk the following command are mentioned.
system("rm force " datfile_40_Dense_Nominal_Solution
close(datfile_40_Dense_Nominal_Solution);
I don’t know how to fix it.
The attached file contains .awk file. If it is necessary, I will attach all my files.
I do apologize for long post.
Any help would be greatly appreciated.
Shaghayegh
[Prev in Thread]  Current Thread  [Next in Thread] 