constraint

Moderators: cyao, michael_borland

Post Reply
Philippe Piot
Posts: 83
Joined: 20 Aug 2008, 13:18
Location: Northern Illinois University & Argonne National Laboratory
Contact:

constraint

Post by Philippe Piot » 20 Aug 2008, 13:23

What is the easiest way to impose a constraint on final Twiss
parameter sduring a matching. For instance I would like to
fit the horizontal Twiss parameters to a specific target
while only requiring the vertical Twiss parameters to be within
a certain range, I would imagine something like

&optimization_term
term = "alphax 6.00 - sqr" &end
&optimization_term
term = "betax 18 - sqr" &end
&optimization_constraint
quantity="betay" lower=10, upper=30 &end
&optimization_constraint
quantity="alphay" lower=10, upper=30 &end

but this does not work (betay and alphay are not allowed
"quanities" (?). Thank you!!

michael_borland
Posts: 1933
Joined: 19 May 2008, 09:33
Location: Argonne National Laboratory
Contact:

Re: constraint

Post by michael_borland » 20 Aug 2008, 18:05

Philippe,

The optimization_constraints feature is somewhat disparaged. Although the manual doesn't clearly say it, one can only constrain certain quantities that result from tracking, namely, those that are in the "final" output file.

The problem with optimization_constraints is that the constraints are too hard and tend to mess up the simplex optimizer. A better way is using various rpn functions in optimization_term. For example, to constrain betay<30 m, use the "segt" (Soft-Edge Greater Than) function. This function returns a non-zero value only if the top item on the stack is greater than the next item on the stack by more than a given tolerance. In that case, the value grows quadratically with the difference (more specifically, (delta/tolerance)^2 ).
&optimization_term
term = "betay 30 1 segt"
&end
where the value "1" is a softness parameter (smaller value is a harder edge).

To constrain betay>10m use the soft-edge less-than function:
&optimization_term
term = "betay 10 1 selt"
&end

You can of course combine these
&optimization_term
term = "betay 30 1 segt betay 10 1 selt +"
&end

To constrain betay to be close to 20 m, you could use the soft-edge not-equal function:
&optimization
term = "betay 20 0.1 sene"
&end


The manual page for optimization_setup has a description of these functions
http://www.aps.anl.gov/Accelerator_Syst ... ode46.html
You can also play with them by running "rpn" from the commandline.

--Michael

Post Reply