import urllib
import tarfile
from pylab import *
ion() # may be needed for figures to be shown when executing the script

import bbob_pproc as bb

# Collect and unarchive data (~20MB)
dataurl = 'http://coco.lri.fr/BBOB2009/rawdata/BIPOP-CMA-ES_hansen_noiseless.tar.gz'
filename, headers = urllib.urlretrieve(dataurl)
archivefile = tarfile.open(filename)
archivefile.extractall()

# Display some information
ds = bb.load('BBOB2009rawdata/BIPOP-CMA-ES_hansen_noiseless/bbobexp_f2.info')
print ds

# Collect and unarchive data (3.4MB)
dataurl = 'http://coco.lri.fr/BBOB2009/pythondata/BIPOP-CMA-ES.tar.gz'
filename, headers = urllib.urlretrieve(dataurl)
archivefile = tarfile.open(filename)
archivefile.extractall()

# Load a pickle file
ds = bb.load('BBOB2009pythondata/BIPOP-CMA-ES/ppdata_f002_20.pickle')
# Load a folder
ds = bb.load('BBOB2009rawdata/BIPOP-CMA-ES_hansen_noiseless')

# Load data using a wildcard
import glob
示例#2
0
import urllib
import tarfile
from pylab import *
ion() # may be needed for figures to be shown when executing the script

import bbob_pproc as bb

# Collect and unarchive data (~20MB)
dataurl = 'http://coco.gforge.inria.fr/data-archive/2009/BIPOP-CMA-ES_hansen_noiseless.tgz'
filename, headers = urllib.urlretrieve(dataurl)
archivefile = tarfile.open(filename)
archivefile.extractall()

# Display some information
ds = bb.load('BIPOP-CMA-ES/bbobexp_f2.info')
print ds

# Collect and unarchive data (3.4MB)
dataurl = 'http://coco.lri.fr/BBOB2009/pythondata/BIPOP-CMA-ES.tar.gz'
filename, headers = urllib.urlretrieve(dataurl)
archivefile = tarfile.open(filename)
archivefile.extractall()

# Load a pickle file
ds = bb.load('BBOB2009pythondata/BIPOP-CMA-ES/ppdata_f002_20.pickle')
# Load a folder
ds = bb.load('BIPOP-CMA-ES')

# Load data using a wildcard
import glob
示例#3
0
文件: pfpickle.py 项目: pasky/cocopf
picklefile = sys.argv[1]

dashidx = sys.argv.index("--")
algs = sys.argv[2:dashidx]
strats = sys.argv[dashidx + 1 :]

if os.path.exists(picklefile) or os.path.exists(picklefile + ".gz"):
    pds = PortfolioDataSets(pickleFile=picklefile)
else:
    pds = PortfolioDataSets()

for apath in algs:
    print apath
    aname = os.path.basename(os.path.normpath(apath))
    pds.add_algorithm(aname, bb.load(glob.glob(apath + "/bbobexp_f*.info")))
for spath in strats:
    print spath
    sname = os.path.basename(os.path.normpath(spath))
    pds.add_strategy(sname, bb.load(glob.glob(spath + "/bbobexp_f*.info") + glob.glob(spath + "/*/bbobexp_f*.info")))

# TODO: Make generating these optional?
print "bestalg"
pds.bestalg(None)
print "unifpf"
pds.unifpf()

# TODO: Pickle to tmp file and rename()?
print "Pickling..."
pds.pickle(picklefile)
示例#4
0
'''
Generates "pprldistr2009_RLB.pickle.gz" that is used to plot, in the background, the results of the 2009 algorithms
'''
# datapath = "../../data-archive/data/gecco-bbob-1-24/2009/data"
datapaths = ["../../data-archive/data/gecco-bbob-1-24/2009/data", "../../data-archive/data/gecco-bbob-noisy/2009/data"]
savepath = "bbob_pproc/pprldistr2009_hardestRLB.pickle"
# savepath = "bbob_pproc/pprldistr2009_RLB.pickle"
import pickle
import bbob_pproc as bb
import numpy as np
data = {}
for datapath in datapaths:
    print "loading data from", datapath
    data2009 = bb.load(datapath)
    Algs = data2009.dictByAlg()
    target_runlengths_in_table = [0.5, 1.2, 3, 10, 50]
    targets = bb.pproc.RunlengthBasedTargetValues(target_runlengths_in_table,
                                                force_different_targets_factor = 10 ** -0.2)

    for alg in Algs:
        curAlg = Algs[alg].dictByFunc()
        algname = curAlg[curAlg.keys()[0]][0].algId
        if not data.has_key(algname):
            data[algname] = {}
        for func in curAlg:
            data[algname][func] = {}
            funcdata = curAlg[func].dictByDim()
            for dim in funcdata:
                data[algname][func][dim] = [[]]
                curtarget = targets((func, dim))[-1]
                data[algname][func][dim][0].append(curtarget) # record hardest target
示例#5
0
import urllib
import tarfile
from pylab import *
ion()  # may be needed for figures to be shown when executing the script

import bbob_pproc as bb

# Collect and unarchive data (~20MB)
dataurl = 'http://coco.gforge.inria.fr/data-archive/2009/BIPOP-CMA-ES_hansen_noiseless.tgz'
filename, headers = urllib.urlretrieve(dataurl)
archivefile = tarfile.open(filename)
archivefile.extractall()

# Display some information
ds = bb.load('BIPOP-CMA-ES/bbobexp_f2.info')
print ds

# Collect and unarchive data (3.4MB)
dataurl = 'http://coco.lri.fr/BBOB2009/pythondata/BIPOP-CMA-ES.tar.gz'
filename, headers = urllib.urlretrieve(dataurl)
archivefile = tarfile.open(filename)
archivefile.extractall()

# Load a pickle file
ds = bb.load('BBOB2009pythondata/BIPOP-CMA-ES/ppdata_f002_20.pickle')
# Load a folder
ds = bb.load('BIPOP-CMA-ES')

# Load data using a wildcard
import glob
示例#6
0
picklefile = sys.argv[1]

dashidx = sys.argv.index('--')
algs = sys.argv[2:dashidx]
strats = sys.argv[dashidx+1:]

if os.path.exists(picklefile) or os.path.exists(picklefile + '.gz'):
    pds = PortfolioDataSets(pickleFile=picklefile)
else:
    pds = PortfolioDataSets()

for apath in algs:
    print apath
    aname = os.path.basename(os.path.normpath(apath))
    pds.add_algorithm(aname, bb.load(glob.glob(apath+'/bbobexp_f*.info')))
for spath in strats:
    print spath
    sname = os.path.basename(os.path.normpath(spath))
    pds.add_strategy(sname, bb.load(glob.glob(spath+'/bbobexp_f*.info') + glob.glob(spath+'/*/bbobexp_f*.info')))

# TODO: Make generating these optional?
print "bestalg"
pds.bestalg(None)
print "unifpf"
pds.unifpf()

# TODO: Pickle to tmp file and rename()?
print "Pickling..."
pds.pickle(picklefile)