# Minimizing sum of $w_i(y_i - y_c)$ over $y_c$

A person wants to connect $$n$$ circuit points to the clock signal. Now, the clock signal is going to pass parallel to the x-axis and all those circuit points are going to be connected by vertical to the clock line. Suppose the widths of the vertical wires in the given diagram also vary varying. If the coordinates $$(x_i,y_i)$$ for each circuit point $$c_i$$ to be connected are given, find $$y=y_c$$, through which the clock line should pass to minimize the expression

$$L = \sum_{i=1}^n w_i(y_i - y_c)$$

Also prove that your solution is optimal.

• Is $y_c$ one of $y_1,\ldots,y_n$? May 12 at 7:05
• Should the objective function read $L = \sum_{i=1}^n w_i(\lvert y_i - y_c \rvert)$? May 12 at 7:22
• @greybeard No the expression was not that. May 12 at 14:02

$$x_i$$ is irrelevant, it doesn't appear in the objective function.

$$y_i$$ and $$w_i$$ are constant.

So the minimization simplifies to:

$$\operatorname*{argmin}_{y_c} \sum{i=1}^n w_i(y_i - y_c) = \operatorname*{argmin}_{y_c} \sum_{i=1}^n w_iy_i - \sum_{i=1}^n w_iy_c,$$

which is either

$$\operatorname*{argmin}_{y_c} -\left(\sum_{i=1}^n w_i\right) y_c$$

or

$$\operatorname*{argmax}_{y_c} \left(\sum_{i=1}^n w_i\right) y_c$$

So depending on whether the sum of your weights is positive or negative, either the highest or lowest $$c_i$$ should be $$c$$.

• @Pole_Star Better now? May 11 at 10:11
• Hi @kutschkem! Yes much better! One more question, what change will be there if there is a design rule that the width(wi) of each vertical wire cannot be made less than a quarter of it's length? May 11 at 10:36
• @Pole_Star Did I understand the part with the width wrong? I thought that the width was fixed. If the width is variable, then yes that changes the solution a lot I think. Then you get a constrained optimization problem with that design rule as constraint. May 11 at 11:28
• @Pole_Star, we'd prefer that you avoid changing the question in a way that invalidates existing answers. If you want to ask about a variant of the question, please ask that as a separate question, using the 'Ask Question' button. Note that our general rule is to ask only one question per post; it looks like your edit changed things to ask two separate questions.
– D.W.
May 12 at 4:59
• @D.W. Ok Ok sure... May 12 at 5:11