Closed this-josh closed 2 years ago
The reason for this error is that SNES
is a distribution-based search algorithm, which is designed for real-valued variables. For discrete variables, you can use a genetic algorithm through SteadyStateGA
, by defining crossover and mutation operators for your solution type (EvoTorch has some built-in operators for real-coded solutions only currently, so you will need to define these for now) to be used. Once you've defined operators to do crossover and mutation, you can use them like this:
ga = evotorch.algorithms.SteadyStateGA(problem, popsize=...)
ga.use(MyCrossover(problem, arg1=..., arg2=...,))
ga.use(MyMutation(problem, arg1=...))
If you face any issues implementing these operators let us know and we'll try to help!
I see thank you for your clear and detailed explanation. I did try SteadyStateGA
but got the same errors, from your description I expected these came from the built-in operators I was using. I'll have a think about whether I should implement some additional operators. For now I'll close this ticket.
I have a problem which requires an integer solution, when running my searcher I get the error
RuntimeError: "normal_kernel_cpu" not implemented for 'Int'
Here is an example, if
dtype=torch.float
it works fine, andtorch.prod(torch.tensor([2,3], dtype=torch.int))
works as expected.I've got the same error on Red Hat Linux and my M1 Mac, with python 3.9 and 3.10 and evotorch 0.2.0.