示例#1
0
def worst_case_nf(input_size, outfile):
    print('Running a worst case for Next Fit')
    with open(outfile, 'a') as f:
        f.write('Running a worst case for Next Fit\n')

    bad_input_nf = [1 / 2, 1 / (2 * input_size)] * int(math.ceil(input_size / 2))
    pack_print_all(bad_input_nf, outfile)
    pack_and_print(bad_input_nf, first_fit, outfile, False)
    pack_and_print(bad_input_nf, first_fit, outfile, True)
示例#2
0
def worst_case_ff(input_size, outfile):
    print('Running a worst case for First Fit')
    with open(outfile, 'a') as f:
        f.write('Running a worst case for First Fit\n')

    one_third = int(math.ceil(input_size / 3))
    bad_input_ff = [1 / 7 + 0.001] * one_third + [1 / 3 + 0.001] * one_third + [1 / 2 + 0.001] * one_third
    pack_print_all(bad_input_ff, outfile)
    pack_and_print(bad_input_ff, first_fit, outfile, False)
    pack_and_print(bad_input_ff, first_fit, outfile, True)
示例#3
0
def test_all(items, outfile):
    #    for i in range(128):
    #        pack_print_all(items,outfile)
    pack_print_all(items, outfile)
示例#4
0
def test_all(input_size, outfile):
    for i in range(128):
        pack_print_all(random_list(input_size), outfile)