Excel GoalSeek algorithm

前端 未结 3 2043
误落风尘
误落风尘 2021-01-06 03:55

Does anyone have the code for this algorithm ? Any C-based programming language would be OK but I prefer C#.

I could try to implement it but I\'m sure I\'m not the f

3条回答
  •  走了就别回头了
    2021-01-06 04:44

    Try https://www.nuget.org/packages/Budoom.GoalSeek/

    Sample usage:

    var sc = new SomeCalculation(); //implements interface Budoom.IGoalSeek
    
    var goalSeek = new Budoom.GoalSeek(sc);
    var goalSeekResult = goalSeek.TrySeek();
    

    or use the static method and pass the calculation function to it, like this:

    var goalSeekResult = Budoom.GoalSeek.TrySeek(Calculate);
    

提交回复
热议问题