Esempio n. 1
0
signals = ['zA', 'zB', 'zC', 'zD', 'zE', 'zF', 'zG']
cost1 = {'zA': 12, 'zB': 26, 'zC': 27, 'zD': 30, 'zE': 37, 'zF': 39, 'zG': 41}
cost2 = {'zA': 19, 'zB': 20, 'zC': 21, 'zD': 23, 'zE': 36, 'zF': 37, 'zG': 38}
cost3 = {'zA': 16, 'zB': 17, 'zC': 31, 'zD': 33, 'zE': 36, 'zF': 56, 'zG': 57}
cost4 = {'zA': 3, 'zB': 34, 'zC': 36, 'zD': 39, 'zE': 41, 'zF': 43, 'zG': 58}
costlist = [cost1, cost2, cost3, cost4]
begintemp = {12: 8, 19: 4, 16: 8, 3: 14}
citer = 1
endtemp = [0.001, 0.01, 0.1, 0.25, 0.5, 0.75, 1, 1.5, 2]

with open("endtempstats.txt", 'a') as text:
    for c in costlist:
        for e in endtemp:
            m = 0
            print('end: ' + str(e))
            text.write(str(citer) + ',')
            text.write(str(begintemp[c['zA']]) + ',')
            text.write(str(e) + ',')
            for y in range(20):
                map = readMap.read_complete_map('Russiadfs.txt')
                map = sim_an_search.sim_an(map, c, signals, 200000,
                                           begintemp[c['zA']], e)
                freq = analyse.analyse_signal_frequentie(map)
                costs = analyse.get_cost(freq, c)
                text.write(str(costs) + ', ')
                m += costs
            print('mean: ' + str(m / 20))
            text.write('\n')
        citer += 1
Esempio n. 2
0
import analyse
import readMap
import sim_an_search

signals = ['zA', 'zB', 'zC', 'zD', 'zE', 'zF', 'zG']
cost1 = {'zA':12, 'zB':26, 'zC':27, 'zD':30, 'zE':37, 'zF':39, 'zG':41}
cost2 = {'zA':19, 'zB':20, 'zC':21, 'zD':23, 'zE':36, 'zF':37, 'zG':38}
cost3 = {'zA':16, 'zB':17, 'zC':31, 'zD':33, 'zE':36, 'zF':56, 'zG':57}
cost4 = {'zA':3, 'zB':34, 'zC':36, 'zD':39, 'zE':41, 'zF':43, 'zG':58}
costlist = [cost1, cost2, cost3, cost4]
begintemp = [9, 5, 9, 15]
maplist = [readMap.read_complete_map('Ukrainedfs.txt'), readMap.read_complete_map('UnitedStatesdfs.txt'), readMap.read_complete_map('Russiadfs.txt')]


with open('temptation.txt', 'a') as text:
    for m in range(3):
        for c in range(4):
            lowest_cost = 2000
            for y in range(20):
                map = maplist[m]
                sim_an_search.sim_an(map, costlist[c], signals, begin_temp=begintemp[c], end_temp=0.5)
                freq = analyse.analyse_signal_frequentie(map)
                costs = analyse.get_cost(freq, costlist[c])
                if costs < lowest_cost:
                    lowest_cost = costs
                print(m, c + 1, y, lowest_cost)
            text.write(str(m) + str(c + 1) + ': ' + str(lowest_cost))
            text.write('\n')


Esempio n. 3
0
import readMap
import dfs
import hill_solve
import analyse

map = readMap.read_complete_map('Russiadfs5.csv')
signal_costs = analyse.get_cost_scheme(1)
analyse.print_costs(map, signal_costs)
Esempio n. 4
0
worst_costs = 0
#for l in range(loops):
#map = readMap.readStates("UnitedStates.txt")
#print(analyse.analyse_adjacent_states(map))
signals = ['zA', 'zB', 'zC', 'zD', 'zE', 'zF', 'zG']
costs = {'zA': 19, 'zB': 20, 'zC': 21, 'zD': 23, 'zE': 36, 'zF': 37, 'zG': 38}
algos = {
    sim_an_search.sigmoidal_temperature: [],
    sim_an_search.sigmoidal_temperature_2: [],
    sim_an_search.sigmoidal_temperature_3: [],
    sim_an_search.double_sigmoidal_temperature: [],
    sim_an_search.sinus_double_sigmoidal_temperature: [],
    sim_an_search.sinus_temperature: [],
    sim_an_search.linear_temperature: [],
    sim_an_search.sinus_linear_temperature: []
}

with open("sinsigmoid.txt", 'w') as text:
    text.write('sinus_sigmoidal_temperature')
    text.write(',')
    for x in range(loops):
        map = readMap.read_complete_map("UnitedStatesdfs.txt")
        sim_an_search.stats_climber(map, costs, signals, 200000, 5, 0.01,
                                    sim_an_search.sinus_sigmoidal_temperature)
        freq = analyse.signal_frequentie(map)
        hill_costs = analyse.get_cost(freq, costs)
        text.write(str(hill_costs))
        text.write(',')
        print(str(x))
    text.write('\n')