Error at _cmdno 3 executing "read" command & unexpected end of file error

235 views
Skip to first unread message

Gazi Md Daud Iqbal

unread,
Aug 1, 2015, 7:36:53 PM8/1/15
to am...@googlegroups.com
Hi all,

My practice.run file is -

reset;
model pracitce.mod;
option solver cplex;
option nl_comments 1;
read {i in 1..system1, j in 1..system2}P[i, j]<dataparams.txt;
read {j in 1..sample}err1[j]<R1.txt;
read {j in 1..sample}err2[j]<R2.txt;
let jthstd := 1;
#write g2SPV1;
for {1..350}{
solve;
display jthstd >solution1.out;
display obj > solution1.out;
display _total_solve_time > solution1.out;
display truncatingvar > solution1.out;
display {i in 1..sample, j in 1..sample}Y2bar[i,j] > solution1.out;
display {i in 1..var2, j in 1..sample} x2[i,j] > solution1.out;
let jthstd := jthstd + 1;
}


When i give the command include practice.run and try to run it on a linux machine(we have  licensed version of ampl and CPLEX in that machine ), i always get the following error :

"
Error at _cmdno 3 executing "read" command

(file practice.run, line 5, offset 77):

       unexpected end of file

"

Can anyone please tell me what's wrong here? Line 5 is  dataparam.txt file which is actually a 350*70 matrix.  Please help me.

Thanks

Robert Fourer

unread,
Aug 3, 2015, 12:49:29 PM8/3/15
to am...@googlegroups.com
The "unexpected end of file" error occurs when the "read" command reaches the end of your file (dataparams.txt) before all of the P[i,j] values have been read. If you give the command "display P;" immediately after your read command, then you will see the values that were successfully read before the end of the file was reached; this should help you to determine the cause of the error.

Bob Fourer
am...@googlegroups.com

=======
Reply all
Reply to author
Forward
0 new messages