TridentGoalSeek.Core 1.0.4

Suggested Alternatives

TridentGoalSeek 1.0.5

Additional Details

Please use the TridentGoalSeek package targeting .NET Standard 1.0, starting from Version 1.0.5.

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package TridentGoalSeek.Core --version 1.0.4
NuGet\Install-Package TridentGoalSeek.Core -Version 1.0.4
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TridentGoalSeek.Core" Version="1.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TridentGoalSeek.Core --version 1.0.4
#r "nuget: TridentGoalSeek.Core, 1.0.4"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install TridentGoalSeek.Core as a Cake Addin
#addin nuget:?package=TridentGoalSeek.Core&version=1.0.4

// Install TridentGoalSeek.Core as a Cake Tool
#tool nuget:?package=TridentGoalSeek.Core&version=1.0.4

Example Usage

As a trivial example, one could have an algorithm that just multiplies an input variable by 2. Meaning, if the goal is 10 then the calculated input variable is 5. If goal is 30 then the calculated input variable is 15.

In the below example, the MyAlgorithm class could be extremely complicated, yet the goal seek would try multiple 'inputVariable' values until the seek result is found.

private class MyAlgorithm : IGoalSeekAlgorithm
{
    private readonly int multiplier;

    public MyAlgorithm(int multiplier)
    {
        this.multiplier = multiplier;
    }

    public decimal Calculate(decimal inputVariable)
    {
        return inputVariable * multiplier;
    }
}

private void GoalSeekDemo()
{
    var calc = new MyAlgorithm(2);
    var goalSeeker = new GoalSeek(calc);
    var seekResult = goalSeeker.SeekResult(50);

    Console.WriteLine("The variable required to get to the goal value of 50 is: " + seekResult.InputVariable);
}

Goal Seek Output

The GoalSeekResult has 4 properties.

InputVariable: This number is the answer you are looking for. This is the number that was determined by the algorithm to get you to your specified goal value.

OutputValue: This number represents what goal value the algorithm managed to get to. This output value may not match the goal specified, either because of the acceptance criteria, the algorithm, or the parameters passed to the SeekResult() method.

StabAttempts: This represents the number of times the algorithm had to take a 'stab' of input values to work toward the goal output value. This is purely informational.

WithinAcceptanceThreshold: A boolean indicating if the goal seek was successful.


Overload Input Parameters (optional)

In terms of calling the overload function, the parameters are as follows:

  • tineExplorePercentage - this is how much the algorithm will attempt to 'explore' other values. For example, the starting guess value is 0, with a tine spacing of 1. This means it will input -1, 0 and 1. The default explore percentage is 100%, so the next stab will be 100% of the existing tine spacing, which would be 2.

  • focusPercentage - when the algorithm knows that the input value is between the stab points (the tines), then it narrows in on the value by reducing the tine spacing by this percentage. Default is 90%.

  • acceptanceToDecimalPlaces - the higher this value, the more accurate the guessed input value.

  • startingStabPoint - if you know the general region of what the input typically is, you can start you guesses at this value, reducing the total number of guesses as it is closer to the goal that if you started guessing from 0 (the default start point).

  • initalTineSpacing - how broad you want to guess. If you change this to 100, then starting guesses will be -100, 0, 100.

  • maximumAttempts - the algorithm has a default of 1000 maximum stab guesses. This is here to help prevent the algorithm from guessing in an endless loop.

  • trimFinalInputValue - as an example, if the input value that a goal seek needs to work out happens to be the number 5, the algorithm might output 4.99999 as the answer, even though it's not 100% correct. Trimming the final input value tries whole numbers as inputs even after the algorithm thinks it is close enough. This is defaulted to true.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 is compatible.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETCoreApp 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated

*** Usage ***

The usage is as follows:

  var myCalculation = new MyCalculation(10);
  //Your 'MyCalculation' algorithm needs to implement the IGoalSeekAlgorithm interface.
  var goalSeeker = new GoalSeek(myCalculation);
  var seekResult = goalSeeker.SeekResult(170);   



*** Output ***

The GoalSeekResult has 4 properties.

InputVariable: This number is the answer you are looking for. This is the number that was determined by the algorithm to get you to your specified goal value.

OutputValue: This number represents what goal value the algorithm managed to get to. This output value may not match the goal specified, either because of the acceptance criteria, the algorithm, or the parameters passed to the SeekResult() method.

StabAttempts: This represents the number of times the algorithm had to take a 'stab' of input values to work toward the goal output value. This is purely informational.

WithinAcceptanceThreshold: A boolean indicating if the goal seek was successful.