# Scaling numbers with constraints

I have four numbers $$X_1$$, $$X_2$$, $$X_3$$ and $$X_4$$ that range from [-2,2]. I want to scale these numbers ($$x_1=scaled(X_1)$$) with the following constraints:

$$x_1+x_2+x_3+x_4=1,$$ subject to $$x_1+x_2<1,$$ $$x_2+x_4<1,$$ $$x_3+x_4<1,$$ $$x_1+x_3<1.$$ The $$x_i$$ can be between $$[-\infty,\infty]$$, as long as the constraints above are satisfied. How can this be achieved?

• Why? What are you trying to achieve by that? You could replace each value with 0.25 and the constraints would hold, but I guess there are also some other assumptions that you are making that you didn't mention. – Tim Apr 13 at 11:37
• Does "scaling" mean applying a (nontrivial, meaning that the multiplier is nonzero) linear transformation? – Lewian Apr 13 at 11:42
• Im trying to achieve weights that sum to 100% and the subweights also sum to 100%. The X_i's are Betas in a regression and I want to scale these Betas into weights, that sum to 1, and has the constraints listed above. – niclas englesson Apr 13 at 12:07
• What for? This sounds like an XY problem. If those are parameters of the model, why not just use constrained optimization with those constraints? – Tim Apr 15 at 6:57
• Because I need a formula so that I can do this for rolling 24month periods, of course for a one time solution it would be easier to add constraints to the optimization, but I'm trying to figure out a way to make it scalable (for thousands of regressions) and also easily updatable with new data. – niclas englesson Apr 15 at 13:44

How do you want to treat negative individual values? Your constraints also require all pairs to add to values greater than $$0$$ as well as less than $$1$$, which suggests to me that you have some issues with negative weights.
You could try something like $$\mathrm{scaled}(X_i) = \frac{X_i-\min\{X_j,0\}}{\sum\limits_k\left(X_k-\min\{X_j,0\}\right)}$$ on some examples of your choosing. It requires the $$X_i$$ not to be all equal to some non-positive value, and if they were all equal then $$\mathrm{scaled}(X_i)=\frac14$$ would be the obvious choice