Use Reinforcement Learning instead of genetic algorithm for optimization
In order to have anything resembling reinforcement learning you must at the very least have a set of states $S$ and a set of actions $A$.
In your formulation I can vaguely identify the set of states $S$ as all possible $(x,y,z)$ triplets. But don't see anything in your description that could be interpreted as a set of actions $A$. You either oversimplified the description of your problem or reinforcement learning is not applicable here by lack of very basic ingredients for it.