BeeAlgorithmLibrary 3.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package BeeAlgorithmLibrary --version 3.0.2
NuGet\Install-Package BeeAlgorithmLibrary -Version 3.0.2
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="BeeAlgorithmLibrary" Version="3.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BeeAlgorithmLibrary --version 3.0.2
#r "nuget: BeeAlgorithmLibrary, 3.0.2"
#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 BeeAlgorithmLibrary as a Cake Addin
#addin nuget:?package=BeeAlgorithmLibrary&version=3.0.2

// Install BeeAlgorithmLibrary as a Cake Tool
#tool nuget:?package=BeeAlgorithmLibrary&version=3.0.2

BeeAlgorithmLibrary -- Artificial Bee Colony (ABC)

BeeAlgorithmLibrary is a C# library for solving optimization problems using the Artificial Bee Colony (ABC) Algorithm introduced by Derviş Karaboğa to the literature.

IMPORTANT

This library does not use the standard bee algorithm. It provides the Artificial Bee Colony (ABC) Algorithm

More

You can learn more about how the algorithm works here See the Artificial Bee Colony (ABC) Algorithm Homepage. HomePage

You can learn more about how the algorithm works on wikipedia Artificial Bee Colony (ABC) Algorithm Wikipedia. Wikipedia

Installation

To use this library, you can add it to your project as a NuGet Package.

dotnet add package BeeAlgorithmLibrary --version 3.0.1

or

NuGet\Install-Package BeeAlgorithmLibrary -Version 3.0.1

How to Use

You can follow these steps to solve an optimization problem using BeeAlgorithmLibrary: Define the Objective Function: Create an objective function that represents the problem you want to solve. This function takes a vector of inputs and returns a score. The goal is to minimize this score.

Create a BeeAlgorithm Object: Define the optimization problem using the BeeAlgorithm class. Specify parameters such as the objective function, dimension, colony size, maximum number of iterations, lower and upper bounds of the search space.

Solve the Optimization Problem: Solve the optimization problem using the BeeAlgorithm object. You can obtain the best solution by calling the Solve() method.


/* Fatih Kütük */

namespace Samples
{
    public class Worker : BackgroundService
    {
        private readonly ILogger _logger;

        public Worker(ILogger logger)
        {
            _logger = logger;
        }

        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            while (!stoppingToken.IsCancellationRequested)
            {
                Func<double[], double> TestFunction = (sol) =>
                {
                    int j;
                    double top = 0;
    
                    for (j = 0; j < sol.Length; j++)
                    {
                        top = top + (Math.Pow(sol[j], (double)2) - 10 * Math.Cos(2 * Math.PI * sol[j]) + 10);
                    }
                    return top;
                };
                int NP = 20; // The number of colony size (employed bees+onlooker bees)

                int maxCycle = 2500;// The number of cycles for foraging {a stopping criteria}

                int limit = 100; // A food source which could not be improved through "limit" trials is abandoned by its employed bee

                int D = 100; // The number of parameters of the problem to be optimized

                double lb = -5.12; // lower bound of the parameters.

                double ub = 5.12; // upper bound of the parameters. lb and ub can be defined as arrays for the problems of which parameters have different bounds

                int runtime = 30; // Algorithm can be run many times in order to see its robustness

                //Func<double[], double> customTestFunction = BeeAlgorithmLibrary.Extentions.TestFunctions.Rastrigin; if u want test with global functions u can use extensions like this block
                BeeAlgorithmLibrary.Extentions.Types.OptimizationType optimizationType = BeeAlgorithmLibrary.Extentions.Types.OptimizationType.Minimize; // if u want minimize the function use Minimize, if u want maximize function use Maximize
               
                Func<double[], double> customTestFunction = BeeAlgorithmLibrary.Extentions.TestFunctions.Rastrigin; // if u want u can create your own test function 
                
                BeeAlgorithmLibrary.BeeAlgorithm beeAlgorithm = new BeeAlgorithmLibrary.BeeAlgorithm(optimizationType, NP, maxCycle, limit, D, lb, ub, runtime,customTestFunction);
                //BeeAlgorithmLibrary.BeeAlgorithm beeAlgorithm = new BeeAlgorithmLibrary.BeeAlgorithm(optimizationType, NP, maxCycle, limit, D, lb, ub, runtime); if u dont give custom test function it will run with default Sphere function
                
                BeeAlgorithmResult solve = beeAlgorithm.Solve();

                //BeeAlgorithmResult solve = await beeAlgorithm.SolveAsync(); for async 
            }
        }
    }
}
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.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
3.0.3 88 3/11/2024
3.0.2 90 3/8/2024
3.0.1 88 3/7/2024
3.0.0 90 3/7/2024
2.0.0 84 3/7/2024

Samples Repostory added