1

I'm using bellow code to Optimize some parameters but the problem is I can't specify "steps" for values!

In this case I want 1x step to generate only integer values but pyswarm generating float numbers.

from pyswarm import pso
from OPT import parameters

def func(params):
    print('Launched the iteration with ' + str(params))
    parameters(params[0],params[1])
lb = [70, 10]
ub = [90, 30]
xopt, fopt = pso(func=func, lb=lb, ub=ub)

Output:

Launched the iteration with [82.97742793 22.47417271]

I need only integer numbers for my function not decimal or float type. How do I do that?

Robert
  • 7,394
  • 40
  • 45
  • 64
Mori
  • 11
  • 1

0 Answers0