You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to have an element in my struct that changes during Nelder Mead optimization. But despite trait CostFunction I'm not allowed to have mutable reference &mut self in cost function.
What do you recommend me to do?
The text was updated successfully, but these errors were encountered:
I used it but it didn't completely solve my error (Somewhere else another error occured).
I was wondering if there was a reason you have not used &mut self in the trait CostFunction? Or you did it just to avoid possible errors and reach a stable version ASAP?
The downsides of using &mut self overweight the advantages. Handling gets much more cumbersome and restrictive due to requiring unique ownership of the problem when evaluating the cost function. If interior mutability is needed, RefCell should to the trick.
I'm trying to have an element in my struct that changes during Nelder Mead optimization. But despite trait CostFunction I'm not allowed to have mutable reference &mut self in cost function.
What do you recommend me to do?
The text was updated successfully, but these errors were encountered: