1
$\begingroup$

I am not a math expert nor a native English speaker, so maybe I am using wrong terminology... In this case, help me to improve my question :)

Part 1:

This is my set of equations, I have to calculate values $x_n$, $y_n$ and $z_n$. I know the values of $A, B, C$, Total and sums of parameters ($S_1$ = $x_1$ + $x_2$ + $x_3$, $S_2$ = $y_1$ + $y_2$ + $y_3$, $S_3$ = $z_1$ + $z_2$ + $z_3$). It is not necessary, that each equation gives us exactly the same result, but each equation should have its solution it's close to others as possible - in perfect case this would be $\text{Total}/3$.

$x_1A + y_1B + z_1C = \text{Total}/3$

$x_2A + y_2B + z_2C = \text{Total}/3$

$x_3A + y_3B + z_3C = \text{Total}/3$

I figured it out, this is a set of diophantine equations. I could solve this with a genetic algorithm:

  • First randomly assign values $x_n$, $y_n$ and $z_n$ (just watch for the sum of parameters)
  • Then mutate this numbers so, that the solution of each equation is as close to others as possible. By mutating I mean to increase one parameter while decreasing another and calculate fitness function.

Part 2:

I think the first solution should work (have to try it out though). But it was a simplification of my original problem, which is like this:

$i(x_1A + y_1B + z_1C) = \text{Total}/3$

$j (x_2A + y_2B + z_2C) = \text{Total}/3$

$k (x_3A + y_3B + z_3C) = \text{Total}/3$

Now the problem is, that I cannot just randomly increase/decrease parameters, because $i$, $j$ and $k$ could be different and hence the set of these equations could yield different solution as previous mutation. Also - $i$, $j$ and $k$ are not given, I have to calculate them by my self.

What is the best way to solve my two problems?

  • 0
    I fixed the equations; don't use asterisks, because it is considered mark-up language2010-10-27

1 Answers 1