AMPL

From FarmShare

(Difference between revisions)
Jump to: navigation, search
Line 97: Line 97:
Submit with:
Submit with:
   qsub my_ampl.script
   qsub my_ampl.script
 +
 +
 +
==2012-08-15 AMPL upgrade==
 +
I upgrade AMPL to a newer version, now it looks like this:
 +
<pre>
 +
 +
[chekh@corn12.stanford.edu] ~ [0]
 +
$ module load AMPL
 +
[chekh@corn12.stanford.edu] ~ [0]
 +
$ ampl --version
 +
AMPL Version 20120629 (Linux x86_64)
 +
[chekh@corn12.stanford.edu] ~ [0]
 +
$ ampl
 +
netlicchk: Trying to start license manager ampl_lic.
 +
netlicchk: Invoking "/mnt/glusterfs/software/non-free/AMPL/ampl_lic".
 +
ampl:

Revision as of 15:03, 15 August 2012

I tried running an ampl example, specifically cut3.run from here: http://www.ampl.com/NEW/LOOP2/index.html

But you need to replace the command "option solver cplex" with "option solver cplexamp"

Put cplex in my path:

[chekh@corn14.stanford.edu] /mnt/glusterfs/chekh/ampl_test [0] 
$ module load CPLEX_Studio-12.4
[chekh@corn14.stanford.edu] /mnt/glusterfs/chekh/ampl_test [0] 
$ which cplex
/mnt/glusterfs/software/non-free/CPLEX_Studio124/cplex/bin/x86-64_sles10_4.1/cplex
[chekh@corn14.stanford.edu] /mnt/glusterfs/chekh/ampl_test [0] 
$ which cplexamp 
/mnt/glusterfs/software/non-free/CPLEX_Studio124/cplex/bin/x86-64_sles10_4.1/cplexamp

put ampl in my path:

 module load AMPL

Contents

Interactive

Run interactive ampl using the absolute path:

[chekh@corn14.stanford.edu] /mnt/glusterfs/chekh/ampl_test [0] 
$ ampl 
ILOG AMPL 11.210, licensed to "stanford-palo alto, ca", options: MaintenanceEnd=20110531 
AMPL Version 20081120 (Linux 2.6.18-5-amd64)
ampl: include cut3.run

  52.10  -2.00e-01    1  0  0  0  1
  50.50  -2.00e-01    1  2  0  0  0
  47.00  -1.00e-01    3  0  1  0  0
  46.25  -1.00e-06  


Rounded up to integer:  48 rolls

Cut     0   0   9   5   0   8  18   8

 20     5   0   0   0   0   1   1   3
 45     0   2   0   0   0   0   2   0
 50     0   0   2   0   0   0   0   1
 55     0   0   0   2   0   0   0   0
 75     0   0   0   0   1   1   0   0

WASTE =  7.48%


Best integer:  47 rolls

Cut     0   0   8   5   0   8  18   8

 20     5   0   0   0   0   1   1   3
 45     0   2   0   0   0   0   2   0
 50     0   0   2   0   0   0   0   1
 55     0   0   0   2   0   0   0   0
 75     0   0   0   0   1   1   0   0

WASTE =  5.51%

ampl: quit; 

If you use "option solver cplex" in your run file, it will just sit there indefinitely and produce no output.

non-interactive, aka batch

You can just give ampl the filename of the run file as an argument, instead of invoking ampl interactively. E.g.

 ampl cut3.run

It will still print the output out to stdout, so you may want to redirect to a file, e.g.

 mpl cut3.run > output_of_cut3.out

submit to barley

Since we can run the program non-interactively, we can submit it to the resource management system. Write a job script like this:

#!/bin/bash
# use the current directory
#$ -cwd
# use the current environment
#$ -V
# mail this address
#$ -M chekh@stanford.edu
# send mail on begin, end, suspend
#$ -m bes
# request 5GB of RAM for this job
#$ -l mem_free=5G

ampl model.run 

You'll need to use the '-V' flag either on the command line or in the job script, and you'll need to run 'module load CPLEX_Studio-12.4' and 'module load AMPL' before you submit the job. The latter will add cplex and cplexamp to your PATH and the former will pass that environment variable through to the job environment.

Submit with:

 qsub my_ampl.script


2012-08-15 AMPL upgrade

I upgrade AMPL to a newer version, now it looks like this:


[chekh@corn12.stanford.edu] ~ [0] 
$ module load AMPL
[chekh@corn12.stanford.edu] ~ [0] 
$ ampl --version
AMPL Version 20120629 (Linux x86_64)
[chekh@corn12.stanford.edu] ~ [0] 
$ ampl
netlicchk: Trying to start license manager ampl_lic.
netlicchk: Invoking "/mnt/glusterfs/software/non-free/AMPL/ampl_lic".
ampl:
Personal tools
Toolbox
LANGUAGES