Coder Social home page Coder Social logo

tomitomi3 / liboptimization Goto Github PK

View Code? Open in Web Editor NEW
55.0 6.0 18.0 5.01 MB

LibOptimization is numerical optimization algorithm library for .NET Framework. / .NET用の数値計算、最適化ライブラリ

License: MIT License

C# 2.27% Visual Basic .NET 97.73%
optimization optimization-algorithms optimization-algorithm-library genetic-algorithm particle-swarm-optimization firefly-algorithm nelder-mead pso derivative-free-algorithm algorithm

liboptimization's People

Contributors

fraschfn avatar tomitomi3 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

liboptimization's Issues

Integer overflow exception at absOptimization..ctor()

Namespace Optimization
    ...
    Public MustInherit Class absOptimization
        ...
        Protected m_rand As System.Random = New clsRandomXorshift(CUInt(Environment.TickCount))

Environment.TickCount can actually return negative number (it does at my machine).

There should be
Protected m_rand As System.Random = New clsRandomXorshift(BitConverter.ToUInt32(BitConverter.GetBytes(Environment.TickCount), 0))

When initializing DE with upper and lower bounds, do not evaluate the point twice

Today, when initializing DE with upper and lower bounds, points are evaluated twice. This is inefficient and noticeable when evaluation is expensive.

Today's process:

  1. clsOptDE.Init(): generate a random point using initial value ranges
  2. Create and evaluate the clsPoint
  3. Limit the solution space to upper and lower bounds
  4. Reevaluate the point

You can see the point is evaluated twice, in steps #2 and #4

Ideal process:

  1. Generate a random point using the upper and lower bounds if they exist (don't use initial value ranges)
  2. Create the point

In this flow the point is only evaluated once.

There is a secondary bug with the limit function where the random point is not uniformly sampled from the upper and lower bounds. Instead it is uniformly sampled from the initial value ranges, so if the upper and lower bounds are wider, you miss parts of those bounds, and if the bounds are narrower, you are more likely to get "random" points from the edge of the bounds.

NSGA

TODO:NSGA
NSGA for Multi objective optimization.
*NSGA(Non-dominated Sorting Genetic Algorithm)

Using LibOptimization

Hello,

I would like to use Liboptimization for a 2 variables function in my vb.net code.
I've coded my function f(x,y), but then, the syntax
Dim optimization As New clsOptDEJADE(New f( ))
is not correct, as the two parameters x and y are needed, and have to be declared. Could you give an example with a customize function please?

Kazu

InitialPositionプロパティで設定した初期値が正しく設定されていない

初期値のプロパティがあった場合、値を足していた。

If MyBase.InitialPosition IsNot Nothing AndAlso MyBase.InitialPosition.Length = Me.m_func.NumberOfVariable Then
    value += Me.InitialPosition(j)
End If

集団の中で1つだけ設定しても効果が薄いと思うので、集団の1/10を初期値に書き換えるようにする。

NSGAII

TODO:NSGAII
NSGAII for Multi objective optimization. NSGAII that improved NSGA.

best optimization method

hi, tomi, your project is really awesome

i'm trying to simulate this R code in vb.net

dp <- garch_test$X__1
llh <- function(par) { mu <- par[1]; omega <- par[2]; alpha <- par[3]; beta <- par[4]; e2 <- (dp-mu)^2; e2t <- omega + alphac(mean(e2), e2[-length(dp)]); s2 <- filter(e2t, beta, "recursive", init = mean(e2)); 0.5sum( log(2pi) + log(s2) + e2/s2) }
mu <- mean(dp); omega <- 0.1
var(dp); alpha <- 0.1; beta <- 0.8
par <- c(mu, omega, alpha, beta)
small <- 1e-6
low <- c(-10abs(mu), small, small, small)
up <- c(10
abs(mu), 100*abs(mu), 1-small, 1-small)
fit <- nlminb(start=par, objective=llh, lower=low, upper=up, control=list(x.tol = 1e-8,trace=0))
names(fit$par) <- c("mu", "omega", "alpha", "beta")
round(fit$par, 6)

nlminb optimization method allows initial parameter values and low/up bound of parameters
it converges really fast

any of your method allows this options?

i tested clsOptDE and gets a really accurate values, but does not converge so fast

thanks in advance

Maximize the function (differential evolution)

Good afternoon.
The question of how to maximize the function?
Example: z = 3 * Math.Pow((1 - x), 2) * Math.Exp(-(Math.Pow(x , 2)) - Math.Pow((y + 1) , 2)) - 10 * (x / 5 - Math.Pow(x , 3) - Math.Pow(y , 5)) * Math.Exp(-Math.Pow(x , 2) - Math.Pow(y , 2)) - 1 / 3 * Math.Exp(-Math.Pow((x + 1) , 2) - Math.Pow(y , 2));

enhancment error log

エラー関係を見直し。
例外を投げるようにした方が良さそう。

Explanation please on intepreting the results of clsOptDE test?

In the SampleVB project there is this code for using clsOptDE, with two Console write-line statements I added:

   'LeastSquaresMethod 最小二乗法
    With Nothing
        Console.WriteLine("------------------------------ BEGIN: DATA.CSV --------------------")

        '評価関数
        Dim objectiveFunction = New clsLeastSquaresMethod()
        If objectiveFunction.Init("..\..\..\_sampledata\data.csv") = False Then
            Return
        End If

        '最小化
        Dim opt As New LibOptimization.Optimization.clsOptDE(objectiveFunction)
        opt.Init()
        LibOptimization.Util.clsUtil.DebugValue(opt)
        While (opt.DoIteration(50) = False)
            LibOptimization.Util.clsUtil.DebugValue(opt, ai_isOutValue:=False)
        End While
        LibOptimization.Util.clsUtil.DebugValue(opt)
        Console.WriteLine("------------------------------ END: DATA.CSV --------------------")
    End With

When I run the program I get:

------------------------------ BEGIN: DATA.CSV --------------------
TargetFunction:clsLeastSquaresMethod Dimension:5
OptimizeMethod:clsOptDE
Eval :59438373.1751817
IterationCount:0
Result :
-0.0158704898822757
-0.381333913044383
4.93756533831767
-4.28593948466842
3.24185321532233

Eval :1429.78513592157
Eval :0.956465983765879
Eval :0.000497619640101209
Eval :3.08647227393116E-07
Eval :1.38365563205351E-10
Eval :1.84394063162285E-13
Eval :1.06744757544432E-16
Eval :4.16369815393116E-20
Eval :2.33202429712711E-23
TargetFunction:clsLeastSquaresMethod Dimension:5
OptimizeMethod:clsOptDE
Eval :3.04300885378471E-24
IterationCount:460
Result :
0.0499999999999999
0.999999999999999
-9.99999999999997
-99.9999999999999
99.9999999999983

------------------------------ END: DATA.CSV --------------------

Can someone tell me how this relates to the data found in data.csv, the data file used with the object function?:

x,y
-20,-1900
-19.8,-1918.02392
-18.8,-1953.08032
-7.2,62.72128
3.8,-359.10232
7.2,-630.78272

I'm trying to figure out how to use clsOptDE with my app, where I need to call a particular function (the "fitness" function in GA terms) that analyzes a particular test vector against my fitness function. My fitness function uses the field values in the test vector to run a test against a data set.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.