Maximise weighted average

106 Views Asked by At

Suppose I have to take $k$ exams as an undergraduate, and that marks are given from $1.8$ to $3.0$ (skipping tenths of a point), and each exam is weighted from $1$ to $4$ according to its difficulty. I may put my marks in a vector $\mathbf v$ and my weights in another vector $\mathbf c$, in order to compute the weighted average $$f(\mathbf v, \mathbf c) = \frac{\sum_{j=1}^k c^j v^j}{\sum_{j=1}^k c^j} \tag1$$ Now suppose that the actual weights (those approved by my university) are $\mathbf C$ and that I have taken all my exams and obtained a specific "mark vector" $\mathbf V$. Further suppose that I am given the opportunity to delete a maximum of $4$ weight factors from my undergraduate career, in the following sense: if I want to delete one weight from exam number $m$, then its weight $c^m$ becomes $\tilde c^m = c^m - 1$, affecting both the numerator and the denominator of $(1)$; I may even set its weight to $0$ if I am particularly unhappy about $v^m$.

How do I choose which weights to delete in order to maximise the value of the weighted average?

I thought that, at least heuristically, choosing to remove the maximum allowed amount of $4$ would always make the best choice; this put me in a similar situation to those that require the use of Lagrange multipliers. The constraint function would be $$g(\mathbf c) = 4 + \sum_{j=1}^k (c^j - C^j) $$ and it has gradient $(1,\dots,1) \neq \mathbf 0$. The theorem tells me that if $\mathbf c_0$ is an extremal point of $f(\mathbf V, \cdot )$ over the null set of $g$, then $$\nabla_{\mathbf c} f (\mathbf V,\mathbf c_0) = \lambda \nabla g(\mathbf c_0) $$ for some $\lambda \in \mathbb R$. However, $\nabla f$ is always a multiple of $\mathbf V$, which in general is linearly independent from $\nabla g = (1,\dots,1)$.

  • Does this mean that my assumption that it is always optimal to get rid of all $4$ weights is flawed, so that the extremal point does not necessarily lie on the line $g(\mathbf c) = 0$, but in the half-plane which has this line as its border and contains the original weight vector $\mathbf C$?
  • Does it even make sense to use Lagrange multipliers, since my problem is "discrete"? (I am not interested in real values of the weights.) My thought was that I was then going to intersect the constraint set with the sensible possibilities for $\mathbf c$, i.e. vectors in $\{1,2,3,4\}^k$, and finding the maximum of $f$ over this intersection; this maximum would exist because a finite set of points is compact, so Weierstrass holds, and it would be attained at the point closest to $\mathbf c_0$.
  • How could I go about this otherwise?