Skip to content

How_do_I_constrain_the_system_so_that_the_solver_only_finds_positive_values_for_my_solvable_Parm?

Gijs Molenaar edited this page Feb 13, 2014 · 2 revisions

For the Parm there is a constrain field, which is a vector defining the minimum and maximum of the C00 coefficient. Another option is the force_positive field. This will, after every iteration, set C00 to abs(C00). Note that both options only work for the C00 coefficient even for funklets with more coefficients, and only for solvable Parms. For more information on Parm fields see the MeqParm documentation.

I also found ...

> For 'constraining' solver solutions to gaussian source parameters to stay
> as positive, will the 'force_positive' option do what I want, or must I
> still use a 'constraint' vector?

Hi Tony,

force_positive will take the absolute value of the coefficient (only c00 and only fo rconstant funklets) after an update, thus : -1 becomes +1

If you set constrain = [0.,1e179] it will force the c00 to stay at a minimum of 0 after an update, thus : -1 becomes 0. It depends on what you think is the best solution for your specific problem.

Hope this helps,

                 * Maaijke 

force_positive=True is what you want. Then whenever the solver drives the parameter to some x<0, it will reset itself to |x|. Which is what you want for gaussian sizes.

(In fact both the x and -x solutions are equivalent, since it only appears in the tree as x^2, but positive sizes are nicer to look at.)

'Constrain' is needed if you want to set true lower/upper bounds on a parameter. This is useful for things like spectral indices -- since the solution is so sensitive to them, if the solver drives spi to some wild range, it has a very hard time getting back. So you may want to set something like constrain [-10,10] on your spectral indices.

Cheers, Oleg

Clone this wiki locally