def gopso(id, niter, popsize, nhood_size): res = np.inf if (id == 1): print("parabloid") numvar = 7 xmin = 0, 5 xmax = 0, 8 if (id == 2): print("rasenbork") numvar = 7 xmin = 0, 5 xmax = 0, 8 #gopso(idfunc,niter,popsize,nhood_size) #run optimizzation algorithm PSO = ParSwarm.ParSwarmOpt(xmin, xmax) res = PSO.pso_solve(popsize, id, numvar, niter, nhood_size) return res
print_figure(plt.gcf()) return yfore, horizon_data_length if len(sys.argv) == 2: forecast(sys.argv[1]) else: for i in range(len(indices)): f, horizon_data_length = forecast(indices[i]) result_forecasts.append(f) portfolioInitialValue = 100000 numvar = 7 xmin = 0.05 xmax = 0.7 niter = 2 popsize = 50 nhood_size = 10 PSO = ParSwarm.ParSwarmOpt(xmin, xmax) res = PSO.pso_solve(popsize, numvar, niter, nhood_size, portfolioInitialValue, horizon_data_length, result_forecasts) print("Portfolio: ", end='') for value in res.xsolbest: print(value, end=' ') print("") print("Return: {}".format(res.return_valuebest)) print("Devst: {}".format(res.devstbest))