# TMinuit with constraint

Hi ROOTer,

I am trying to minimize my FCN using the TMinuit with parameters x1, x2, and x3. The x1, x2, and x3 themselves have no constraints, but x1 + x2 + x3 > 0.

My question is: How to impose this constraint during the minimization? Should I manually set the FCN to infinity when x1 + x2 + x3 < 0 is satisfied?

With the best respect,
Boan

Hi Boan,

I am adding in the loop our expert, @jonas .

Cheers,
D

Hi, all,

I have an idea for discussion. We can multiply an exponential term (e^{-(x1+x2+x3)}) or a fractional term (1/(x1+x2+x3)) on FCN, so that when x1+x2+x3 tend to zero, FCN becomes infinite. But I am concerned about uncertainty estimates in this case.

Do you have any other suggestions?

With the best respect,
Boan

Hi Boan,

If possible, transform your parameters (x1,x2,x3) to (z1,z2,z3) where z1=x1+x2+x3 .
TMinuit has implemented simple parameter ranges like z1 > 0.

best regards, Eddy

Hi, all,

Thank you for your prompt response! I have to say that the situation is more complex than initially described, as I need to consider various constraints, including nonlinear combinations of parameters. However, the set of parameters should be retained due to their physical meaning.

I will begin by exploring the previous post. If there are more questions, I will continue to seek your guidance.

Thank you all again.

With the best respect,
Boan

Hi, all,

I tried the same approach as previous post but still couldnâ€™t solve the problem. Let me show you the situation I encountered.

I attempted to enforce the condition that `r20` must be greater than `0` in any case. The formula for `r20` is defined as `r20 = (-3 - cos(2 * theta_1) - 2 * pow(Pt, 2) * cos(2 * phi_1) * pow(sin(theta_1), 2) + 4 * (-1 + pow(Pt, 2) * cos(2 * phi_1)) * pow(sin(theta_1), 2) * (pow(x1, 2) - pow(x3, 2)))`, where `x1` and `x3` are fit parameters, and `phi_1` are angles for each event, with `Pt` being a constant.

I tried multiplying `exp(r20)` to the amplitude (Amp) to construct the FCN, which is defined as `Amp*exp(r20)(for PHSP MC sample)-ln(Amp)*exp(r20)(for data sample)`.

If this constraint is effective, the amplitude should not be negative. However, despite trying different initial values for x1 and x3, negative amplitudes were still observed in the PHSP MC or data sample during minimization.

I also attempted using `1/(r20)`, but this approach also proved unsuccessful.

Is there any other way to solve this issue?

With the best respect,
Boan

Hi Boan,

Multiplying your function with exp(-r20) would prevent negative r20 values but favor large positive r20 values. This is just not the way to implement constrains. You will have to find a transformation of variables.

-Eddy