optimization_setupand precede beam definition (
optimization_term). The reason is that the hard constraints imposed by
optimization_constraintmay make it more difficult for the optimizer to converge. See the discussion of the
segtmacros in the manual entry to
&optimization_constraint STRING quantity = NULL; double lower = 0; double upper = 0; &end
quantity-- The quantity to be constrained, given as the name of a quantity from among the optimization variables, optimization covariables, and the ``final'' parameters (see the entry for
run_setupfor the last of these). The optimization (co)variables are referred to as
<element-name>.<parameter-name>, in all capital letters. Other quantities, such as Twiss parameters or anything else but what is listed just above, are not recognized. Expressions involving multiple quantities are not supported.
upper-- The lower and upper limits allowed for the expression.