Exemplo n.º 1
0
def run_benchmark():
    seed = 0
    num_instances = 100
    num_bins = 100
    num_resources = 5
    min_fill = .8
    rate = .25
    rem = .8
    sd = .2

    # open_files('_unif_'+str(num_bins)+'_'+str(num_resources))
    # open_files('_unif_rare_'+str(num_bins)+'_'+str(num_resources)+'_'+str(rate))
    #open_files('_cor_'+str(num_bins)+'_'+str(num_resources)+'_'+str(sd))
    open_files('_similar_' + str(num_bins) + '_' + str(num_resources) + '_' +
               str(sd))
    for i in xrange(num_instances):
        #inst = generator(num_bins, num_resources, min_fill, unif_bin, seed, proc_rate=rate)
        #inst = generator(num_bins, num_resources, min_fill, correlated_capacities, seed, rem_cons=rem, dev=sd, correlated_items = True)
        base = [random.randint(5, 200) for i in xrange(num_resources)]
        inst = generator(num_bins,
                         num_resources,
                         min_fill,
                         similar_items,
                         seed,
                         base_item=Item(base),
                         dev=sd)
        instance_file.write(repr_instance(inst) + '\n')
        seed += 1
        run_tests(inst)
        instance_file.flush()
    close_files()
def run_pr(num_bins,num_resources,min_fill,rem,rate=1.,sd=.1, cori = False):
    seed = 0
    num_instances = 100
    instances = []

    for i in xrange(num_instances):
        inst = generator(num_bins, num_resources, min_fill, unif_bin,
                seed, rem_cons=rem, proc_rate=rate)
        #inst = generator(num_bins, num_resources, min_fill,
        #        correlated_capacities, seed, rem_cons=rem, dev=sd,
        #        correlated_items = cori)
        #inst = generator(num_bins, num_resources, min_fill,
        #        similar, seed, dev=sd)
        instances.append(inst)
        seed += 1
        run_tests(inst)

    return instances
Exemplo n.º 3
0
def run_pr(num_bins, num_resources, min_fill, rem, rate=1., sd=.1, cori=False):
    seed = 0
    num_instances = 100
    instances = []

    for i in xrange(num_instances):
        #inst = generator(num_bins, num_resources, min_fill, unif_bin,
        #        seed, rem_cons=rem, proc_rate=rate)
        inst = generator(num_bins,
                         num_resources,
                         min_fill,
                         correlated_capacities,
                         seed,
                         rem_cons=rem,
                         dev=sd,
                         correlated_items=cori)
        #inst = generator(num_bins, num_resources, min_fill,
        #       similar, seed, dev=sd)
        instances.append(inst)
        seed += 1
        run_tests(inst)

    return instances
def run_benchmark():
    seed = 0
    num_instances = 100
    num_bins = 100
    num_resources = 5
    min_fill = .8
    rate=.25
    rem=.8
    sd = .2

    # open_files('_unif_'+str(num_bins)+'_'+str(num_resources))
    # open_files('_unif_rare_'+str(num_bins)+'_'+str(num_resources)+'_'+str(rate))
    #open_files('_cor_'+str(num_bins)+'_'+str(num_resources)+'_'+str(sd))
    open_files('_similar_'+str(num_bins)+'_'+str(num_resources)+'_'+str(sd))
    for i in xrange(num_instances):
        #inst = generator(num_bins, num_resources, min_fill, unif_bin, seed, proc_rate=rate)
        #inst = generator(num_bins, num_resources, min_fill, correlated_capacities, seed, rem_cons=rem, dev=sd, correlated_items = True)
        base = [random.randint(5,200) for i in xrange(num_resources)]
        inst = generator(num_bins, num_resources, min_fill, similar_items, seed, base_item=Item(base), dev=sd)
        instance_file.write(repr_instance(inst)+'\n')
        seed += 1
        run_tests(inst)
        instance_file.flush()
    close_files()