-
Notifications
You must be signed in to change notification settings - Fork 19
Home
LibOptimization is optimization algorithm library for .NET Framework. This library will probably simplify the optimization using C# and VB.Net and other .NET Framework language.
Implementing optimization algorithm are Steepest Descent Method, Newton Method, Nelder Mead Method (Original ver, Wikipedia ver) ,Hooke and Jeeves of Pattern Search (Direct Search), Real-coded Genetic Algorithm(BLX-alpha and JGG, UNDX and JGG Simplex and JGG, REX and JGG), Particle Swarm Optimization(Basic PSO, LDIW-PSO, CDIW-PSO, CRIW-PSO, AIW-PSO), Differential Evolution(DE/rand/1/bin, DE/best/2/bin), Cuckoo Search(Standard) and Simulated Annealing.
LibOptimizationは制約条件の無い最適化を行う.NET Framework用のライブラリです。実装しているアルゴリズムは最急降下法、ニュートン法、HookeJeevesのパターンサーチ法、Nelder-Mead法(オリジナルの実装、Wikipediaの実装) 、実数値遺伝的アルゴリズム(BLX-α、UNDX、SPX(シンプレクス)、REX、世代交代はJGG)、粒子群最適化(Basic PSO, LDIW-PSO, CDIW-PSO, CRIW-PSO, AIW-PSO)、Differential Evolution(差分進化? DE/rand/1/bin、DE/best/2/bin)、Cuckoo Search(Matlabコードの移植版)、焼きなまし法です。
URL:https://www.nuget.org/packages/LibOptimization/
PM> Install-Package LibOptimization
require derivative algorithm
- Steepest Descent Method
- Newton Method
derivative free algorithm
- Nelder Mead Method (Original ver, Wikipedia ver)
- Hooke and Jeeves of Pattern Search (Direct Search)
Nature inspired derivative free algorithm
- Real-coded Genetic Algorithm BLX-alpha and JGG(Just Generation Gap)
- Real-coded Genetic Algorithm UNDX(Unimodal Normal Distribution Crossover) and JGG
- Real-coded Genetic Algorithm SPX(Simplex Crossover) and JGG
- Real-coded Genetic Algorithm REX(Real-coded Ensemble Crossover) and JGG
- Basic Particle Swarm Optimization
- Particle Swarm Optimization using Linear Decrease Inertia Weight
- Particle Swarm Optimization using Chaotic inertia weight(CDIW-PSO, CRIW-PSO)
- Particle Swarm Optmization using adaptive inertia weight
- Differential Evolution(DE/rand/1/bin)
- Differential Evolution(DE/best/2/bin)
- Standrad Cuckoo Search
derivative free algorithm (Randomized algorithm)
- Simulated Annealing
Typical Use
- You inherit "absObjectiveFunction" class and design objective function.
- Choose an optimization method and implement code.
- Do optimization.
- Get result and evaluate.
- Typical use code
'Instantiation optimization class and set objective function.
Dim optimization As New clsOptSteepestDescent(New clsBenchSphere(1))
'Initialize starting value
optimization.Init()
'Do calc
optimization.DoIteration()
'Get result. Check recent error.
If optimization.IsRecentError() = True Then
Return
Else
clsUtil.DebugValue(optimization)
End If
- When you want result every 5 times.
With Nothing
Dim optimization As New clsOptSteepestDescent(New clsBenchSphere(2))
optimization.Init()
While (optimization.DoIteration(5) = False)
clsUtil.DebugValue(optimization)
End While
clsUtil.DebugValue(optimization, ai_isOnlyIterationCount:=True)
End With
- set initial point
Dim optimization As New clsOptSteepestDescent(New clsBenchSphere(2))
optimization.Init(New Double() {-10, 10})
While (optimization.DoIteration(5) = False)
clsUtil.DebugValue(optimization)
End While
clsUtil.DebugValue(optimization, ai_isOnlyIterationCount:=True)
- You can use other optimization method(inherit absObjctiveFcuntion).
Dim optimization As New clsOptRealGASPX(New clsBenchRastriginFunction(20))
optimization.Init()
clsUtil.DebugValue(optimization)
While True
If optimization.DoIteration(10) = True Then
Exit While
End If
clsUtil.DebugValue(optimization, ai_isOutValue:=False)
End While
If optimization.IsRecentError() = True Then
Return
End If
clsUtil.DebugValue(optimization)
- Multi point and MultiThread
- Multipoint avoids Local minimum by preparing many values.
'prepare many optimization class.
Dim multipointNumber As Integer = 30
Dim listOptimization As New List(Of absOptimization)
For i As Integer = 0 To multipointNumber - 1
Dim tempOpt As New clsOptNelderMead(New clsBenchAckley(20))
tempOpt.Init()
listOptimization.Add(tempOpt)
Next
'using Parallel.ForEach
Dim lockObj As New Object()
Dim best As LibOptimization.absOptimization = Nothing
Threading.Tasks.Parallel.ForEach(listOptimization, Sub(opt As absOptimization)
opt.DoIteration()
'Swap best result
SyncLock lockObj
If best Is Nothing Then
best = opt
ElseIf best.Result.Eval > opt.Result.Eval Then
best = opt
End If
End SyncLock
End Sub)
'Check Error
If best.IsRecentError() = True Then
Return
Else
clsUtil.DebugValue(best)
End If
Microsoft Public License (MS-PL)
http://opensource.org/licenses/MS-PL
.NET Framework 4.0
- 金谷 健一, "これなら分かる最適化数学―基礎原理から計算手法まで", 共立出版株式会社, 2007年初版第7刷
- Hooke, R. and Jeeves, T.A., ""Direct search" solution of numerical and statistical problems", Journal of the Association for Computing Machinery (ACM) 8 (2), pp212–229.
- J.A.Nelder and R.Mead, "A simplex method for function minimization" ,The Computer Journal vol.7, 308–313 (1965)
- W.H.Press, B.P.Flannery,S.A.Teukolsky,W.T.Vetterlin, "NUMERICAL RECIPES in C 日本語版 C言語による数値計算のレシピ", 株式会社技術評論社, 平成19年 初版 第14刷,
- 北野宏明編著, "『遺伝的アルゴリズム』", 産業図書株式会社, 平成5年初版
- 北野宏明 (編集), "遺伝的アルゴリズム 4", 産業図書出版株式会社, 2000年初版
- 小野功,佐藤浩,小林重信, "単峰性正規分布交叉UNDXを用いた実数値GAによる関数最適化",人工知能学会誌,Vol. 14,No. 6,pp. 1146-1155 (1999)
- 樋口 隆英, 筒井 茂義, 山村 雅幸, "実数値GAにおけるシンプレクス交叉", 人工知能学会論文誌Vol. 16 (2001) No. 1 pp.147-155
- 小林重信, "実数値GAのフロンティア",人工知能学会誌 Vol. 24, No. 1, pp.147-162 (2009)
- James Kennedy and Russell Eberhart, "Particle Swarm Optimization.", Proceedings of IEEE the International Conference on Neural Networks,1995
- Shi, Y. and Eberhart, R.C., "A Modified Particle Swarm Optimizer", Proceedings of Congress on Evolu-tionary Computation, 79-73., 1998
- R. C. Eberhart and Y. Shi, "Comparing inertia weights and constriction factors in particle swarm optimization", In Proceedings of the Congress on Evolutionary Computation, vol. 1, pp. 84–88, IEEE, La Jolla, Calif, USA, July 2000.
- Y. Shi and Russell C. Eberhart, "Empirical Study of Particle Swarm Optimization, Proceeding Congress on Evolutionary Computation 1999, Piscataway, 1945-1949
- Y. Feng, G. Teng, A. Wang, Y.M. Yao, "Chaotic inertia weight in particle swarm optimization", in: Second International Conference on Innovative Computing, Information and Control (ICICIC 07), 2007, pp. 475–1475.
- A. Nickabadi, M. M. Ebadzadeh, and R. Safabakhsh, “A novel particle swarm optimization algorithm with adaptive inertia weight,” Applied Soft Computing Journal, vol. 11, no. 4, pp. 3658–3670, 2011.
- Nelder-Mead法(http://ja.wikipedia.org/wiki/Nelder-Mead%E6%B3%95)
- Storn, R., Price, K., "Differential Evolution – A Simple and Efficient Heuristic for Global Optimization over Continuous Spaces", Journal of Global Optimization 11: 341–359.
- Xin-She Yang, Suash Deb, "Cuckoo search via Lévy flights.", World Congress on Nature and Biologically Inspired Computing (NaBIC 2009). IEEE Publications. pp. 210–214. arXiv:1003.1594v1.
- Cuckoo Search (CS) Algorithm (http://www.mathworks.com/matlabcentral/fileexchange/29809-cuckoo-search--cs--algorithm)
- 焼きなまし法(http://ja.wikipedia.org/wiki/%E7%84%BC%E3%81%8D%E3%81%AA%E3%81%BE%E3%81%97%E6%B3%95)