Help to set a penalty

It looks like there may be several problems. For one, there are no statements inside your while loop which change the values in ws, so you are either never entering the while loop or stuck inside it forever. I also think you may misunderstand what the ismissing function does. I will need more information from you to be able to help.

Please try to break your problem down into small minimum working examples (MWEs), so that we can copy and paste your code and see exactly what you are seeing. For example, this code is missing lines which define ws and p. Also please be more specific about what “does not work”. Include the error you are seeing or the result which is different from what you expect. Error messages will tell you what line of your code failed and give you a hint about what was wrong. Often the exercise of creating a MWE will help you fix problems yourself. Please read: make it easier to help you - Meta Discussion - JuliaLang