Software Engineer here,
I am trying to find an algorithm to solve the following problem, basically I have 3 equations that you can see bellow, and all values of X, Y, Z, and Xi, Yi, Zi's are known. The only unknowns are C values that I am trying to find.
I understand Simplex Method has to be used there (or if anything else please suggest).
But I am new to simplex method, and really confused about many things, like for example what is my objective function? I understand all equalities should be changed to 2 inequalities, so that way I have 6 equations, and this can be considered my restrictions? in that case still confused about my objective function. What should I maximize or minimize if I am just trying to find a value?
If anyone can help me understand this better so I can eventually understand how to make a Tableu and solve this using a programming language, will be great. (Links to a good reads are appreciated as well, so far tried wikipedia, wasn't a good help)
am I even on the right path?
Anyway, here are the equations:
Edit: Forgot to add, all variables are between 0 and 1, which is a major constraint I guess.
Edit 2: I made some progress since yesterday, and tried to implement the simplex the way I see. (See the Tableau)(I tried to maximize for the SUM of C's as a goal)
And it kind of works! As in, it did calculate most of the cases exactly right.
Here is how I test if it was correct - I take my numbers feed to simplex, get C's, then I multiply vector of C's with the matrix back again, expecting to get the same X Y Z values I started with. If it's the same, then it worked.
Problem is, there are weird edge cases! That I can't seem to be able to wrap my brain around.
For example this values work perfectly: X = 0.06837372481822968 Y = 0.13674744963645935 Z = 0.022791240364313126
But, this values (literally almost the same) X = 0.06716471165418625 Y = 0.1343294233083725 Z = 0.022388236597180367
fail!, And fail means the resulting C values from simplex are HUGELY different (missing mid part, middle of C's are zeroes), and this when multiplied back with matrix produces different results from initial values.
How can that be? does it mean that simplex fails due to some wrong constraints or? How do I look at this?
To explain this better, take a look how resulting answer of simplex, just collapses with this little number chance (I checked and during process at some point just different pivot is chosen) Check how third line just dropped in the middle, compared to other two.
This pic kind of suggests that issue is because solutions dip under 0, for whatever reason? not sure why and how to prevent that.