2012-08-22 69 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); 
     } 
    } 
}