$ontext ===============================================================
LAST MODIFIED: 2008/11/08
FILENAME: pprocess.gms
PURPOSE: This tool performs all performance post-processing for a
given set of trace files. For all paris of trace files,
the routine runs the following performance tool routines:
-solver square
-resource time comparison
-performance profiles
-performance profiles (absolute time)
REFERENCE:
Performance World Website, Ptools section, online at
http://www.gamsworld.eu/performance/tools.htm.
REQUIRED INPUTS:
--trace1: trace file of solver 1
--trace2: trace file of solver 2 etc up to --trace8
OPTIONAL INPUTS:
--outdir: output directory (default: results/)
--outfile: output filename (default: results.htm)
--useobjest: flag to use the objective value estimate in
the square.gms and inconsistencies.gms routines.
Also generates performance profile plots.
--modelfile modelfile containing models to be considered
in comparison
--modellib the model library where the models are taken from.
Valid values are linlib, globallib, minlplib, none.
(default: none)
OPTIONAL PROFILE INPUTS:
--allsolver: if set, adds cumulative solver curves (ALL_SEQ,
ALL_PAR, ALL_MIN) to absolute time profiles
--factor factor for values of tau: 1, factor, factor^2,
factor^3 (default 1.25)
--numpts: number of data points for each solver for
performance profile (default: 30)
--delta actual relative tolerance for having exact best
objective value. Because of rounding errors,
this should generally not be exactly zero.
(default: 1e-5)
--gaptol actual relative gap tolerance for having solved
a model. Because of rounding errors,
this should generally not be exactly zero.
(default: 1e-6)
--resmin: minimum resource time threshold. If a solver
reports a resource time below --resmin, then
it is increased to resmin before being used
in ratios. (default 0.05).
--resmax maximum resource time for absolute time performance
profiles
OPTIONAL SQUARE INPUTS:
--bnd: relative objective function difference. Prints
"optimal" solution in boldface for HTML output
for one solver if the relative objective function
difference is greater than --bnd. (default 1e-5)
--resmin: minimum resource time threshold. If both solvers
report a resource time below --resmin, then no
ratio is reported. In this case, both solver times
are considered the same (default 0.05).
OPTIONAL RESTIME INPUTS:
--bnd: real. Bound for optimal outcome. Outcome is
optimal if both solvers
scaled solutions are within bnd of eachother,
i.e. relative error (default: 1e-5)
--resmin: minimum resource time threshold. If both solvers
report a resource time below --resmin, then no
ratio is reported. In this case, both solver
times are considered the same (default 0.05).
--tsame: bound in % for solver res. times to be considered
same (default 10%)
--tfaster: bound in % for solver res. times to be considered
much faster (default 50%)
OPTIONAL TIMINGS INPUTS:
--colselect: selects a tracefile column to be additionally printed
to resource time (default: ETSolver)
--meanonopt: whether the mean time w.r.t. all models solved to
optimality should be computed (default: 0)
--reslim: limit used for resource value. Unsolved models are
counted with twice the reslim in the calculation
of mean values (default: max resource usage among all data).
REMARKS:
User must input one tracefiles for each solver. Currently
works for LP, RMIP, NLP, RMINLP, MIP, and MINLP type models.
Each trace file can have model/solve information for only 1
solver. For example trace1.trc can have info for all LPs in
PerformanceLib for solver A, and trace2.trc can have
information for all LPs using solver B.
Tracefiles containing multiple solvers will cause error
messages upon compilation.
$offtext ==============================================================
*=== Error checks
$if not set trace1 $goto errors_notrace1
$if not set trace2 $goto errors_notrace2
$if not exist %trace1% $goto errors_trace1notexist
$if not exist %trace2% $goto errors_trace2notexist
*=== Check if user specified all options in an --optfile
$if set optfile $include %optfile%
$if not set useobjest $set useobjest 0
$if not set uselog $set uselog 0
*=== Set default pprocess.gms options
$if not set delta $set delta 1e-5
$if not set resmax $set resmax 1000
$if not set gaptol $set gaptol 1e-5
$if not set outfile $set outfile results
$if not set outdir $set outdir results
$if not set useobjest $set useobjest 0
$if set allsolver $set allsolver --allsolver=yes
$if set allsolver $goto allsolverset
$if not set allsolver $set allsolver
$label allsolverset
*=== Set default square.gms options
$if not set bnd $set bnd 1e-5
$if not set resmin $set resmin 0.05
*=== Set default restime.gms options
$if not set tsame $set tsame 10
$if not set tfaster $set tfaster 50
$ set sep /
*=== Indicator if PAVER run
$if not set paver $set paver 0
$if not set numpts $set numpts 30
*=== Determine trace data files that are input
$echo > tracedata
$echo > alltracedata
$if set trace1 $echo '"%trace1%"' >> tracedata
$if set trace1 $echo '"%trace1%"' >> alltracedata
$if set trace1 $set trace1def 1
$if not set trace1 $set trace1def 0
$if set trace2 $echo '"%trace2%"' >> tracedata
$if set trace2 $echo '"%trace2%"' >> alltracedata
$if set trace2 $set trace2def 1
$if not set trace2 $set trace2def 0
$if set trace3 $echo '"%trace3%"' >> tracedata
$if set trace3 $echo '"%trace3%"' >> alltracedata
$if set trace3 $set trace3def 1
$if not set trace3 $set trace3def 0
$if set trace4 $echo '"%trace4%"' >> tracedata
$if set trace4 $echo '"%trace4%"' >> alltracedata
$if set trace4 $set trace4def 1
$if not set trace4 $set trace4def 0
$if set trace5 $echo '"%trace5%"' >> tracedata
$if set trace5 $echo '"%trace5%"' >> alltracedata
$if set trace5 $set trace5def 1
$if not set trace5 $set trace5def 0
$if set trace6 $echo '"%trace6%"' >> tracedata
$if set trace6 $echo '"%trace6%"' >> alltracedata
$if set trace6 $set trace6def 1
$if not set trace6 $set trace6def 0
$if set trace7 $echo '"%trace7%"' >> tracedata
$if set trace7 $echo '"%trace7%"' >> alltracedata
$if set trace7 $set trace7def 1
$if not set trace7 $set trace7def 0
$if set trace8 $echo '"%trace8%"' >> tracedata
$if set trace8 $echo '"%trace8%"' >> alltracedata
$if set trace8 $set trace8def 1
$if not set trace8 $set trace8def 0
*=== Create set of trace files
$set tracefile tracedata
Set tfiles "tracefiles" /
$onempty
$include %tracefile%
$offempty
/;
Alias (tfilesA, tfilesB, tfiles);
*=== Make output directory and copy trace and other files
execute 'mkdir %outdir%'
execute 'cp style.css %outdir%'
if(%trace1def%, execute 'cp -f %trace1% %outdir%' );
if(%trace2def%, execute 'cp -f %trace2% %outdir%' );
if(%trace3def%, execute 'cp -f %trace3% %outdir%' );
if(%trace4def%, execute 'cp -f %trace4% %outdir%' );
if(%trace5def%, execute 'cp -f %trace5% %outdir%' );
if(%trace6def%, execute 'cp -f %trace6% %outdir%' );
if(%trace7def%, execute 'cp -f %trace7% %outdir%' );
if(%trace8def%, execute 'cp -f %trace8% %outdir%' );
*==========================================================
*=== Run performance tools
*==========================================================
file ftmp / pprocessbat.gms /;
ftmp.pw = 10000;
*=== Parmfile with all trace files
put ftmp '*'
/ '* Batch file created on %system.date% %system.time% '
/ '*'
/// '* Create List of Trace input files' ;
loop(tfiles,
put ftmp / '$call echo --trace' ord(tfiles):0:0 '='
tfiles.tl:0 ' >> tfiles.inc'
);
*=== Run solver square, resource time, and performance ====
*=== profile utilities ====================================
put ftmp // '*=== Batch runs for solver square utility' ;
loop( (tfilesA, tfilesB)$(not sameas(tfilesA,tfilesB) and
ord(tfilesB)>ord(tfilesA) ),
put ftmp / '$call =gams square.gms ';
if(tfiles(tfilesA),
put ' --trace1=' tfilesA.tl:0;
);
if(tfiles(tfilesB),
put ' --trace2=' tfilesB.tl:0;
);
put ' --outfile=' tfilesA.tl:0 '_' tfilesB.tl:0
' --bnd=%bnd% --resmin=%resmin%'
' --outdir=%outdir% --useobjest=%useobjest%'
' --gaptol=%gaptol% --uselog=%uselog%';
$if set reslim
put ' --reslim=%reslim%'
$if set modellib
put ' --modellib=%modellib%'
$if set modelfile
put ' --modelfile=%modelfile%'
put /;
put ftmp / '$if errorlevel 1 $abort "Problems with square.gms"' /;
);
put ftmp // '*=== Batch runs for resource time utility';
loop( (tfilesA, tfilesB)$(not sameas(tfilesA,tfilesB) and
ord(tfilesB)>ord(tfilesA) ),
put ftmp / '$call =gams restime.gms ';
if(tfiles(tfilesA),
put ' --trace1=' tfilesA.tl:0;
);
if(tfiles(tfilesB),
put ' --trace2=' tfilesB.tl:0;
);
put ' --outfile=' tfilesA.tl:0 '_' tfilesB.tl:0
' --bnd=%bnd% --resmin=%resmin% --tsame=%tsame%'
' --tfaster=%tfaster%'
' --outdir=%outdir%';
$if set modelfile
put ' --modelfile=%modelfile%'
put /;
put ftmp / '$if errorlevel 1 $abort "Problems with restime.gms"' /;
);
put ftmp //;
set objwithin/0 "0",Inf "Inf"/;
put ftmp // '*=== Batch runs for performance profile utility';
loop(objwithin,
put ftmp / '$call =gams plotprof.gms parmfile="tfiles.inc" ';
put ftmp ' --otype=png --outdir=%outdir% --figname=profile_' objwithin.te(objwithin):0 ;
if( sameas(objwithin,'0'),
put ' --delta= %delta% '
else
put ' --delta=' objwithin.tl:0 ;
);
$if set colselect
put ' --colselect=%colselect% ';
put ' --numpts=%numpts% --outfile=profile_' objwithin.te(objwithin):0 '.txt '
* ' --factor=%factor% --resmin=%resmin% '
$if set modelfile
put ' --modelfile=%modelfile% '
put /;
put ftmp '$call =gams plotprof.gms parmfile="tfiles.inc" ';
put ftmp ' --otype=ps --outdir=%outdir% --figname=profile_' objwithin.te(objwithin):0 ;
if( sameas(objwithin,'0'),
put ' --delta= %delta% '
else
put ' --delta=' objwithin.tl:0 ;
);
$if set colselect
put ' --colselect=%colselect% ';
put ' --numpts=%numpts% --outfile=profile_' objwithin.te(objwithin):0 '.txt '
* ' --factor=%factor% --resmin=%resmin% '
$if set modelfile
put ' --modelfile=%modelfile% '
put /;
put ftmp / '$if errorlevel 1 $abort "Problems with plotprof.gms"' /;
);
put ftmp // '*=== Batch runs for performance profile (absolute time) utility';
loop(objwithin,
put ftmp / '$call =gams plotproft.gms parmfile="tfiles.inc" ';
put ftmp ' --otype=png --outdir=%outdir% --figname=profilet_' objwithin.te(objwithin):0 ;
if( sameas(objwithin,'0'),
put ' --delta= %delta% '
else
put ' --delta=' objwithin.tl:0 ;
);
$if set colselect
put ' --colselect=%colselect% ';
put ' --numpts=%numpts% --outfile=profilet_' objwithin.te(objwithin):0 '.txt '
' --resmax=%resmax% %allsolver% '
$if set modelfile
put ' --modelfile=%modelfile% '
put /;
put ftmp '$call =gams plotproft.gms parmfile="tfiles.inc" ';
put ftmp ' --otype=ps --outdir=%outdir% --figname=profilet_' objwithin.te(objwithin):0 ;
if( sameas(objwithin,'0'),
put ' --delta= %delta% '
else
put ' --delta=' objwithin.tl:0 ;
);
$if set colselect
put ' --colselect=%colselect% ';
put ' --numpts=%numpts% --outfile=profilet_' objwithin.te(objwithin):0 '.txt '
' --resmax=%resmax% %allsolver% '
$if set modelfile
put ' --modelfile=%modelfile% '
put /;
put ftmp / '$if errorlevel 1 $abort "Problems with plotproft.gms"' /;
);
set gapwithin/0 "0", "0.1" "10", Inf "Inf"/
set objgapwithin(objwithin, gapwithin) / 0.0, 0.'0.1', 'Inf'.'0.1' /;
if(%useobjest%>0,
put ftmp // '*=== Batch runs for performance profile (use obj estimate) '
'utility' ;
loop((objwithin,gapwithin)$objgapwithin(objwithin,gapwithin),
put ftmp '$call =gams plotprofg.gms parmfile="tfiles.inc" --outdir=%outdir% ';
put ftmp ' --otype=png --figname=profileg_' objwithin.te(objwithin):0 '_' gapwithin.te(gapwithin):0;
if( sameas(objwithin,'0'),
put ' --delta= %delta% ' ;
else
put ' --delta=' objwithin.tl:0 ;
);
if ( sameas(gapwithin,'0'),
put ' --gaptol=%gaptol% '
else
put ' --gaptol=' gapwithin.tl:0;
);
$if set colselect
put ' --colselect=%colselect% ';
put ' --numpts=%numpts% '
' --outfile=profileg_' objwithin.te(objwithin):0 '_' gapwithin.te(gapwithin):0 '.txt '
$if set modelfile
put ' --modelfile=%modelfile% '
put /;
put ftmp '$call =gams plotprofg.gms parmfile="tfiles.inc" --outdir=%outdir% ';
put ftmp ' --otype=postscript --figname=profileg_' objwithin.te(objwithin):0 '_' gapwithin.te(gapwithin):0;
if( sameas(objwithin,'0'),
put ' --delta= %delta% '
else
put ' --delta=' objwithin.tl:0 ;
);
if ( sameas(gapwithin,'0'),
put ' --gaptol=%gaptol% '
else
put ' --gaptol=' gapwithin.tl:0;
);
$if set colselect
put ' --colselect=%colselect% ';
put ' --numpts=%numpts% '
' --outfile=profileg_' objwithin.te(objwithin):0 '_' gapwithin.te(gapwithin):0 '.txt '
$if set modelfile
put ' --modelfile=%modelfile% '
put /;
);
put ftmp / '$if errorlevel 1 $abort "Problems with plotprofg.gms"' /;
);
put ftmp // '*=== Model statistics and timings' ;
put ftmp / '$call =gams timings.gms --outdir=%outdir% '
'--useobjest=%useobjest% parmfile=tfiles.inc ';
$if set reslim
put ' --reslim=%reslim%'
$if set modellib
put ' --modellib=%modellib%'
$if set colselect
put ' --colselect=%colselect%'
$if set meanonopt
put ' --meanonopt=%meanonopt%'
$if set modelfile
put ' --modelfile=%modelfile%'
put /;
put ftmp / '$if errorlevel 1 $abort "Problems with timings.gms"' /;
* Perform data inconsistencies check
put ftmp // '*=== Data inconsistency check' ;
put ftmp / '$call =gams inconsistencies.gms ';
loop(tfiles,
put ' --trace' ord(tfiles):0:0 '=' tfiles.tl:0;
);
put ' --useobjest=%useobjest% --outdir=%outdir% '
$if set modelfile
put ' --modelfile=%modelfile% '
put ftmp / '$if errorlevel 1 $abort "Problems with inconsistencies.gms"' /;
putclose ftmp // "$call 'rm -f tfiles.inc'";
execute '=gams pprocessbat.gms';
scalar rc;
rc=errorlevel;
abort$rc 'problems with pprocessbat.gms';
execute 'mv -f pprocessbat.gms %outdir%%sep%'
*==========================================================
*=== Create main performance summary HTM file
*==========================================================
file fhtm / "%outdir%/%outfile%.htm" /;
put fhtm;
put / ''
/ ''
/ '
'
/ ' '
/ ' Performance Results'
/ ''
// ''
// '
'
// '
'
/ '
Performance Results
' /;
put / '
Results created on %system.date% %system.time% '
/ 'using the PAVER Server/Performance Tools available at'
/ ''
/ 'http://www.gamsworld.eu/performance/paver '
/ ' This page is a summary of the performance tests, using the'
/ 'solver square, resource time, and performance profile utilities.'
/ 'The Performance Tools are described in detail in the Performance'
/ 'World webpage at '
/ 'http://www.gamsworld.eu/performance.'
/ 'For a list of model and solve status codes see the '
/ 'Status Codes Section.'
/ '
'/;
*=== Performance profile summary ==========================
put / ''
put / '
Performance profile summary:
'
put / '
The profile utility compares solver outcomes of'
/ 'any number of given solvers (up to 8) over a model test set. The '
/ 'tool is described in detail at '
/ ''
/ 'http://www.gamsworld.eu/performance/pprofile.htm.
'
put / '
'
/ '
Performance profiles for all objective value tolerances: '
'profile_summary.htm (compares '
'objective values)';
$ifthen %useobjest% == 1
put / '
Performance profiles for all objective value tolerances '
'and gap tolerances: '
'profileg_summary.htm (compares '
'objective values and gap tolerances)';
$endif
put
/ '
'
*=== Solver square summary ================================
put / ''
put / '
Data inconsistencies are checked for differences'
/ 'in wall time vs CPU time and objective estimate versus '
/ 'actual objective value. These checks may not be applicable for '
/ 'all models or all trace files.
Performance profiles for different objective value tolerances.'
/ 'The profile utility compares solver outcomes of any number of given '
/ 'solvers (up to 8) over a model test set. The tool is described in detail'
/ 'at '
/ 'http://www.gamsworld.eu/performance/pprofile.htm.
';
put / '
A solver is considered feasible or optimal, if it has the proper model'
/ 'and solver return codes and the relative objective value error is within'
/ 'n % of the best possible solution. If the best found objective'
/ 'value is 0, then the absolute objective value error is used.
';
put / '
The following relative objective value tolerances are used:
'
/ '
';
loop(objwithin,
if( sameas(objwithin,'Inf'),
put / '
No objective value tolerance, i.e. we do not check if obj is best found (within ' objwithin.te(objwithin) '%).'
elseif( sameas(objwithin,'0')),
put / '
Only best objective value (i.e. ' objwithin.te(objwithin):0 ' % of best solution found.'
/ ' Actual tolerance used is %delta% using relative error)';
else
put / '
Relative objective value error is within ' objwithin.te(objwithin):0 '% with respect to best value.';
);
);
put / '
';
put / 'There is a curve for an additional super solver shown:' /
/ '
'
/ '
'
/ '
CAN_SOLVE: solver consisting of all solvers. Solver time '
/ ' used is the minimum of all solver times for a given model.'
/ '
'
/ '';
loop(objwithin,
if( sameas(objwithin,'Inf'),
put
/'
'
);
);
*== Add absolute time profile plots
put / '
Absolute Time Performance Profile Summary
'
/ '
Below are absolute time performance profile plots. In this case, the '
/ 'performance metric uses absolute time instead of the fastest solver time. That is '
/ 'a model/solver pair passes if it solves the problem within the absolute time given. '
/ 'Objective value tolerances used are the same as for the regular performance profile '
/ 'plots as above.'
$if not set allsolver $goto skipallsolverhtml
/ 'There are curves for three additional super solvers shown: '
/ '
'
/ '
ALL_SEQ: solver consisting of all solvers run in sequence. Solver time '
/ ' used is the sum of all solver times.'
/ '
ALL_PAR: solver consisting of all solvers run in parallel. Solver time '
/ ' used is the max over all solver times.'
/ '
' ;
$label skipallsolverhtml
put / '';
loop(objwithin,
if( sameas(objwithin,'Inf'),
put
/'
Performance profiles for different objective value tolerances.'
/ 'The profile utility compares solver outcomes of any number of given '
/ 'solvers (up to 8) over a model test set. The tool is described in detail'
/ 'at '
/ 'http://www.gamsworld.eu/performance/pprofile.htm.
';
put / '
A solver is considered feasible or optimal, if it has the proper model'
/ 'and solver return codes and the relative objective value error is within'
/ 'n % of the best possible solution. If the best found objective'
/ 'value is 0, then the absolute objective value error is used.
';
put / '
'
/ 'The following resource is used as measurement: ';
$if not set colselect
put / 'from solver reported time'
$if set colselect
put / '%colselect%'
put / '
'
/ 'The following relative objective value tolerances are used:'
/ '
';
loop(objwithin,
if( sameas(objwithin,'Inf'),
put / '
No objective value tolerance, i.e. we do not check if obj '
/ 'is best found (within ' objwithin.te(objwithin) '%).'
elseif( sameas(objwithin,'0')),
put / '
Only best objective value (i.e. ' objwithin.te(objwithin):0 ' %'
/ 'of best solution found. Actual tolerance used is %delta% using relative error)';
else
put / '
Relative objective value error is within ' objwithin.te(objwithin):0 '%'
/ ' with respect to best value.';
);
);
put / '
';
$ifthen not %useobjest% == 0
put / '
The following gap tolerances are used:'
/ '
';
loop(gapwithin,
if( sameas(gapwithin,'Inf'),
put / '
No gap tolerance, i.e. we do not check if the gap is closed to a'
/ 'certain value (within ' gapwithin.te(gapwithin) '%).'
elseif( sameas(gapwithin,'0')),
put / '
Only closed gap (Actual tolerance used is %gaptol% '
/ 'using relative distance)';
else
put / '
Relative gap is at most ' gapwithin.te(gapwithin):0 '%.';
);
);
put / '
';
$endif
loop((objwithin,gapwithin)$objgapwithin(objwithin,gapwithin),
put /'
'
/'
'
/'
';
if( sameas(objwithin,'Inf') and sameas(gapwithin,'Inf'),
put
/' Efficiency Only (within ' objwithin.te(objwithin):0 '% wrt to best value) ';
$if not %useobjest% == 0
put ', gap at most ' gapwithin.te(gapwithin):0 '%)';
elseif( sameas(objwithin,'0') or not sameas(gapwithin,'Inf')),
put
/' Quality of Solution (within ' objwithin.te(objwithin):0 '% wrt to best value';
$if not %useobjest% == 0
put ', gap at most ' gapwithin.te(gapwithin):0 '%) ';
else
put
/ ' (Within ' objwithin.te(objwithin):0 '% wrt to best value';
$if not %useobjest% == 0
put ', gap at most ' gapwithin.te(gapwithin):0 '%)