Optimizing costs of objects when "relative costs" are known

22 Views Asked by At

I have $n$ objects (types of monsters in a videogame).

I also have a table $\{a_{ij}\}$ of how well each type performs against other type. So, for example $a_{ij}=3$ means that $1$ monster of type $i$ is roughly equivalent in power to $3$ monsters of type $j$. Obviously, $a_{ij}=\frac{1}{a_{ji}}$.

My goal now is to assign costs $c_i$ to each monster type so that it correlates well with empirically obtained table: $$\frac{c_i}{c_j}\approx a_{ij}$$

The equality is impossible, so I need to minimize error: $$\sum_{i,j=1}^{n} \left(\frac{c_i}{c_j}-a_{ij}\right)^2\rightarrow \min_{c_i}$$ (Here we can assume $c_1=1$ for normalization).

Another, less preferable variant (because larger costs are included with same weight into the total error, but it seems simpler) is to minimize: $$\sum_{i,j=1}^{n} \left(c_i-a_{ij}c_j\right)^2\rightarrow \min_{c_i}$$

How do I go about doing this? I remember that I was able to solve the bottom one analytically before, but now have troubles with it. Are there simple approximation methods I could program in reasonable time to approximate the solution? Or some existing optimization solvers I could use? Maybe this is some well-known problem that I forgot or don't know about.

Thanks.