示例#1
0
             if not elements[d+o].strip() == "?":
                 objective_data[p][a][o].append(float(elements[d+o]))
                 plot_points[p][a][o].append(float(elements[d+o]))
             
                 
 
     #################### Originals ######################
     s = '{0: <12}'.format(problem.name) + "," + '{0: <12}'.format(algorithm.name) + "," + '{0: <12}'.format("Original") + "," 
     for dug in data[p][a]:
         s += str("%10.2f" % avg(dug)) + ","
     print s
 
     #################### BIN DRAW ORIGINALS ###################
     numBins = 10
     numAttributes = len(problem.decisions)
     histobins = [histobin(numBins, problem.decisions[i], i) for i in range(numAttributes)]
     novel_candidates = []
     for c,hbin in enumerate(histobins):
         novel_candidates.append( [[] for d in problem.decisions] ) 
         hbin.populate(decision_data[p][a][c])
         
         #for iii in range(10):
         #    hbin.rex()
     
     trials = []
     for repeat in range(20):
         
         accepted = False
         while not accepted:
             novel_candidate = [random.uniform(dec.low,dec.up) for dec in problem.decisions]
             
示例#2
0
        #axarr[a][0].plot(front[0], front[1], linestyle='None', marker=algorithm.type, color=algorithm.color, markersize=5, markeredgecolor='none')
        
        axarr[a].set_xlim([min(OX), max(OX)])
        axarr[a].set_ylim([min(OY), max(OY)])        

        colors = ["Red", "Pink", "Orange", "Gold", "Yellow", "Green", "Blue", "Indigo", "Violet", "Black"]#Green", "Blue", "Green", "Pink", "Yellow", "Orange", "Purple", "Black", "Brown"]#, "IndianRed", "GreenYellow", "Aqua", "Gold", "Khaki", "SteelBlue", "PowderBlue"]
        import colorsys
        N = len(leaf_plots[p][a])
        print N
        HSV_tuples = [(x/360.0, 0.5, 0.9) for x in frange5(0, 360, (360/float(N)))]
        colors = map(lambda x: colorsys.hls_to_rgb(*x), HSV_tuples)
        numBins = len(colors)
        numAttributes = 3
        rgb_names = ["red", "green", "blue"]
        
        histobins = [histobin(numBins, jmoo_decision(rgb_names[i], 0, 1), i) for i in range(numAttributes)]
        for c,hbin in enumerate(histobins): 
            hbin.populate([color[c] for color in colors])
            for iii in range(10):
                hbin.rex()
        N = len(colors)
        print histobins
        colors = [ [] for attr in range(3)  ]
        for h,hbin in enumerate(histobins):
                for bin in hbin.bins:
                    colors[h] +=   [ bin.low + (bin.up-bin.low)/2 for i in range(int(N*hbin.freq(bin)/100.0)) ]
        
        #print colors
        
        
        #markers = ["p", "^", "*", ".", "x", 'd']