Optimizer ends prematurely
Posted: 25 Aug 2020, 13:44
I am trying to optimize a beam line that is split by a dipole that can be either on or off. I'm working with the Twiss parameters, so I pull the Twiss parameters from just before the dipole and paste the straight beam line on to the end of the bent beam line. I have attached all the files necessary to recreate my problem. I have two problems that I think are related, but I'm not sure.
1) TWISS elements cannot be used as covariables when the output_at_each_step flag of twiss_output is nonzero, elegant throws an UNKNOWN TOKEN error.
Further details can be found in this topic: viewtopic.php?f=9&t=1053
This bug can be replicated by un-commenting the line that contains output_at_each_step in the attached input.ele file.
2) The optimizer ends prematurely.
For the attached files, the value of the optimizer stops at approximately 2400, while the goal is zero.
The output.fin file shows that optimizationFunction is converging but optimized shows up as 1 for the last step, even though the optimization criteria is clearly unmet. So I don't think the optimizer is stuck in a local minimum. The total number of steps is a small fraction of the allowed number, so I don't think the optimizer has reached its limit there either.
I have tried fiddling with some of the flags, but nothing seems to help. If I manually compute a set of parameters that is close to what I want, the optimizer will sometimes, but not always, reach zero. However, the output to the screen will show that not all of the terms converged.
My suspicion is that the Twiss parameters are not being updated at each step and that the optimizer is doing something strange with stored values for the Twiss values, maybe updating them at each pass (as opposed to each step)? But clearly, I cannot have elegant output the Twiss parameters at each step because that does not allow optimization to proceed at all.
Any guidance would be appreciated.
1) TWISS elements cannot be used as covariables when the output_at_each_step flag of twiss_output is nonzero, elegant throws an UNKNOWN TOKEN error.
Further details can be found in this topic: viewtopic.php?f=9&t=1053
This bug can be replicated by un-commenting the line that contains output_at_each_step in the attached input.ele file.
2) The optimizer ends prematurely.
For the attached files, the value of the optimizer stops at approximately 2400, while the goal is zero.
The output.fin file shows that optimizationFunction is converging but optimized shows up as 1 for the last step, even though the optimization criteria is clearly unmet. So I don't think the optimizer is stuck in a local minimum. The total number of steps is a small fraction of the allowed number, so I don't think the optimizer has reached its limit there either.
I have tried fiddling with some of the flags, but nothing seems to help. If I manually compute a set of parameters that is close to what I want, the optimizer will sometimes, but not always, reach zero. However, the output to the screen will show that not all of the terms converged.
My suspicion is that the Twiss parameters are not being updated at each step and that the optimizer is doing something strange with stored values for the Twiss values, maybe updating them at each pass (as opposed to each step)? But clearly, I cannot have elegant output the Twiss parameters at each step because that does not allow optimization to proceed at all.
Any guidance would be appreciated.