How to run Parampl ? ampl in parallel

158 views
Skip to first unread message

Jeff Chávez

unread,
Aug 8, 2019, 8:23:09 PM8/8/19
to AMPL Modeling Language
Hi everyone

I try to run parampl with the follow example:
****************************************************************************************************
****************************************************************************************************
var x{i in 1..3} >= 0;

param res {i in 1..6};
param p1 {iter in 1..2};    param p2 {iter in 1..2};
param iter;

minimize obj:
   p1[iter] - x[1]^2 - 2*x[2]^2 - x[3]^2 - x[1]*x[2] - x[1]*x[3];

subject to c1:
   8*x[1] + 14*x[2] + 7*x[3] - p2[iter] = 0;

subject to c2:
   x[1]^2 + x[2]^2 + x[3]^2 -25 >= 0;

let p1[1] := 1000;     let p1[2] := 500;
let p2[1] := 56;       let p2[2] := 98;

option parampl_options 'solver=ipopt';
option ipopt_options 'mu_init=1e-6 max_iter=10000';
# sequential
for {i in 1..2} {
   let {k in 1..3} x[k] := 2;     # define the initial point.
   let iter := i;
   solve;
   for {j in 1..3} {              # store the solution
      let res[(i-1)*3 + j] := x[j];
   };
};

display res;

# paralallel
option parampl_queue_id 'powelltest';

for {i in 1..3} {
    # Define the initial point.
    let x[1] := 2;
    let x[2] := 2;
    let x[3] := 2;

    let iter := i;

    # execute solver (non blocking execution):
    #commands paramplsub;
write ("bparampl_problem_" & $parampl_queue_id);
    shell 'python parampl.py submit'; 
};

# the tasks are now being executed in parallel...

for {i in 1..2} {
    # retrieve solution from the solver:
    # commands paramplret;
shell 'python parampl.py retrieve';
    if shell_exitcode == 0 then {
     solution ("parampl_problem_" & $parampl_queue_id & ".sol");
     remove ("parampl_problem_" & $parampl_queue_id & ".sol");
    }

    # store the solution
    for {j in 1..3} {
        let res[(i-1)*3 + j] := x[j];
    };
};
****************************************************************************************************
****************************************************************************************************

But I have this errors:

****************************************************************************************************
****************************************************************************************************
res [*] :=
1  2
2  2
3  2
4  2
5  2
6  2
;

Error renaming file: parampl_problem_powelltest.nl to: parampl_job_powelltest_1.nl. Retrying #1 in 0.1 sec... 
Error renaming file: parampl_problem_powelltest.nl to: parampl_job_powelltest_1.nl. Retrying #2 in 0.1 sec... 
Error renaming file: parampl_problem_powelltest.nl to: parampl_job_powelltest_1.nl. Retrying #3 in 0.1 sec... 
Error renaming file: parampl_problem_powelltest.nl to: parampl_job_powelltest_1.nl. Retrying #4 in 0.1 sec... 
Error renaming file: parampl_problem_powelltest.nl to: parampl_job_powelltest_1.nl. Retrying #5 in 0.1 sec... 
Error renaming file: parampl_problem_powelltest.nl to: parampl_job_powelltest_1.nl. Retrying #6 in 0.1 sec... 
Error renaming file: parampl_problem_powelltest.nl to: parampl_job_powelltest_1.nl. Retrying #7 in 0.1 sec... 
Error renaming file: parampl_problem_powelltest.nl to: parampl_job_powelltest_1.nl. Retrying #8 in 0.1 sec... 
Error renaming file: parampl_problem_powelltest.nl to: parampl_job_powelltest_1.nl. Retrying #9 in 0.1 sec... 
Traceback (most recent call last):
  File "parampl.py", line 639, in <module>
    jobNumber = parampl.submit(queueId)
  File "parampl.py", line 202, in submit
    self.renameFile(self.problemfile(queueId) + "." + PARAMPL_NL_FILE_EXT, PARAMPL_JOB_PROBLEM_FILE_PREFIX + "_" + queueId + "_" + str(jobNumber) + "." + PARAMPL_NL_FILE_EXT)
  File "parampl.py", line 497, in renameFile
    os.rename(old, new)
FileNotFoundError: [WinError 2] El sistema no puede encontrar el archivo especificado: 'parampl_problem_powelltest.nl' -> 'parampl_job_powelltest_1.nl'
exit code 1
Error renaming file: parampl_problem_powelltest.nl to: parampl_job_powelltest_1.nl. Retrying #1 in 0.1 sec... 
Error renaming file: parampl_problem_powelltest.nl to: parampl_job_powelltest_1.nl. Retrying #2 in 0.1 sec... 
Error renaming file: parampl_problem_powelltest.nl to: parampl_job_powelltest_1.nl. Retrying #3 in 0.1 sec... 
Error renaming file: parampl_problem_powelltest.nl to: parampl_job_powelltest_1.nl. Retrying #4 in 0.1 sec... 
Error renaming file: parampl_problem_powelltest.nl to: parampl_job_powelltest_1.nl. Retrying #5 in 0.1 sec... 
Error renaming file: parampl_problem_powelltest.nl to: parampl_job_powelltest_1.nl. Retrying #6 in 0.1 sec... 
Error renaming file: parampl_problem_powelltest.nl to: parampl_job_powelltest_1.nl. Retrying #7 in 0.1 sec... 
Error renaming file: parampl_problem_powelltest.nl to: parampl_job_powelltest_1.nl. Retrying #8 in 0.1 sec... 
Error renaming file: parampl_problem_powelltest.nl to: parampl_job_powelltest_1.nl. Retrying #9 in 0.1 sec... 
Traceback (most recent call last):
  File "parampl.py", line 639, in <module>
    jobNumber = parampl.submit(queueId)
  File "parampl.py", line 202, in submit
    self.renameFile(self.problemfile(queueId) + "." + PARAMPL_NL_FILE_EXT, PARAMPL_JOB_PROBLEM_FILE_PREFIX + "_" + queueId + "_" + str(jobNumber) + "." + PARAMPL_NL_FILE_EXT)
  File "parampl.py", line 497, in renameFile
    os.rename(old, new)
FileExistsError: [WinError 183] No se puede crear un archivo que ya existe: 'parampl_problem_powelltest.nl' -> 'parampl_job_powelltest_1.nl'
exit code 1
Error at _cmdno 51 executing "write" command
error processing objective obj:
invalid subscript p1[3]
<<< Process finished. (Exit code 2)
================ READY ================

Anyone can help me?

Best Regards

AMPL Google Group

unread,
Aug 11, 2019, 1:42:28 PM8/11/19
to AMPL Modeling Language
We were able to reproduce this issue with python3. However, it seems to work fine with Python 2.7. It may be easier to contact the author of parampl directly as this seems to be a bug:
- https://github.com/arturolszak/parampl
- http://www.parampl.com/


--
Filipe Brandão
am...@googlegroups.com
{#HS:925174585-51840#}
--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ampl/ba7dbe91-3d0d-460b-8f10-c57d23706a06%40googlegroups.com.

Artur Olszak

unread,
Sep 9, 2019, 4:05:34 AM9/9/19
to AMPL Modeling Language
Hi,

On Friday, I released a new version of Parampl (v. 2.1.0). The problem with renaming the file is now fixed. I also fixed some other smaller issues. Parampl should now be fully compatible with Python 2 and Python 3. The link to download below:


Thank you for noticing the bug and reporting it.

Best regards.
Artur
To unsubscribe from this group and stop receiving emails from it, send an email to am...@googlegroups.com.

jerron liu

unread,
Sep 2, 2021, 7:03:13 AM9/2/21
to am...@googlegroups.com
Does it mean no more free cloud server?

## NEOS Status: 0 running, 0 queued jobs
## Submitted JobNumber=10898677, password=XpbtuvNW
## NEOS Status: Waiting in queue...
## NEOS Status: Running...
Job 10898677 dispatched
password: XpbtuvNW
---------- Begin Solver Output -----------
Condor submit: 'neos.submit'
Condor submit: 'watchdog.submit'
Job submitted to NEOS HTCondor pool.
## NEOS Status: Job Done
Job Output:
The license for this AMPL processor has expired.
AMPL Version 20210123 (Linux x86_64 (gcc 7.4.1); expires midnight 20210901 GMT)
License 602d94e5-1 for NEOS (Prof. Michael Ferris)
AMPL Version 20210123 (Linux Error (255) in /opt/ampl/ampl -R amplin

## AMPL run completed on NEOS.
## No results were loaded into the sheet.

## Done

DAIZY RAJPUT

unread,
Sep 2, 2021, 7:06:46 AM9/2/21
to am...@googlegroups.com
Hi Liu,
It means that you AMPl license is expired. Neos is still available.
It happened with me too, i just renewed my license.
Hope this helps.

Thanks and regards,
Daizy

--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+uns...@googlegroups.com.
--
Regards,
Daizy Rajput
Research Scholar (Phd)

DAIZY RAJPUT

unread,
Sep 2, 2021, 7:07:56 AM9/2/21
to am...@googlegroups.com
Sorry for the typo error.
Your AMPL license is expired.
You only have to renew it :)

On Thu, 2 Sep 2021 at 12:03, jerron liu <jer...@gmail.com> wrote:
--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+uns...@googlegroups.com.

DAIZY RAJPUT

unread,
Sep 2, 2021, 7:11:39 AM9/2/21
to am...@googlegroups.com
Free cloud server is there. I am using it at the moment.
Your AMPL (modelling language license) needs to be renewed.

Hope this helps.

On Thu, 2 Sep 2021 at 12:09, jerron Liu <jer...@gmail.com> wrote:
Does it mean no more free cloud server?

## NEOS Status: 0 running, 0 queued jobs
## Submitted JobNumber=10898677, password=XpbtuvNW
## NEOS Status: Waiting in queue...
## NEOS Status: Running...
Job 10898677 dispatched
password: xxxxxxxxx

---------- Begin Solver Output -----------
Condor submit: 'neos.submit'
Condor submit: 'watchdog.submit'
Job submitted to NEOS HTCondor pool.
## NEOS Status: Job Done
Job Output:
The license for this AMPL processor has expired.
AMPL Version 20210123 (Linux x86_64 (gcc 7.4.1); expires midnight 20210901 GMT)
License 602d94e5-1 for NEOS (Prof. Michael Ferris)
AMPL Version 20210123 (Linux Error (255) in /opt/ampl/ampl -R amplin

## AMPL run completed on NEOS.
## No results were loaded into the sheet.

## Done

--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+uns...@googlegroups.com.

jerron Liu

unread,
Sep 2, 2021, 7:15:12 AM9/2/21
to AMPL Modeling Language
Thank you Daizy.
Sorry I meant to post a new conversation, but I mistakenly replied this thread instead.

Reply all
Reply to author
Forward
0 new messages