Update main.py
This commit is contained in:
parent
20881eefb2
commit
4fe896350a
13
main.py
13
main.py
|
@ -9,7 +9,7 @@ from geneticalgorithm2 import geneticalgorithm2 as ga
|
|||
|
||||
cols = [1, 13, 14, 15, 16, 17, 18]
|
||||
df = pd.read_excel('excel.xlsx', skiprows=2, usecols=cols, names=[0, 1, 2, 3, 4, 5, 6])
|
||||
rows = df.values[:200]
|
||||
rows = df.values[:10]
|
||||
|
||||
def make_num(x, n, a, b, c, min, max):
|
||||
seed = int(x*a + n*b + c)
|
||||
|
@ -36,8 +36,15 @@ def f(X):
|
|||
|
||||
return -score
|
||||
|
||||
varbound = np.array([[0,10000]]*3)
|
||||
varbound = np.array([[0, 100000]]*3)
|
||||
|
||||
model = ga(function=f, dimension=3, variable_type='int', variable_boundaries=varbound)
|
||||
|
||||
model.run()
|
||||
|
||||
solution = model.output_dict
|
||||
variable = model.output_dict['variable']
|
||||
|
||||
_x = 958 # prediction
|
||||
|
||||
print ('Recommended numbers:')
|
||||
print (', '.join(str(make_num(_x, n, variable[0], variable[1], variable[2], 1, 45)) for n in range(1, 7)))
|
||||
|
|
Loading…
Reference in New Issue
Block a user