Notice: Array to string conversion in /usr/share/mediawiki/includes/api/ApiBase.php on line 283

Notice: Array to string conversion in /usr/share/mediawiki/includes/api/ApiBase.php on line 283

Notice: Array to string conversion in /usr/share/mediawiki/includes/api/ApiBase.php on line 283

Notice: Array to string conversion in /usr/share/mediawiki/includes/api/ApiBase.php on line 283

Notice: Array to string conversion in /usr/share/mediawiki/includes/api/ApiBase.php on line 283

Notice: Array to string conversion in /usr/share/mediawiki/includes/api/ApiBase.php on line 283
MediaWiki API Result
You are looking at the HTML representation of the XML format.
HTML is good for debugging, but probably is not suitable for your application.
See complete documentation, or API help for more information.
<?xml version="1.0"?>
<api>
  <query-continue>
    <allpages gapfrom="Robot labs around the World" />
  </query-continue>
  <query>
    <pages>
      <page pageid="1509" ns="0" title="Repository of R scripts used by IRIDIA members">
        <revisions>
          <rev xml:space="preserve">==Max's scripts==

===Boxplot of solution values by algorithm===

[[Image:Tai100a 1000.png]]

I organize the data in the following way:

in the file '''optimal_values.txt''' I put the best-known solution values for the problem instances I'm testing
&lt;pre&gt;
cat optimal_values.txt 

instance   optimum 
sko100a    152002 
sko100e    149150 
tai100a    21059006 
tai100b    1185996137 
&lt;/pre&gt;


in the files '''algorithm_factors_instance-size_cut-time.txt''' I record the history of the search of the algo for the instance
&lt;pre&gt;
 head sequential_2-opt_100_8000.txt 

idalgo          topo    schema  ls      type    cpu_id  instance        try     best    time    iteration
SEQ-2opt        SEQ     SEQ     2       Seq     0       sko100a         1       155468  0.31    1
SEQ-2opt        SEQ     SEQ     2       Seq     0       sko100a         1       155390  0.31    1
SEQ-2opt        SEQ     SEQ     2       Seq     0       sko100a         1       155000  0.31    1
SEQ-2opt        SEQ     SEQ     2       Seq     0       sko100a         1       154934  0.64    2
SEQ-2opt        SEQ     SEQ     2       Seq     0       sko100a         1       154608  0.97    3
SEQ-2opt        SEQ     SEQ     2       Seq     0       sko100a         1       153958  1.27    4
SEQ-2opt        SEQ     SEQ     2       Seq     0       sko100a         1       153750  1.93    6
SEQ-2opt        SEQ     SEQ     2       Seq     0       sko100a         1       153720  1.93    6
SEQ-2opt        SEQ     SEQ     2       Seq     0       sko100a         1       153634  2.57    8
&lt;/pre&gt;

In order to produce boxplots like the one above you can look at the R source used to produce it.  


&lt;pre&gt;
optimal_values&lt;-read.table(&quot;optimal_values_100.txt&quot;,header=TRUE)
resPIR2OPT&lt;-read.table(&quot;parallel_independent_2-opt_100_100.txt&quot;,header=TRUE)
resSEQ2OPT&lt;-read.table(&quot;sequential_2-opt_100_800.txt&quot;,header=TRUE)
resSEQ22OPT&lt;-read.table(&quot;sequential2_2-opt_100_100.txt&quot;,header=TRUE)
resFC1x102OPT&lt;-read.table(&quot;fc.1.x.10_2-opt_100_100.txt&quot;,header=TRUE)
resFC26102OPT&lt;-read.table(&quot;fc.2.6.10_2-opt_100_100.txt&quot;,header=TRUE)
resFC27102OPT&lt;-read.table(&quot;fc.2.7.10_2-opt_100_100.txt&quot;,header=TRUE)
resFC28102OPT&lt;-read.table(&quot;fc.2.8.10_2-opt_100_100.txt&quot;,header=TRUE)
resFC29102OPT&lt;-read.table(&quot;fc.2.9.10_2-opt_100_100.txt&quot;,header=TRUE)
resFC36102OPT&lt;-read.table(&quot;fc.3.6.10_2-opt_100_100.txt&quot;,header=TRUE)
resFC37102OPT&lt;-read.table(&quot;fc.3.7.10_2-opt_100_100.txt&quot;,header=TRUE)
resFC38102OPT&lt;-read.table(&quot;fc.3.8.10_2-opt_100_100.txt&quot;,header=TRUE)
resFC39102OPT&lt;-read.table(&quot;fc.3.9.10_2-opt_100_100.txt&quot;,header=TRUE)
resHC1x102OPT&lt;-read.table(&quot;hc.1.x.10_2-opt_100_100.txt&quot;,header=TRUE)
resHC26102OPT&lt;-read.table(&quot;hc.2.6.10_2-opt_100_100.txt&quot;,header=TRUE)
resHC27102OPT&lt;-read.table(&quot;hc.2.7.10_2-opt_100_100.txt&quot;,header=TRUE)
resHC28102OPT&lt;-read.table(&quot;hc.2.8.10_2-opt_100_100.txt&quot;,header=TRUE)
resHC29102OPT&lt;-read.table(&quot;hc.2.9.10_2-opt_100_100.txt&quot;,header=TRUE)
resHC36102OPT&lt;-read.table(&quot;hc.3.6.10_2-opt_100_100.txt&quot;,header=TRUE)
resHC37102OPT&lt;-read.table(&quot;hc.3.7.10_2-opt_100_100.txt&quot;,header=TRUE)
resHC38102OPT&lt;-read.table(&quot;hc.3.8.10_2-opt_100_100.txt&quot;,header=TRUE)
resHC39102OPT&lt;-read.table(&quot;hc.3.9.10_2-opt_100_100.txt&quot;,header=TRUE)
resRW1x102OPT&lt;-read.table(&quot;rw.1.x.10_2-opt_100_100.txt&quot;,header=TRUE)
resRW26102OPT&lt;-read.table(&quot;rw.2.6.10_2-opt_100_100.txt&quot;,header=TRUE)
resRW27102OPT&lt;-read.table(&quot;rw.2.7.10_2-opt_100_100.txt&quot;,header=TRUE)
resRW28102OPT&lt;-read.table(&quot;rw.2.8.10_2-opt_100_100.txt&quot;,header=TRUE)
resRW29102OPT&lt;-read.table(&quot;rw.2.9.10_2-opt_100_100.txt&quot;,header=TRUE)
resRW36102OPT&lt;-read.table(&quot;rw.3.6.10_2-opt_100_100.txt&quot;,header=TRUE)
resRW37102OPT&lt;-read.table(&quot;rw.3.7.10_2-opt_100_100.txt&quot;,header=TRUE)
resRW38102OPT&lt;-read.table(&quot;rw.3.8.10_2-opt_100_100.txt&quot;,header=TRUE)
resRW39102OPT&lt;-read.table(&quot;rw.3.9.10_2-opt_100_100.txt&quot;,header=TRUE)
resUR1x102OPT&lt;-read.table(&quot;ur.1.x.10_2-opt_100_100.txt&quot;,header=TRUE)
resUR26102OPT&lt;-read.table(&quot;ur.2.6.10_2-opt_100_100.txt&quot;,header=TRUE)
resUR27102OPT&lt;-read.table(&quot;ur.2.7.10_2-opt_100_100.txt&quot;,header=TRUE)
resUR28102OPT&lt;-read.table(&quot;ur.2.8.10_2-opt_100_100.txt&quot;,header=TRUE)
resUR29102OPT&lt;-read.table(&quot;ur.2.9.10_2-opt_100_100.txt&quot;,header=TRUE)
resUR36102OPT&lt;-read.table(&quot;ur.3.6.10_2-opt_100_100.txt&quot;,header=TRUE)
resUR37102OPT&lt;-read.table(&quot;ur.3.7.10_2-opt_100_100.txt&quot;,header=TRUE)
resUR38102OPT&lt;-read.table(&quot;ur.3.8.10_2-opt_100_100.txt&quot;,header=TRUE)
resUR39102OPT&lt;-read.table(&quot;ur.3.9.10_2-opt_100_100.txt&quot;,header=TRUE)

res&lt;-rbind(resFC1x102OPT,resFC26102OPT,resFC27102OPT,resFC28102OPT,resFC29102OPT,resFC36102OPT,
resFC37102OPT,resFC38102OPT,resFC39102OPT,resRW1x102OPT,resRW26102OPT,resRW27102OPT,resRW28102OPT,
resRW29102OPT,resRW36102OPT,resRW37102OPT,resRW38102OPT,resRW39102OPT,resHC1x102OPT,resHC26102OPT,
resHC27102OPT,resHC28102OPT,resHC29102OPT,resHC36102OPT,resHC37102OPT,resHC38102OPT,resHC39102OPT,
resUR1x102OPT,resUR26102OPT,resUR27102OPT,resUR28102OPT,resUR29102OPT,resUR36102OPT,resUR37102OPT,
resUR38102OPT,resUR39102OPT,resPIR2OPT,resSEQ2OPT,resSEQ22OPT)

linstance&lt;-levels(res$instance)

res.split&lt;-split(1:nrow(res), list(res$instance, res$try, res$idalgo), drop=TRUE)

min.list &lt;- lapply(res.split, function(x){
        x[match(min(res$best[x]), res$best[x])]
        })

min.vector &lt;- unlist(min.list)

bestalgo&lt;-res[min.vector,]

bestalgo.split &lt;- split(1:nrow(bestalgo), bestalgo$instance, drop=TRUE)

for (i in (1:length(bestalgo.split)))
{
        bestalgo.vector &lt;- unlist(bestalgo.split[i])
        bestalgo.temp &lt;- bestalgo[bestalgo.vector,]
        l&lt;-split(bestalgo.temp$best,bestalgo.temp$idalgo)

        epsfile=paste(linstance[i],&quot;_100_nolim.eps&quot;,sep=&quot;&quot;)
        postscript(file=epsfile,onefile=TRUE,horizontal=TRUE)
        par(mar=c(5,5,5,3),cex.axis=0.7,las=2,mgp=c(4, 1, 0))
        title_plot=paste(&quot;100 iterations - instance &quot;,linstance[i],sep=&quot;&quot;)
        boxplot(l,xlab=&quot;&quot;,ylab=&quot;solution value&quot;,names=c(levels(bestalgo$idalgo)),main=title_plot,
                yaxt=&quot;n&quot;,ylim=c(optimal_values[optimal_values$instance==linstance[i],]$optimum,max(bestalgo.temp$best)))
        axis(2, seq(from=optimal_values[optimal_values$instance==linstance[i],]$optimum,to=max(bestalgo.temp$best),length.out=10))
        abline(h=optimal_values[optimal_values$instance==linstance[i],]$optimum)
        # draw an orizontal line at the y-level of the best-know solution value
        grid(nx=0, ny=55,col=&quot;gray5&quot;)
        dev.off()
}
&lt;/pre&gt;

====Things to improve====

Use a separate text file that contains all the id data on an algorithm (idalgo, topo,  schema, ls, type) to reduce the size of the results text files (for the QAP experiments I obtained something like 500MB of text results files, half of which are redundant data)
&lt;pre&gt;
result.txt should look like:
idalgo          cpu_id  instance        try     best    time    iteration
^^^^^^                  ^^^^^^^^
algorithms.txt should look like:
idalgo          topo    schema  ls      type    number_of_cpus 
^^^^^

instances.txt should look like:
instance       best-known-solution-value
^^^^^^^^
&lt;/pre&gt;</rev>
        </revisions>
      </page>
      <page pageid="1511" ns="0" title="Repository of scripts used by IRIDIA members">
        <revisions>
          <rev xml:space="preserve">==Max's scripts==

When testing different algorithms on some combinatorial optimization problem, I usually organize the data on my machine according to a same schema. Basically I create the following structure of directories to store sources, problem instances, output data, executables and scripts.
&lt;pre&gt;
+ main_project_folder
|
|-+ bin   (contains the executables of the algorithms)
|
|-+ instances   (contains the problem instances)
|
|-+ out   (contains the outputs of the trial)
| |
| |-+ algorithm1
| | |
| | |-+ instance1
| | | 
| | |-+ instance2
| |
| |-+ algorithm2
|   |
|   |-+ instance1
|   | 
|   |-+ instance2
|
|-+ sh   (contains the script to launch the experiments)
|
|-+ src   (contains the sources of the algorithms)
| |
| |-+ algorithm1
| | 
| |-+ algorithm2
|
|-+ analysis    (contains the R script to boxplot the experimental data)
&lt;/pre&gt;



===Boxplot of solution values by algorithm===

[[Image:Tai100a 1000.png]]

I organize the data in the following way:

in the file '''optimal_values.txt''' I put the best-known solution values for the problem instances I'm testing
&lt;pre&gt;
instance   optimum 
sko100a    152002 
sko100e    149150 
tai100a    21059006 
tai100b    1185996137 
&lt;/pre&gt;


in the files '''algorithms.txt''' I put the algorithms details
&lt;pre&gt;
idalgo          topo    schema  ls      type    number_of_cpus
PIR-2opt        PIR     PIR     2       Par     2
PIR-ts          PIR     PIR     3       Par     2
SEQ-2opt        SEQ     SEQ     2       Par     2
SEQ-ts          SEQ     SEQ     3       Par     2
SEQ2-2opt       SEQ     SEQ     2       Par     2
SEQ2-ts         SEQ     SEQ     3       Par     2
HC.1.x.10-2opt  HC      1.x.10  2       Par     2
HC.2.6.10-2opt  HC      2.6.10  2       Par     2
HC.2.7.10-2opt  HC      2.7.10  2       Par     2
&lt;/pre&gt;


in the files '''algorithm_factors_instance-size_cut-time.txt''' I record the history of the search of the algo for the instance
&lt;pre&gt;
idalgo          cpu_id  instance        try     best    time    iteration
HC.1.x.10-2opt  0       sko100a         1       155254  0.35    1
HC.1.x.10-2opt  0       sko100a         1       154162  0.35    1
HC.1.x.10-2opt  0       sko100a         1       154050  0.35    1
HC.1.x.10-2opt  0       sko100a         1       153684  2.69    8
HC.1.x.10-2opt  0       sko100a         1       153508  3.24    10
HC.1.x.10-2opt  0       sko100a         1       153396  3.24    10
HC.1.x.10-2opt  0       sko100a         1       153344  3.24    10
HC.1.x.10-2opt  0       sko100a         1       153092  3.52    11
HC.1.x.10-2opt  0       sko100a         1       153062  3.75    12
&lt;/pre&gt;

In order to produce boxplots like the one above you can look at the R source used to produce it.  


&lt;pre&gt;
optimal_values&lt;-read.table(&quot;optimal_values.txt&quot;,header=TRUE)

resPIR2OPT&lt;-read.table(&quot;parallel_independent_2-opt_100_1000.txt&quot;,header=TRUE)
resSEQ2OPT&lt;-read.table(&quot;sequential_2-opt_100_2000.txt&quot;,header=TRUE)
resSEQ22OPT&lt;-read.table(&quot;sequential2_2-opt_100_1000.txt&quot;,header=TRUE)
resHC1x102OPT&lt;-read.table(&quot;hc.1.x.10_2-opt_100_1000.txt&quot;,header=TRUE)
resHC26102OPT&lt;-read.table(&quot;hc.2.6.10_2-opt_100_1000.txt&quot;,header=TRUE)
resHC27102OPT&lt;-read.table(&quot;hc.2.7.10_2-opt_100_1000.txt&quot;,header=TRUE)
resHC28102OPT&lt;-read.table(&quot;hc.2.8.10_2-opt_100_1000.txt&quot;,header=TRUE)
resHC29102OPT&lt;-read.table(&quot;hc.2.9.10_2-opt_100_1000.txt&quot;,header=TRUE)
resHC36102OPT&lt;-read.table(&quot;hc.3.6.10_2-opt_100_1000.txt&quot;,header=TRUE)
resHC37102OPT&lt;-read.table(&quot;hc.3.7.10_2-opt_100_1000.txt&quot;,header=TRUE)
resHC38102OPT&lt;-read.table(&quot;hc.3.8.10_2-opt_100_1000.txt&quot;,header=TRUE)
resHC39102OPT&lt;-read.table(&quot;hc.3.9.10_2-opt_100_1000.txt&quot;,header=TRUE)
resRW1x102OPT&lt;-read.table(&quot;rw.1.x.10_2-opt_100_1000.txt&quot;,header=TRUE)
resRW26102OPT&lt;-read.table(&quot;rw.2.6.10_2-opt_100_1000.txt&quot;,header=TRUE)
resRW27102OPT&lt;-read.table(&quot;rw.2.7.10_2-opt_100_1000.txt&quot;,header=TRUE)
resRW28102OPT&lt;-read.table(&quot;rw.2.8.10_2-opt_100_1000.txt&quot;,header=TRUE)
resRW29102OPT&lt;-read.table(&quot;rw.2.9.10_2-opt_100_1000.txt&quot;,header=TRUE)
resRW36102OPT&lt;-read.table(&quot;rw.3.6.10_2-opt_100_1000.txt&quot;,header=TRUE)
resRW37102OPT&lt;-read.table(&quot;rw.3.7.10_2-opt_100_1000.txt&quot;,header=TRUE)
resRW38102OPT&lt;-read.table(&quot;rw.3.8.10_2-opt_100_1000.txt&quot;,header=TRUE)
resRW39102OPT&lt;-read.table(&quot;rw.3.9.10_2-opt_100_1000.txt&quot;,header=TRUE)

res&lt;-rbind(resRW1x102OPT,resRW26102OPT,resRW27102OPT,resRW28102OPT,resRW29102OPT,
resRW36102OPT,resRW37102OPT,resRW38102OPT,resRW39102OPT,resHC1x102OPT,resHC26102OPT,
resHC27102OPT,resHC28102OPT,resHC29102OPT,resHC36102OPT,resHC37102OPT,resHC38102OPT,
resHC39102OPT,resPIR2OPT,resSEQ2OPT,resSEQ22OPT)


linstance&lt;-levels(res$instance)

res.split&lt;-split(1:nrow(res), list(res$instance, res$try, res$idalgo), drop=TRUE)

min.list &lt;- lapply(res.split, function(x){
        x[match(min(res$best[x]), res$best[x])]
        })

# matches return the first among all the values with min best!!!
# so is not the one with minimal time

min.vector &lt;- unlist(min.list)

bestalgo&lt;-res[min.vector,]

bestalgo.split &lt;- split(1:nrow(bestalgo), bestalgo$instance, drop=TRUE)

for (i in (1:length(bestalgo.split)))
{
        bestalgo.vector &lt;- unlist(bestalgo.split[i])
        bestalgo.temp &lt;- bestalgo[bestalgo.vector,]
        l&lt;-split(as.double(bestalgo.temp$best),bestalgo.temp$idalgo)

        epsfile=paste(linstance[i],&quot;_1000.eps&quot;,sep=&quot;&quot;)
        postscript(file=epsfile,onefile=TRUE,horizontal=TRUE)
        par(mar=c(5,5,5,3),cex.axis=0.7,las=2,mgp=c(4, 1, 0))
        title_plot=paste(&quot;2 CPU - 1000 iterations - instance &quot;,linstance[i],sep=&quot;&quot;)
        boxplot(l,xlab=&quot;&quot;,ylab=&quot;solution value&quot;,names=c(levels(bestalgo$idalgo)),main=title_plot,
yaxt=&quot;n&quot;,ylim=c(min(min(bestalgo.temp$best),optimal_values[optimal_values$instance==linstance[i],]$optimum),
max(bestalgo.temp$best)))
        axis(2, seq(from=min(min(bestalgo.temp$best),optimal_values[optimal_values$instance==linstance[i],]$optimum),
to=max(bestalgo.temp$best),length.out=10))
        abline(h=optimal_values[optimal_values$instance==linstance[i],]$optimum)
        grid(nx=0, ny=55,col=&quot;gray5&quot;)
        dev.off()
}
&lt;/pre&gt;</rev>
        </revisions>
      </page>
    </pages>
  </query>
</api>