Oh thanks that is really nice. For fixing one of the parameter it works pretty nice.
But I don’t know how to fix more parametrs.
loss_function_projected(p2) = q -> loss_function( (p2[1], p2[2], q[2]) )
pp = [1, 2]
q0 = [0.0]
result = optimize(loss_function_projected(pp), q0 )
gave me BoundsError: attempt to access 1-element Vector{Float64} at index [2]
So I probably miss the concept of the function projection.