2012-08-22 113 views
0

我想提取s的錯誤值。 s值可以通過將等式擬合成等式來計算。該公式已知變量(a,b,c,e,i),它們有一定的誤差相關。 我想這:數學優化

f[i, a, b, c, e, 
    s] = ((i*b/(e*(a - c))*s*b/(e*c))/(i*b/(e*(a - c)) + s*b/(e*c)) - 
    i*b/(e*a)) 
Nminimize[ 
f[i, a, b, c, e, s] == 0.062 && 1.19 <= a <= 1.21 && 
    1.09 <= b <= 1.11 && 0.8 <= c <= 0.9 && 
    76.7*10^-4 <= e <= 77.7*10^-4 && 0.001265 <= i <= 0.001224, s] 

沒了我一直在尋找... 0.0618011 Nminimize [假,0.00206]

也許你可以幫我這個答案。 非常感謝您的關注。 Sandrina

回答

0

您的變量i的間隔可能是錯誤的(最大值小於最小值)。

我試過你的問題使用微軟Solver基金會。

結果:

a: 1,19398028498287 
b: 1,09538090507082 
c: 0,810937961158584 
e: 0,00768194947134329 
i: 0,00125448670370341 
s: 0,00220457588242784 

我的C#代碼:

using System; 
using Microsoft.SolverFoundation.Services; 

namespace akMSFStackOverflow 
{ 
    class Program 
    { 
     static void Main(string[] args) 
     { 
      SolverContext context = SolverContext.GetContext();    
      Model model = context.CreateModel();        

      Decision a = new Decision(Domain.RealNonnegative, "a"); 
      Decision b = new Decision(Domain.RealNonnegative, "b"); 
      Decision c = new Decision(Domain.RealNonnegative, "c"); 
      Decision e = new Decision(Domain.RealNonnegative, "e"); 
      Decision i = new Decision(Domain.RealNonnegative, "i"); 
      Decision s = new Decision(Domain.RealNonnegative, "s"); 
      Term goal; 

      model.AddDecisions(a, b, c, e, i, s); 

      goal = (i * b/(e * (a - c)) * s * b/(e * c))/
        (i * b/(e * (a - c)) + s * b/(e * c)) - i * b/(e * a); 

      model.AddConstraints("limits",        
           1.19 <= a <= 1.21, 
           1.09 <= b <= 1.11, 
           0.8 <= c <= 0.9, 
           76.7e-4 <= e <= 77.7e-4, 
           0.001224 <= i <= 0.001265); // min/max swapped for i bound! 

      model.AddGoal("goal", GoalKind.Minimize, (goal - 0.062) * (goal - 0.062)); 

      Solution solution = context.Solve(); 


      Report report = solution.GetReport(); 
      Console.WriteLine("a={0} b={1} c={2} e={3} i={4} s={5} ", a, b, c, e, i, s); 
      Console.Write("{0}", report); 
     } 
    } 
}