I'm using MATLAB to optimise a 9 input function. I've created my function and it outputs a fitness penalty value. When im running the function there are 2 main points it can fail at (by this i mean the selected inputs provide neither a good or bad solution, just straight up fail). I have two if statements at these points, if the inputs fail at the first stage they recieve a fitness penalty of -800, if they fail at the second stage they recieve a fitness penalty of -400 (picked these kind of randomly). If they pass through both if statements succesfully then they recieve a positive fitness penalty based on how well they performed. I've set up a genetic algorithim to optimise this (find the maximum fitness penalty) and I have provided MATLAB with initial points that i know provide a positive fitness penalty. I did a couple of test runs with the ga whilst i was tweaking penalties and my function and it did work. However, I'm now running it properly and I cannot get a positive fitness penalty. I've tried adjusting my population size and elite population to no success. I suspect it's just that the ga is yet to find a succesful input to use in the next generation but i don't know for sure. Any help/advice greatly appreciated.