diff --git a/ilp-measurement.ipynb b/ilp-measurement.ipynb index 4354d55ba05e41ec4648a9f8c844757d9126303a..8fd8468bcbc7d147697709dad50b17afe37ad397 100644 --- a/ilp-measurement.ipynb +++ b/ilp-measurement.ipynb @@ -304,19 +304,19 @@ "name": "stdout", "output_type": "stream", "text": [ - "Loaded 1320 record(s) for update_normal_plt-r6rs (8x31 unique) ~= 5 run(s)\n", + "Loaded 1568 record(s) for update_normal_plt-r6rs (8x31 unique) ~= 6 run(s)\n", "Loaded 504 record(s) for update_flush_plt-r6rs (8x31 unique) ~= 2 run(s)\n", "Loaded 600 record(s) for update_noncached_plt-r6rs (8x31 unique) ~= 2 run(s)\n", - "Loaded 364 record(s) for sw_normal_plt-r6rs (7x31 unique) ~= 1 run(s)\n", + "Loaded 581 record(s) for sw_normal_plt-r6rs (7x31 unique) ~= 2 run(s)\n", "Loaded 245 record(s) for sw_flush_plt-r6rs (7x31 unique) ~= 1 run(s)\n", "Loaded 602 record(s) for sw_noncached_plt-r6rs (7x31 unique) ~= 2 run(s)\n", - "Loaded 360 record(s) for res_normal_plt-r6rs (7x31 unique) ~= 1 run(s)\n", + "Loaded 577 record(s) for res_normal_plt-r6rs (7x31 unique) ~= 2 run(s)\n", "Loaded 245 record(s) for res_flush_plt-r6rs (7x31 unique) ~= 1 run(s)\n", "Loaded 609 record(s) for res_noncached_plt-r6rs (7x31 unique) ~= 2 run(s)\n", "Loaded 242 record(s) for complex_normal_plt-r6rs (11x11 unique) ~= 2 run(s)\n", "Loaded 121 record(s) for complex_flush_plt-r6rs (11x11 unique) ~= 1 run(s)\n", "Loaded 121 record(s) for complex_noncached_plt-r6rs (11x11 unique) ~= 1 run(s)\n", - "Loaded 200 record(s) for mixed_normal_plt-r6rs (100x2 unique) ~= 1 run(s)\n", + "Loaded 400 record(s) for mixed_normal_plt-r6rs (100x2 unique) ~= 2 run(s)\n", "Loaded 359 record(s) for mixed_flush_plt-r6rs (100x2 unique) ~= 1 run(s)\n", "Loaded 200 record(s) for mixed_noncached_plt-r6rs (100x2 unique) ~= 1 run(s)\n", "Loaded 512 record(s) for update_normal_larceny (8x31 unique) ~= 2 run(s)\n", @@ -360,7 +360,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 15, "metadata": { "collapsed": false, "scrolled": true @@ -375,16 +375,22 @@ "Loaded no data for res_java\n", "Loaded no data for complex_java\n", "Loaded no data for mixed_java\n", - "Loaded 1656 record(s) for update_glpk (8x23 unique) ~= 9 run(s)\n", - "Loaded no data for sw_glpk\n", - "Loaded no data for res_glpk\n", - "Loaded no data for complex_glpk\n", - "Loaded no data for mixed_glpk\n", - "Loaded 216 record(s) for update_gurobi (8x27 unique) ~= 1 run(s)\n", - "Loaded no data for sw_gurobi\n", - "Loaded no data for res_gurobi\n", - "Loaded no data for complex_gurobi\n", - "Loaded no data for mixed_gurobi\n" + "Loaded 1912 record(s) for update_glpk (8x31 unique) ~= 7 run(s)\n", + "Loaded 235 record(s) for sw_glpk (7x31 unique) ~= 1 run(s)\n" + ] + }, + { + "ename": "IndexError", + "evalue": "tuple index out of range", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mIndexError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m<ipython-input-15-af2bf1536a93>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[0mjava_glpk_dats\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mread_sol_results\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'java'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0msince\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mdatetime\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m2015\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m6\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m22\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 2\u001b[1;33m \u001b[0mglpk_dats\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mread_sol_results\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'glpk'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 3\u001b[0m \u001b[0mgurobi_dats\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mread_sol_results\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'gurobi'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;32m<ipython-input-11-3738473b7378>\u001b[0m in \u001b[0;36mread_sol_results\u001b[1;34m(solver, since)\u001b[0m\n\u001b[0;32m 3\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mread_sol_results\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msolver\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0msince\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mNone\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 4\u001b[0m return read_results('sol', solver, ('datetime64[us]', int, int, int, int, int, float, float), 7, since,\n\u001b[1;32m----> 5\u001b[1;33m splitted = split_change_only)\n\u001b[0m", + "\u001b[1;32m<ipython-input-10-b4f10b934785>\u001b[0m in \u001b[0;36mread_results\u001b[1;34m(prefix, name, dtype, data_column, since, splitted)\u001b[0m\n\u001b[0;32m 42\u001b[0m \u001b[0mnew_name\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;34m'{0}_{1}'\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mchange\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mname\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 43\u001b[0m \u001b[0mf\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;34m'profiling/splitted/{0}_{1}.csv'\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mprefix\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mnew_name\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 44\u001b[1;33m \u001b[0mresult\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mchange\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mread_single_result\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mf\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mnew_name\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdtype\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdata_column\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0msince\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 45\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0mresult\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 46\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m \u001b[1;31m# splitted = no_split\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;32m<ipython-input-10-b4f10b934785>\u001b[0m in \u001b[0;36mread_single_result\u001b[1;34m(f, name, dtype, data_column, since)\u001b[0m\n\u001b[0;32m 22\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mlen_dat\u001b[0m \u001b[1;33m>\u001b[0m \u001b[1;36m1\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 23\u001b[0m print 'Loaded {0} record(s) for {1} ({2[0]}x{2[1]} unique) ~= {3} run(s)'.format(\n\u001b[1;32m---> 24\u001b[1;33m len_dat, name, dat2.shape, safe_div(len_dat,dat2.size))\n\u001b[0m\u001b[0;32m 25\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 26\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;34m'Loaded no data for {}'\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mname\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mIndexError\u001b[0m: tuple index out of range" ] } ], @@ -396,7 +402,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "metadata": { "collapsed": true }, @@ -409,7 +415,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "metadata": { "collapsed": false, "scrolled": false @@ -475,7 +481,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "metadata": { "collapsed": false }, @@ -535,7 +541,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "metadata": { "collapsed": false, "scrolled": true @@ -567,7 +573,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "metadata": { "collapsed": true }, @@ -621,7 +627,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "metadata": { "collapsed": true }, @@ -648,7 +654,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "metadata": { "collapsed": false }, @@ -695,34 +701,18 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "metadata": { "collapsed": false, "scrolled": false }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "java:\n", - " mixed,normal,flush,noncached\n", - "\n", - "racket:\n", - " mixed,normal,flush,noncached\n", - "\n", - "larceny:\n", - " mixed,normal,flush,noncached\n" - ] - } - ], + "outputs": [], "source": [ "for (data, name) in ((java_dats, 'java'), (racket_dats, 'racket'), (larceny_dats, 'larceny')):\n", " sys.stdout.write('\\n{}:'.format(name))\n", - " change, strategy = 'mixed', 'normal'\n", - "# for change in kinds['changes']:\n", - " if True:\n", + "# change, strategy = 'mixed', 'normal'\n", + "# if True:\n", + " for change in kinds['changes']:\n", " if change == 'complex':\n", " continue\n", " sys.stdout.write('\\n {}'.format(change))\n", @@ -748,6 +738,49 @@ " print ''" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Boxplots for solving times" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false, + "scrolled": false + }, + "outputs": [], + "source": [ + "for (data, name) in ((java_glpk_dats, 'java'), (glpk_dats, 'scheme-glpk'), (gurobi_dats, 'glpk-gurobi')):\n", + " sys.stdout.write('\\n{}:'.format(name))\n", + "# change = 'mixed'\n", + "# if True:\n", + " for change in kinds['changes']:\n", + " if change == 'complex':\n", + " continue\n", + " sys.stdout.write('\\n {}'.format(change))\n", + " cdat = data[change]\n", + " bp = plt.boxplot(cdat.transpose(), patch_artist=True)\n", + " setBoxColors(bp, 'black', newstyle=True, linewidth=1)\n", + " axes = plt.gca()\n", + " axes.set_ylim([0,50])\n", + "# plt.title('{0} {1} {2}'.format(name.title(), change_to_title(change), strategy_to_titel(strategy)))\n", + " plt.ylabel('seconds')\n", + " plt.xlabel('step')\n", + " if change == 'mixed':\n", + " for i, label in enumerate(axes.get_xticklabels()):\n", + " label.set_visible(i==0 or (i+1) % 10 == 0)\n", + "# plt.gca().tick_params(axis='x', direction='out', top = 'off', bottom = 'on')\n", + " plt.gca().tick_params(axis='x', top = 'off', bottom = 'off')\n", + " plt.savefig('pngs/sol_bp_{0}_{1}.png'.format(name,change))\n", + " plt.savefig('doc/sol_bp_{0}_{1}.pdf'.format(name,change))\n", + " plt.close()\n", + " print ''" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -757,22 +790,11 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - " update\n", - " res\n", - " sw" - ] - } - ], + "outputs": [], "source": [ "width = 0.6\n", "name = 'racket'\n", @@ -820,24 +842,11 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "java:\n", - "update sw res complex mixed \n", - "glpk:\n", - "update sw res complex mixed \n", - "gurobi:\n", - "update sw res complex mixed \n" - ] - } - ], + "outputs": [], "source": [ "for (data, name) in ((java_glpk_dats, 'java'), (glpk_dats, 'glpk'), (gurobi_dats, 'gurobi')):\n", " print name+':'\n", @@ -869,7 +878,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "metadata": { "collapsed": true }, @@ -905,30 +914,12 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": null, "metadata": { "collapsed": false, "scrolled": true }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Loaded 106 (0 zero-values) attribute metric run(s) from profiling/att-percentages.csv\n" - ] - }, - { - "data": { - "text/plain": [ - "dtype([('dir', '<f8'), ('normalBaseline', '<f8'), ('flushedBaseline', '<f8'), ('noncachedBaseline', '<f8'), ('ratioNormalToFlushed', '<f8'), ('ratioNormalToNoncached', '<f8'), ('ratioFlushedToNoncached', '<f8'), ('speedupNormalToFlushed', '<f8'), ('speedupNormalToNoncached', '<f8'), ('speedupFlushedToNoncached', '<f8')])" - ] - }, - "execution_count": 26, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "att_dat = read_att_result()\n", "att_dat.dtype" @@ -944,7 +935,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": null, "metadata": { "collapsed": false, "scrolled": false @@ -978,7 +969,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": null, "metadata": { "collapsed": false }, @@ -1012,7 +1003,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": null, "metadata": { "collapsed": false, "scrolled": true @@ -1045,23 +1036,12 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": null, "metadata": { "collapsed": false, "scrolled": false }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Loaded 31 (0 zero-values) attribute metric run(s) from profiling/splitted/att-percentages_update.csv\n", - "Loaded 31 (0 zero-values) attribute metric run(s) from profiling/splitted/att-percentages_sw.csv\n", - "Loaded 31 (0 zero-values) attribute metric run(s) from profiling/splitted/att-percentages_res.csv\n", - "Loaded 2 (0 zero-values) attribute metric run(s) from profiling/splitted/att-percentages_mixed.csv\n" - ] - } - ], + "outputs": [], "source": [ "att_totals = {change: read_att_result(name = 'profiling/splitted/att-percentages_{}.csv'.format(change),\n", " adjust_number = False) for change in kinds['changes'] if change != 'complex'}" @@ -1069,7 +1049,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": null, "metadata": { "collapsed": true }, @@ -1080,7 +1060,7 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": null, "metadata": { "collapsed": false }, @@ -1131,21 +1111,11 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": null, "metadata": { "collapsed": false }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Drawing cache-miss rate\n", - "Drawing ratios\n", - "Drawing speed-ups\n" - ] - } - ], + "outputs": [], "source": [ "def baseline(x):\n", " return '{}Baseline'.format('flushed' if x == 'flush' else x)\n", @@ -1168,7 +1138,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": null, "metadata": { "collapsed": true }, @@ -1202,7 +1172,7 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": null, "metadata": { "collapsed": false }, diff --git a/ilp_measurement.py b/ilp_measurement.py index a56f52895bc1128fb112b2d1c172f27f743d8c23..4c822664bc1f17f36f6e82d359650ff04da7a35f 100644 --- a/ilp_measurement.py +++ b/ilp_measurement.py @@ -29,16 +29,18 @@ all_att_header = ['dir', 'attname', 'normalex', 'normalcalled', 'flushedex', 'f all_results = 'all.csv' class timed(object): - def __enter__(self, what = 'measurement', msg = ' done in {0:.3f}s'): - print 'Starting {} at {:%d, %b %Y at %H:%M:%S.%f}'.format(what, datetime.today()) + def __init__(self, what = 'measurement'): + self.what = what + def __enter__(self, msg = ' done in {0:.3f}s'): + print 'Starting {} at {:%d, %b %Y at %H:%M:%S.%f}'.format(self.what, datetime.today()) self.start = timeit.default_timer() self.msg = msg - self.what = what +# self.what = what return self def __exit__(self, ex_type, value, traceback): self.stop = timeit.default_timer() - self.start print self.msg.format(self.stop) - print 'Finished {} at {:%d, %b %Y at %H:%M:%S.%f}'.format(what, datetime.today()) + print 'Finished {} at {:%d, %b %Y at %H:%M:%S.%f}'.format(self.what, datetime.today()) @task(name = 'current-ids') def current_ids():