The horizontal forces at the walls don't have to be equal
If they're not equal, then the system is not static. Those two forces are the only horizontal forces acting on the system, so they must cancel out. Note that your solution has the two forces very close to each other. Remove the negative from your RHS (Valery has defined F0x as acting in the opposite direction as F4x) and re-enable evaluation of that region and your final result is pretty much unchanged.
The reactions at 0 and 4 must be in the direction of the string.
For example:
(negative required due to how your variables are defined)
You can write a similar equation for the forces at point 4.
Also, you can balance the forces in the X direction at points 1, 2, & 3, and you can balance the forces in both the X and Y directions at points 0 & 4. Some of these equations will likely be redundant (what's the mathematical term for this?).
The horizontal forces at the weights are equal (for static equilibrium.) The walls are fixed, so there is no requirement that F0x and F4x be equal in magnitude.
Yes, I was sloppy in directions so I needed a negative sign.
I agree the walls are fixed, but look at the string. It has 5 forces acting on it. 3 of those forces are vertical (points 1, 2, and 3), so the horizontal components of the other two (0 & 4) must be equal and opposite.
The book, in two volumes, is written in Italian and was published in the middle of the last century. I bought it when I was a student in the preparation of the relative rational mechanics exam. The above image is my own translation.
since it was given an answer to the problem, I do not continued in the calculation. Go on those who want it.
you changed the Geometry: Value x4 from 280mm to 340mm. Why? (better to compare with 280mm to the former problems/situations)
Setting up the 2.nd mass from 2gm to -10gm (now it it a Force upwards) doesn't (may not) corupt the Energy-Laws, so the use of the minimize-Method is in my opinion ok.
The minimal Princip of the potential energys is given by m1, m3.