# Square roots

Answered-
Hi,

You can drop the \(\sqrt{\cdot}\) in your objective function because it is a concave monotonically increasing function. This means that \(\sqrt{a} \leq \sqrt{b}\) for \(a \leq b\). Once you have the optimal objective value, you can compute the \(\sqrt{\cdot}\) of it manually.

Note that this is only ok, since it occurs in your objective only. It is not that straight forward if you have a \(\sqrt{\cdot}\) in one of your constraints.

Best regards,

Jaromił1 -
Thanks for your answer Jaromił!

That certainly should work. Nevertheless, eventually, I am trying to solve a slightly complex case where dropping the √ isn't going to do what I want.

I have K groups and I want to maximise the TOTAL SUM of the square root of the sum of scores of items for each group. (i.e )

\(\sum_{I=1}^{K} \sqrt{ \sum_{a=1}^{R} x_{a} ^{ i } * Score (x_a) } \)

I don’t think dropping the √ will give the desired result in such cases.

For example √ 2 +√ 1 + √ 1 > √ 4 + √ 0 + √ 0);

But 2 + 1 + 1 = 4

I was wondering if there is a way to model such objectives with √ in Gurobi?

Thanks!

1 -
Hi Bereket,

You are right, in this case you can't simply drop the \(\sqrt{\cdot}\). You could try the addGenConstrPow() function with \(a=0.5\) to model a \(\sqrt{\cdot}\). For that you will have to introduce auxiliary variables and equality constraints\( w_k= \sum_{a=1}^{R} x_{a} ^{ i } * Score (x_a) \) and then use the auxiliary variables in your objective as \(\sum_{k=1}^{K} \sqrt{w_k}\).

Best regards,

Jaromił1 -
Thanks, Jaromił !

It works with the addGenConstrPow() method.

Best regards,

Bereket.

0 -
I think there is a typo at the bottom of this page: addGenConstrPow(). The example usage should not read "LogA".

0 -
Hi Nadi,

This is true. Please note that link is for 9.0 documentation, and the typo was fixed in 9.5 documentation: addGenConstrPow() but thank you for highlighting it.

Given we maintain documentation for several versions on our website it is always useful to check in the URL to verify which version you are accessing.

- Riley

0

Please sign in to leave a comment.

## Comments

6 comments