AMPL Interpreter Termination

68 views
Skip to first unread message

tar

unread,
Jun 28, 2017, 9:31:01 AM6/28/17
to AMPL Modeling Language
Hello,

I am using AMPL Java APIs.

I have 20 ampl objects as new AMPL() in an array for running multiple iterations of 20 ampls[i].solve() processes in parallel with common mod file, but independent dat files. I am using Executor Service with a fixed thread pool of 24 threads. The code runs fine until 2000 iterations and then I am getting following issue:

java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unexpected end of file while reading AMPL output.
Usually this is caused by the termination of the underlying AMPL interpreter. The last command issued is: 
solve;
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at EDECMDP.runMultipleWithTimeout(EDECMDP.java:527)
at EDECMDP.EM(EDECMDP.java:648)
at EDECMDP.runExperiment(EDECMDP.java:792)
at Driver.main(Driver.java:52)
Caused by: java.lang.RuntimeException: Unexpected end of file while reading AMPL output.
Usually this is caused by the termination of the underlying AMPL interpreter. The last command issued is: 
solve;
at com.ampl.AMPLProcess.readMessage(AMPLProcess.java:87)
at com.ampl.AMPLProcess.readAMPLOutput(AMPLProcess.java:174)
at com.ampl.AMPLProcess.interpretAndReturn(AMPLProcess.java:330)
at com.ampl.Engine.interpret(Engine.java:97)
at com.ampl.AMPL.solve(AMPL.java:1091)
at EDECMDP.runSuccIter(EDECMDP.java:586)
at EDECMDP.lambda$EM$2(EDECMDP.java:645)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)

The issue is present every time. What causes AMPL interpreter to terminate ? Would solveAsync() prevent this ? Will solveAsync() increase my runtime compared to solve() ?

Any help will be appreciated.

Filipe Brandão

unread,
Jun 29, 2017, 9:34:18 AM6/29/17
to AMPL Modeling Language
Hi,

Could you please provide us a minimal example in order to reproduce this issue? A possible cause for the termination of the AMPL interpreter may be the amount of memory available on your machine.

Best regards,
Filipe

tar

unread,
Jun 29, 2017, 5:49:41 PM6/29/17
to AMPL Modeling Language
Hello!

Thank you for your reply. I investigated this issue for memory problems. I have the following observations:

1. In initial 10 iterations, all 20 ampl objects consumes a 0.1% memory (top command).

2. In between these iterations, the following is changing for each of 20 ampl objects:

ampl.getParameter("x").setValues(Object[] array);


3. Every 20 iterations, the percentage memory consumed by ampl objects rises by a 0.1%, effectively 2.0% for 20 objects.

Merely updating the values of a parameter is supposed to increase memory usage ? Or is there something else here ?

Please help!

Thanks!
Reply all
Reply to author
Forward
0 new messages