Hi Sergey.Bochkanov!
I fought try MinLM optimizer but still can not find a solution, Sergey.Bochkanov again you try to help me more thorough.
Here is my problem: the problem of mixed pig feed.
For example: To phase 300 kg of diet substances protit 19%, glucit 5%, Lysine 1%. Rate (%) by weight of the feed material in the A, B, C as follows:
A: 36.3% protit; 3.4% glucit; 1.32% Lysine; B: 53.55% protit; 0.89% glucit; 3.7% Lysine C: 11.9% protit; 8.1% glucit; 0.56% Lysine
Requirement: Determine the volume of feed materials of class A, B, C for the preparation of 300 kg of feed mixture as above
Solution
Called a, b, c is the volume of feed materials A, B, C have the following model problem: a + b + c = 300 (36.3 a + 53.55 b + 11.9 c) / 300 = 19 (3.4 a + 0.89 b + 8.1 c) / 300 = 5 (1.32 a + 3.7 b + 0.56c) / 300 = 1
a> 0; b> 0, c> 0
Here is a computer program (already shortened): Double [] matrixB = {300, 19, 5, 1} double [,] matrixA ={ {1, 1, 1} {0.121, 0.1785, 0.0396} {0.0113, 0.0029, 0.027} {0.0044, 0.0123, 0.0018}} int info = 0; Double [] matrixX; alglib.densesolverlsreport repls = new alglib.densesolverlsreport (); alglib.rmatrixsolvels (matrixA, 4, 3, matrixB, 0.001 out info, out repls, out matrixX);
Results: matrixX = {213.90, -71. 965, 158.005} Inferred: a = 213.909 kg; b = -71.965 kg; c = 158.005 kg b = - 71.965 is a number that is not desired, I want all the numbers a, b, c are non-negative numbers, such as the results I would like for the above example would is matrixX = {72, 70, 158.02} or MatrixX = {197.45, 0.00, 173.54} (LINGO SOLVER)
I've tried LSFit which Sergey.Bochkanov introduced but the results remained unchanged, while MinLM optimiser, installation or call the function like I did not do it. my IT are bad and my math are bad and my English too!
Very desire Sergey.Bochkanov help me to solve this problem in a clear way, so I can just copy and past and the program can run well
Thank Sergey.Bochkanov!
Le Huu Ha
|