Page 1 of 1

Optimizer gets lengths wrong by a factor of 10

Posted: 14 Feb 2020, 16:52
by foshea
I'm trying to optimize a beam that allows some of the quadrupoles to "float" as I don't really care where they go as long as the total drift is fixed.

I constrain the total drift using the following command:

Code: Select all

&optimization_term                                                                                                           
    term = "MDL-D.02.L MDL-D.03.L + 0.296 0.01 sene",
    weight = 1
&end
When the optimization is done, it thinks it has done a great job:
Terms of equation:

Code: Select all

1*(MDL-D.02.L MDL-D.03.L + 0.296 0.01 sene):   0.000000000000000e+00
And the values output by the optimizer look good:

Code: Select all

Optimum values of variables and changes from initial values:
MDL-D.02.L:   2.999999999977450e-01    2.751999999977450e-01 (was   2.480000000000000e-02) (near limit)
MDL-D.03.L:   4.776695252676775e-03   -2.330474732322504e-05 (was   4.800000000000000e-03)
However, when I look at the new lattice file, the values for the lengths are off by exactly a factor of 10:

Code: Select all

"MDL-D.02": EDRIFT,L=2.99999999997745
"MDL-D.03": EDRIFT,L=0.04776695252676776
It seems like this is either an obvious bug or I don't understand something that goes in to optimization. I don't have this problem with quad strengths. Note that these lengths aren't the only terms being optimized.

Re: Optimizer gets lengths wrong by a factor of 10

Posted: 14 Feb 2020, 17:03
by michael_borland
Are you perhaps using element division, either via the &run_setup command's element_divisions parameter or the &divide_elements command?

This could cause confusion for the optimizer.

--Michael

Re: Optimizer gets lengths wrong by a factor of 10

Posted: 14 Feb 2020, 17:18
by foshea
Yep. That did it. I had each element divided in to 10. Thank you!

I'm pretty sure I've both made this mistake and asked this question before.