#def test_diff4(): #r = 1 #r = 20 #lamda = 400 #f = tf.F1_var1 #f = tf.F2_var1 n = 100 #50 r = 20 lamda = 100 f = tf.gaussian_diff_multimodal4_positive dim = 2 alh = SwarmPackagePy.z_bfoa_multiniche_sharing(n, f, -r, r, dim, 100, 16, 2, 8, 12, 0.05, 0.25, 0.05, 0.2, 0.05, 10, lamda, 0.03, 'adaptive1', 'swarm1', 'false', 0.2) #FOr F1 [0,1] #alh = SwarmPackagePy.z_bfoa_multiniche_sharing(50, f, -r, r, dim, 100, 8, 8, 12, 12, 0.1, 0.25, 0.1, 0.2, 0.1, 10, lamda, 0.03, 'none', 'swarm1', 'false') #alh = SwarmPackagePy.z_bfoa_multiniche_sharing(100, f, -r, r, dim, 100, 8, 8, 12, 12, 0.05, 0.25, 0.05, 0.2, 0.05, 10, lamda, 0.03, 'adaptive1', 'swarm1', 'false') fits = alh._get_jfits() plt.plot(fits, 'b', label='J-fit') jcclist = alh._get_jcclist() plt.plot(jcclist, 'r', label='J-cc') jarlist = alh._get_jarlist() plt.plot(jarlist, 'g', label='J-ar')
import matplotlib.pyplot as plt import numpy as np from math import * #(self, n, function, lb, ub, dimension, iteration, Nre=16, Ned=4, Nc=2, Ns=12, C=0.1, Ped=0.25, Da=0.1, Wa=0.2, Hr=0.1, Wr=10, lamda=400, L=0.03, arga='none', argj='none', arged='false'): #alh = SwarmPackagePy.bfoa_swarm1_dev1_rep(100, tf.f1_sphere_function, -100, 100, 3, 100, 8, 4, 8, 12, 0.1, 0.25, 0.1, 0.2, 0.1, 10,10 ) #alh = SwarmPackagePy.bfoa_swarm1_dev1_rep(100, tf.f5_griewank_function, -10, 10, 30, 100, 16, 4, 2, 12, 0.1, 0.25, 0.1, 0.2, 0.1, 10,400 ) #VERYGOOD alh = SwarmPackagePy.bfoa_swarm1_dev1_rep(100, tf.f3_ackley_function, -32, 32, 30, 100, 24, 8, 8, 12, 0.1, 0.25, 0.1, 0.2, 0.1, 10,100 ) r = 1 #lamda = 100 #FOR MULTINICHE GOOD lamda = 10 f = tf.F1 alh = SwarmPackagePy.z_bfoa_multiniche_sharing(50, f, -r, r, 1, 100, 8, 8, 12, 12, 0.1, 0.25, 0.1, 0.2, 0.1, 10, lamda, 0.03, 'adaptive1', 'none', 'false') fits = alh._get_jfits() plt.plot(fits, 'b', label='J-fit') jcclist = alh._get_jcclist() plt.plot(jcclist, 'r', label='J-cc') jarlist = alh._get_jarlist() plt.plot(jarlist, 'g', label='J-ar') jlist = alh._get_jlist() plt.plot(jlist, 'y', label='J') jblist = alh._get_jblist()