├── .editorconfig
├── .gitignore
├── .tgitconfig
├── HowToUse.md
├── LICENSE
├── LibOptimization
├── BenchmarkFunctions
│ ├── clsBenchAckley.vb
│ ├── clsBenchBoothFunction.vb
│ ├── clsBenchDeJongFunction1.vb
│ ├── clsBenchDeJongFunction2.vb
│ ├── clsBenchDeJongFunction3.vb
│ ├── clsBenchDeJongFunction4.vb
│ ├── clsBenchDeJongFunction5.vb
│ ├── clsBenchEasomFunction.vb
│ ├── clsBenchEllipsoid.vb
│ ├── clsBenchFivewellPotential.vb
│ ├── clsBenchGriewank.vb
│ ├── clsBenchPowell.vb
│ ├── clsBenchRastrigin.vb
│ ├── clsBenchRidge.vb
│ ├── clsBenchRosenblock.vb
│ ├── clsBenchSchaffer.vb
│ ├── clsBenchSchwefel.vb
│ ├── clsBenchShubertsFunction.vb
│ ├── clsBenchSphere.vb
│ ├── clsBenchSphereNumericDiff.vb
│ └── clsBenchTest.vb
├── LibOptimization.vbproj
├── MathTool
│ ├── ConstantValues.vb
│ ├── DenseMatrix.vb
│ ├── DenseVector.vb
│ ├── Eigen.vb
│ ├── LU.vb
│ ├── MathException.vb
│ ├── MathUtil.vb
│ ├── RNG
│ │ ├── RandomUtil.vb
│ │ ├── RandomXorshift.vb
│ │ └── RandomXorshiftSingleton.vb
│ └── SVD.vb
├── My Project
│ └── launchSettings.json
├── Optimization
│ ├── Dto
│ │ ├── clsFireFly.vb
│ │ ├── clsParticle.vb
│ │ └── clsPoint.vb
│ ├── Template
│ │ └── clsOptTemplate.vb
│ ├── clsOptCS.vb
│ ├── clsOptDE.vb
│ ├── clsOptDEJADE.vb
│ ├── clsOptES.vb
│ ├── clsOptFA.vb
│ ├── clsOptHillClimbing.vb
│ ├── clsOptNelderMead.vb
│ ├── clsOptNelderMeadANMS.vb
│ ├── clsOptNelderMeadWiki.vb
│ ├── clsOptNewtonMethod.vb
│ ├── clsOptPSO.vb
│ ├── clsOptPSOAIW.vb
│ ├── clsOptPSOCPSO.vb
│ ├── clsOptPSOChaoticIW.vb
│ ├── clsOptPSOLDIW.vb
│ ├── clsOptPatternSearch.vb
│ ├── clsOptRealGABLX.vb
│ ├── clsOptRealGAPCX.vb
│ ├── clsOptRealGAREX.vb
│ ├── clsOptRealGASPX.vb
│ ├── clsOptRealGAUNDX.vb
│ ├── clsOptSimulatedAnnealing.vb
│ └── clsOptSteepestDescent.vb
├── Util
│ ├── clsError.vb
│ ├── clsEval.vb
│ └── clsUtil.vb
├── abstract
│ ├── absObjectiveFunction.vb
│ └── absOptimization.vb
└── logo_liboptimization.png
├── LibOptimizationDotNet3.0
├── LibOptimizationDotNet3.0.vbproj
└── My Project
│ ├── Application.Designer.vb
│ ├── Application.myapp
│ ├── AssemblyInfo.vb
│ ├── Resources.Designer.vb
│ ├── Resources.resx
│ ├── Settings.Designer.vb
│ └── Settings.settings
├── LibOptimizationDotNet3.5
├── LibOptimizationDotNet3.5.vbproj
└── My Project
│ ├── Application.Designer.vb
│ ├── Application.myapp
│ ├── AssemblyInfo.vb
│ ├── Resources.Designer.vb
│ ├── Resources.resx
│ ├── Settings.Designer.vb
│ └── Settings.settings
├── LibOptimizationDotNet4.6
├── LibOptimizationDotNet4.6.vbproj
└── My Project
│ ├── Application.Designer.vb
│ ├── Application.myapp
│ ├── AssemblyInfo.vb
│ ├── Resources.Designer.vb
│ ├── Resources.resx
│ ├── Settings.Designer.vb
│ └── Settings.settings
├── OptimizeFunction.sln
├── README.md
├── ReleaseNote.md
├── SampleCSharp
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── RosenBrock.cs
├── SampleCSharp.csproj
├── SimulatedAnnealingSample.cs
└── app.config
├── SampleVB
├── LeastSquaresMethod.vb
├── Module1.vb
├── My Project
│ ├── Application.Designer.vb
│ ├── Application.myapp
│ ├── AssemblyInfo.vb
│ ├── Resources.Designer.vb
│ ├── Resources.resx
│ ├── Settings.Designer.vb
│ └── Settings.settings
├── RosenBrock.vb
├── SampleVB.vbproj
└── app.config
├── TestCode
├── Module1.vb
├── My Project
│ ├── Application.Designer.vb
│ ├── AssemblyInfo.vb
│ ├── Resources.Designer.vb
│ ├── Resources.resx
│ └── Settings.Designer.vb
├── TestCode.vbproj
└── app.config
├── TestLibOptimization
├── My Project
│ ├── Application.Designer.vb
│ ├── Application.myapp
│ ├── AssemblyInfo.vb
│ ├── Resources.Designer.vb
│ ├── Resources.resx
│ ├── Settings.Designer.vb
│ └── Settings.settings
├── TestLibOptimization.vbproj
├── UnitTestLibOptimization.vb
├── UnitTestLinearAlgebra.vb
├── UnitTestMathUtil.vb
└── UnitTestOther.vb
├── TestLibOptimizationDotNet3.0
├── My Project
│ ├── Application.Designer.vb
│ ├── Application.myapp
│ ├── AssemblyInfo.vb
│ ├── Resources.Designer.vb
│ ├── Resources.resx
│ ├── Settings.Designer.vb
│ └── Settings.settings
├── TestLibOptimizationDotNet3.0.vb
└── TestLibOptimizationDotNet3.0.vbproj
├── TestLibOptimizationDotNet3.5
├── My Project
│ ├── Application.Designer.vb
│ ├── Application.myapp
│ ├── AssemblyInfo.vb
│ ├── Resources.Designer.vb
│ ├── Resources.resx
│ ├── Settings.Designer.vb
│ └── Settings.settings
└── TestLibOptimizationDotNet3.5.vbproj
├── TestLibOptimizationDotNetCore
└── TestLibOptimizationDotNetCore.vbproj
├── _BuildLib
└── release_space.txt
├── github_pic
├── liboptimization_nuget.png
└── logo_liboptimization.png
├── gitのコマンドメモ.txt
└── nugetメモ.txt
/.editorconfig:
--------------------------------------------------------------------------------
1 | # Rules in this file were initially inferred by Visual Studio IntelliCode from the C:\Users\tomitomi\Desktop\LibOptimization_new_develop codebase based on best match to current usage at 2023/01/15
2 | # You can modify the rules from these initially generated values to suit your own policies
3 | # You can learn more about editorconfig here: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference
4 | [*.cs]
5 |
6 |
7 | #Core editorconfig formatting - indentation
8 |
9 | #use soft tabs (spaces) for indentation
10 | indent_style = space
11 |
12 | #Formatting - new line options
13 |
14 | #place else statements on a new line
15 | csharp_new_line_before_else = true
16 | #require members of object initializers to be on the same line
17 | csharp_new_line_before_members_in_object_initializers = false
18 | #require braces to be on a new line for methods, control_blocks, and types (also known as "Allman" style)
19 | csharp_new_line_before_open_brace = methods, control_blocks, types
20 |
21 | #Formatting - organize using options
22 |
23 | #sort System.* using directives alphabetically, and place them before other usings
24 | dotnet_sort_system_directives_first = true
25 |
26 | #Formatting - spacing options
27 |
28 | #require NO space between a cast and the value
29 | csharp_space_after_cast = false
30 | #require a space before the colon for bases or interfaces in a type declaration
31 | csharp_space_after_colon_in_inheritance_clause = true
32 | #require a space after a keyword in a control flow statement such as a for loop
33 | csharp_space_after_keywords_in_control_flow_statements = true
34 | #require a space before the colon for bases or interfaces in a type declaration
35 | csharp_space_before_colon_in_inheritance_clause = true
36 | #remove space within empty argument list parentheses
37 | csharp_space_between_method_call_empty_parameter_list_parentheses = false
38 | #remove space between method call name and opening parenthesis
39 | csharp_space_between_method_call_name_and_opening_parenthesis = false
40 | #do not place space characters after the opening parenthesis and before the closing parenthesis of a method call
41 | csharp_space_between_method_call_parameter_list_parentheses = false
42 | #remove space within empty parameter list parentheses for a method declaration
43 | csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
44 | #place a space character after the opening parenthesis and before the closing parenthesis of a method declaration parameter list.
45 | csharp_space_between_method_declaration_parameter_list_parentheses = false
46 |
47 | #Style - Code block preferences
48 |
49 | #prefer curly braces even for one line of code
50 | csharp_prefer_braces = true:suggestion
51 |
52 | #Style - expression bodied member options
53 |
54 | #prefer block bodies for methods
55 | csharp_style_expression_bodied_methods = false:suggestion
56 |
57 | #Style - Expression-level preferences
58 |
59 | #prefer objects to not be initialized using object initializers
60 | dotnet_style_object_initializer = false:suggestion
61 |
62 | #Style - implicit and explicit types
63 |
64 | #prefer var over explicit type in all cases, unless overridden by another code style rule
65 | csharp_style_var_elsewhere = true:suggestion
66 | #prefer var is used to declare variables with built-in system types such as int
67 | csharp_style_var_for_built_in_types = true:suggestion
68 | #prefer var when the type is already mentioned on the right-hand side of a declaration expression
69 | csharp_style_var_when_type_is_apparent = true:suggestion
70 |
71 | #Style - language keyword and framework type options
72 |
73 | #prefer the language keyword for local variables, method parameters, and class members, instead of the type name, for types that have a keyword to represent them
74 | dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
75 |
76 | #Style - modifier options
77 |
78 | #prefer accessibility modifiers to be declared except for public interface members. This will currently not differ from always and will act as future proofing for if C# adds default interface methods.
79 | dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
80 |
81 | #Style - Modifier preferences
82 |
83 | #when this rule is set to a list of modifiers, prefer the specified ordering.
84 | csharp_preferred_modifier_order = public,private,override,static:suggestion
85 |
86 | #Style - qualification options
87 |
88 | #prefer fields not to be prefaced with this. or Me. in Visual Basic
89 | dotnet_style_qualification_for_field = false:suggestion
90 | #prefer methods to be prefaced with this. in C# or Me. in Visual Basic
91 | dotnet_style_qualification_for_method = true:suggestion
92 | insert_final_newline=true
93 |
--------------------------------------------------------------------------------
/.tgitconfig:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tomitomi3/LibOptimization/323fb6144be973ddd9e1ec494113f49d035c6711/.tgitconfig
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 tomitomi3
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/LibOptimization/BenchmarkFunctions/clsBenchAckley.vb:
--------------------------------------------------------------------------------
1 | Imports LibOptimization.Optimization
2 |
3 | Namespace BenchmarkFunction
4 | '''
5 | ''' Benchmark function
6 | ''' Ackley's function
7 | '''
8 | '''
9 | ''' Minimum:
10 | ''' F(0,...,0) = 0
11 | ''' Range:
12 | ''' -32.768 to 32.768
13 | ''' Referrence:
14 | ''' 小林重信, "実数値GAのフロンティア",人工知能学会誌 Vol. 24, No. 1, pp.147-162 (2009)
15 | '''
16 |
17 | Public Class clsBenchAckley : Inherits absObjectiveFunction
18 | Private dimension As Integer = 0
19 |
20 | '''
21 | ''' Default constructor
22 | '''
23 | '''
24 | Public Sub New(ByVal ai_dim As Integer)
25 | Me.dimension = ai_dim
26 | End Sub
27 |
28 | '''
29 | ''' Target Function
30 | '''
31 | '''
32 | '''
33 | '''
34 | Public Overrides Function F(ByVal ai_var As List(Of Double)) As Double
35 | If ai_var Is Nothing Then
36 | Return 0
37 | End If
38 |
39 | If Me.dimension <> ai_var.Count Then
40 | Return 0
41 | End If
42 |
43 | Dim a As Double = 0.0
44 | Dim b As Double = 0.0
45 | For i As Integer = 0 To Me.dimension - 1
46 | a += ai_var(i) ^ 2
47 | b += Math.Cos(2 * Math.PI * ai_var(i))
48 | Next
49 | Dim ret As Double = 20 - 20 * Math.Exp(-0.2 * Math.Sqrt((1 / Me.dimension) * a)) + Math.E - Math.Exp((1 / Me.dimension) * b)
50 |
51 | Return ret
52 | End Function
53 |
54 | Public Overrides Function Gradient(ByVal ai_var As List(Of Double), Optional h As Double = 0.000001) As List(Of Double)
55 | Throw New NotImplementedException
56 | End Function
57 |
58 | Public Overrides Function Hessian(ByVal ai_var As List(Of Double), Optional h As Double = 0.000001) As List(Of List(Of Double))
59 | Throw New NotImplementedException
60 | End Function
61 |
62 | Public Overrides Function NumberOfVariable() As Integer
63 | Return Me.dimension
64 | End Function
65 | End Class
66 |
67 | End Namespace
68 |
--------------------------------------------------------------------------------
/LibOptimization/BenchmarkFunctions/clsBenchBoothFunction.vb:
--------------------------------------------------------------------------------
1 | Imports LibOptimization.Optimization
2 |
3 | Namespace BenchmarkFunction
4 | '''
5 | ''' Benchmark function
6 | ''' Booth Function
7 | '''
8 | '''
9 | ''' Minimum:
10 | ''' F(1,3) = 0
11 | ''' Range:
12 | ''' -10 to 10
13 | ''' Referrence:
14 | ''' http://www-optima.amp.i.kyoto-u.ac.jp/member/student/hedar/Hedar_files/TestGO_files/Page816.htm
15 | '''
16 |
17 | Public Class clsBenchBoothFunction : Inherits absObjectiveFunction
18 | '''
19 | ''' Default constructor
20 | '''
21 | '''
22 | Public Sub New()
23 | End Sub
24 |
25 | '''
26 | ''' Target Function
27 | '''
28 | '''
29 | '''
30 | '''
31 | Public Overrides Function F(ByVal x As List(Of Double)) As Double
32 | If x Is Nothing Then
33 | Return 0
34 | End If
35 |
36 | Return (x(0) + 2 * x(1) - 7) ^ 2 + (2 * x(0) + x(1) - 5) ^ 2
37 | End Function
38 |
39 | Public Overrides Function NumberOfVariable() As Integer
40 | Return 2
41 | End Function
42 |
43 | Public Overrides Function Gradient(ByVal x As List(Of Double), Optional h As Double = 0.000001) As List(Of Double)
44 | Return MyBase.Gradient(x, h)
45 | End Function
46 |
47 | Public Overrides Function Hessian(x As List(Of Double), Optional h As Double = 0.000001) As List(Of List(Of Double))
48 | Return MyBase.Hessian(x, h)
49 | End Function
50 | End Class
51 |
52 | End Namespace
53 |
--------------------------------------------------------------------------------
/LibOptimization/BenchmarkFunctions/clsBenchDeJongFunction1.vb:
--------------------------------------------------------------------------------
1 | Imports LibOptimization.Optimization
2 |
3 | Namespace BenchmarkFunction
4 | '''
5 | ''' Benchmark function
6 | ''' De Jong’s function 1 (Sphere Function)
7 | '''
8 | '''
9 | ''' Minimum:
10 | ''' F(0, 0, 0) = 0
11 | ''' Range
12 | ''' -5.12 ~ 5.12
13 | ''' Refference:
14 | ''' De Jong, K. A., "Analysis of the Behavior of a Class of Genetic Adaptive Systems", PhD dissertation, The University of Michigan, Computer and Communication Sciences Department (1975)
15 | '''
16 |
17 | Public Class clsBenchDeJongFunction1 : Inherits absObjectiveFunction
18 | '''
19 | ''' Default constructor
20 | '''
21 | '''
22 | Public Sub New()
23 | End Sub
24 |
25 | '''
26 | ''' Target Function
27 | '''
28 | '''
29 | '''
30 | '''
31 | Public Overrides Function F(ByVal x As List(Of Double)) As Double
32 | If x Is Nothing Then
33 | Return 0
34 | End If
35 |
36 | Dim ret As Double = 0
37 | For i As Integer = 0 To 2
38 | If (x(i) >= -5.12) AndAlso (x(i) <= 5.12) Then
39 | ret += x(i) ^ 2
40 | Else
41 | 'out of range
42 | ret += Math.Abs(x(i)) * 2 'penarty
43 | End If
44 | Next
45 | Return ret
46 | End Function
47 |
48 | Public Overrides Function Gradient(ByVal ai_var As List(Of Double), Optional h As Double = 0.000001) As List(Of Double)
49 | Dim ret As New List(Of Double)
50 | For i As Integer = 0 To 2
51 | ret.Add(2.0 * ai_var(i))
52 | Next
53 | Return ret
54 | End Function
55 |
56 | Public Overrides Function Hessian(ByVal ai_var As List(Of Double), Optional h As Double = 0.000001) As List(Of List(Of Double))
57 | Dim ret As New List(Of List(Of Double))
58 | For i As Integer = 0 To 2
59 | ret.Add(New List(Of Double))
60 | For j As Integer = 0 To 2
61 | If i = j Then
62 | ret(i).Add(2.0)
63 | Else
64 | ret(i).Add(0)
65 | End If
66 | Next
67 | Next
68 | Return ret
69 | End Function
70 |
71 | Public Overrides Function NumberOfVariable() As Integer
72 | Return 3
73 | End Function
74 | End Class
75 |
76 | End Namespace
77 |
--------------------------------------------------------------------------------
/LibOptimization/BenchmarkFunctions/clsBenchDeJongFunction2.vb:
--------------------------------------------------------------------------------
1 | Imports LibOptimization.Optimization
2 |
3 | Namespace BenchmarkFunction
4 | '''
5 | ''' Benchmark function
6 | ''' De Jong’s function 2 (2D Rosenblock Function)
7 | '''
8 | '''
9 | ''' Minimum:
10 | ''' F(1, 1) = 0
11 | ''' Range
12 | ''' -2.048 ~ 2.048
13 | ''' Refference:
14 | ''' De Jong, K. A., "Analysis of the Behavior of a Class of Genetic Adaptive Systems", PhD dissertation, The University of Michigan, Computer and Communication Sciences Department (1975)
15 | '''
16 |
17 | Public Class clsBenchDeJongFunction2 : Inherits absObjectiveFunction
18 | '''
19 | ''' Default constructor
20 | '''
21 | '''
22 | Public Sub New()
23 | End Sub
24 |
25 | '''
26 | ''' Target Function
27 | '''
28 | '''
29 | '''
30 | '''
31 | Public Overrides Function F(ByVal x As List(Of Double)) As Double
32 | If x Is Nothing Then
33 | Return 0
34 | End If
35 |
36 | If (x(0) >= -2.048) AndAlso (x(0) <= 2.048) Then
37 | If (x(1) >= -2.048) AndAlso (x(1) <= 2.048) Then
38 | Return 100 * ((x(0) ^ 2 - x(1)) ^ 2) + (1 - x(0)) ^ 2
39 | End If
40 | End If
41 |
42 | 'out of range
43 | Return Math.Abs(x(0)) * Math.Abs(x(1)) * 100 'penarty
44 | End Function
45 |
46 | Public Overrides Function Gradient(ByVal x As List(Of Double), Optional h As Double = 0.000001) As List(Of Double)
47 | Throw New NotImplementedException
48 | End Function
49 |
50 | Public Overrides Function Hessian(ByVal x As List(Of Double), Optional h As Double = 0.000001) As List(Of List(Of Double))
51 | Throw New NotImplementedException
52 | End Function
53 |
54 | Public Overrides Function NumberOfVariable() As Integer
55 | Return 2
56 | End Function
57 | End Class
58 |
59 | End Namespace
60 |
--------------------------------------------------------------------------------
/LibOptimization/BenchmarkFunctions/clsBenchDeJongFunction3.vb:
--------------------------------------------------------------------------------
1 | Imports LibOptimization.Optimization
2 |
3 | Namespace BenchmarkFunction
4 | '''
5 | ''' Benchmark function
6 | ''' De Jong’s function 3 (Step Function)
7 | '''
8 | '''
9 | ''' Minimum:
10 | ''' x = {-5.12~-5, -5.12~-5, -5.12~-5, -5.12~-5, -5.12~-5}
11 | ''' Range
12 | ''' -5.12 ~ 5.12
13 | ''' Refference:
14 | ''' De Jong, K. A., "Analysis of the Behavior of a Class of Genetic Adaptive Systems", PhD dissertation, The University of Michigan, Computer and Communication Sciences Department (1975)
15 | '''
16 |
17 | Public Class clsBenchDeJongFunction3 : Inherits absObjectiveFunction
18 | '''
19 | ''' Default constructor
20 | '''
21 | '''
22 | Public Sub New()
23 | End Sub
24 |
25 | '''
26 | ''' Target Function
27 | '''
28 | '''
29 | '''
30 | '''
31 | Public Overrides Function F(ByVal x As List(Of Double)) As Double
32 | If x Is Nothing Then
33 | Return 0
34 | End If
35 |
36 | Dim ret As Double = 0
37 | For i As Integer = 0 To 4
38 | If (x(i) >= -5.12) AndAlso (x(i) <= 5.12) Then
39 | ret += Math.Floor(x(i))
40 | Else
41 | 'out of range
42 | ret += Math.Abs(x(i)) 'penarty
43 | End If
44 | Next
45 | Return ret
46 | End Function
47 |
48 | Public Overrides Function Gradient(ByVal ai_var As List(Of Double), Optional h As Double = 0.000001) As List(Of Double)
49 | Throw New NotImplementedException
50 | End Function
51 |
52 | Public Overrides Function Hessian(ByVal ai_var As List(Of Double), Optional h As Double = 0.000001) As List(Of List(Of Double))
53 | Throw New NotImplementedException
54 | End Function
55 |
56 | Public Overrides Function NumberOfVariable() As Integer
57 | Return 5
58 | End Function
59 | End Class
60 |
61 | End Namespace
62 |
--------------------------------------------------------------------------------
/LibOptimization/BenchmarkFunctions/clsBenchDeJongFunction4.vb:
--------------------------------------------------------------------------------
1 | Imports LibOptimization.MathTool.RNG
2 | Imports LibOptimization.Optimization
3 |
4 | Namespace BenchmarkFunction
5 | '''
6 | ''' Benchmark function
7 | ''' De Jong’s function 4 (qudratic with gauss Function)
8 | '''
9 | '''
10 | ''' Minimum:
11 | ''' x = {0, ..., 0}
12 | ''' Range
13 | ''' -1.28 ~ 1.28
14 | ''' Refference:
15 | ''' De Jong, K. A., "Analysis of the Behavior of a Class of Genetic Adaptive Systems", PhD dissertation, The University of Michigan, Computer and Communication Sciences Department (1975)
16 | '''
17 |
18 | Public Class clsBenchDeJongFunction4 : Inherits absObjectiveFunction
19 | Private normRand As New List(Of Double)
20 |
21 | '''
22 | ''' Default constructor
23 | '''
24 | '''
25 | Public Sub New()
26 | For i As Integer = 0 To 29
27 | Me.normRand.Add(RandomUtil.NormRand())
28 | Next
29 | End Sub
30 |
31 | '''
32 | ''' Target Function
33 | '''
34 | '''
35 | '''
36 | '''
37 | Public Overrides Function F(ByVal x As List(Of Double)) As Double
38 | If x Is Nothing Then
39 | Return 0
40 | End If
41 |
42 | Dim ret As Double = 0
43 | For i As Integer = 0 To 29
44 | If (x(i) >= -1.28) AndAlso (x(i) <= 1.28) Then
45 | ret += (i + 1) * x(i) * x(i) * x(i) * x(i) + Me.normRand(i)
46 | Else
47 | 'out of range
48 | ret += Math.Abs(i) 'penarty
49 | End If
50 | Next
51 |
52 | Return ret '???
53 | End Function
54 |
55 | Public Overrides Function Gradient(ByVal ai_var As List(Of Double), Optional h As Double = 0.000001) As List(Of Double)
56 | Throw New NotImplementedException
57 | End Function
58 |
59 | Public Overrides Function Hessian(ByVal ai_var As List(Of Double), Optional h As Double = 0.000001) As List(Of List(Of Double))
60 | Throw New NotImplementedException
61 | End Function
62 |
63 | Public Overrides Function NumberOfVariable() As Integer
64 | Return 30
65 | End Function
66 | End Class
67 |
68 | End Namespace
69 |
--------------------------------------------------------------------------------
/LibOptimization/BenchmarkFunctions/clsBenchDeJongFunction5.vb:
--------------------------------------------------------------------------------
1 | Imports LibOptimization.Optimization
2 |
3 | Namespace BenchmarkFunction
4 | '''
5 | ''' Benchmark function
6 | ''' De Jong’s function 5
7 | '''
8 | '''
9 | ''' Minimum:
10 | ''' x = {-32,-32}
11 | ''' f(x) ~ 1
12 | ''' Range
13 | ''' -65.536 ~ 65.536
14 | ''' Refference:
15 | ''' De Jong, K. A., "Analysis of the Behavior of a Class of Genetic Adaptive Systems", PhD dissertation, The University of Michigan, Computer and Communication Sciences Department (1975)
16 | '''
17 |
18 | Public Class clsBenchDeJongFunction5 : Inherits absObjectiveFunction
19 | Private ReadOnly a()() As Double = {New Double() {-32, -16, 0, 16, 32, -32, -16, 0, 16, 32, -32, -16, 0, 16, 32, -32, -16, 0, 16, 32, -32, -16, 0, 16, 32}, _
20 | New Double() {-32, -32, -32, -32, -32, -16, -16, -16, -16, -16, 0, 0, 0, 0, 0, 16, 16, 16, 16, 16, 32, 32, 32, 32, 32}}
21 |
22 | '''
23 | ''' Default constructor
24 | '''
25 | '''
26 | Public Sub New()
27 | End Sub
28 |
29 | '''
30 | ''' Target Function
31 | '''
32 | '''
33 | '''
34 | '''
35 | Public Overrides Function F(ByVal x As List(Of Double)) As Double
36 | If x Is Nothing Then
37 | Return 0
38 | End If
39 |
40 | 'Correc value
41 | ' Taken from : http://jp.mathworks.com/help/gads/example-minimizing-de-jongs-fifth-function.html
42 | ' x = {-16.1292, -15.8214}
43 | ' f(x) = 6.9034
44 |
45 | 'range check
46 | If (x(0) >= -65.536) AndAlso (x(0) <= 65.536) Then
47 | If (x(1) >= -65.536) AndAlso (x(1) <= 65.536) Then
48 | Dim ret As Double = 1 / 500
49 | For j As Integer = 0 To 24
50 | ret += 1 / (j + 1 + (x(0) - a(0)(j)) ^ 6 + (x(1) - a(1)(j)) ^ 6)
51 | Next
52 |
53 | Return 1 / ret
54 | End If
55 | End If
56 |
57 | 'out of range
58 | Return Math.Abs(x(0)) + Math.Abs(x(1)) + 1000
59 | End Function
60 |
61 | Public Overrides Function Gradient(ByVal ai_var As List(Of Double), Optional h As Double = 0.000001) As List(Of Double)
62 | Throw New NotImplementedException
63 | End Function
64 |
65 | Public Overrides Function Hessian(ByVal ai_var As List(Of Double), Optional h As Double = 0.000001) As List(Of List(Of Double))
66 | Throw New NotImplementedException
67 | End Function
68 |
69 | Public Overrides Function NumberOfVariable() As Integer
70 | Return 2
71 | End Function
72 | End Class
73 |
74 | End Namespace
75 |
--------------------------------------------------------------------------------
/LibOptimization/BenchmarkFunctions/clsBenchEasomFunction.vb:
--------------------------------------------------------------------------------
1 | Imports LibOptimization.Optimization
2 |
3 | Namespace BenchmarkFunction
4 | '''
5 | ''' Benchmark function
6 | ''' Easom Function
7 | '''
8 | '''
9 | ''' Minimum:
10 | ''' F(pi, pi) = -1
11 | ''' Range:
12 | ''' −100≦x1 , x2≦100
13 | ''' Referrence:
14 | ''' [1]Test fXin-She Yang, "Test Problems in Optimization", arXiv(http://arxiv.org/abs/1008.0549)
15 | '''
16 |
17 | Public Class clsBenchEasomFunction : Inherits absObjectiveFunction
18 | '''
19 | ''' Default constructor
20 | '''
21 | '''
22 | Public Sub New()
23 | End Sub
24 |
25 | '''
26 | ''' Target Function
27 | '''
28 | '''
29 | '''
30 | '''
31 | Public Overrides Function F(ByVal x As List(Of Double)) As Double
32 | If x Is Nothing Then
33 | Return 0
34 | End If
35 |
36 | Dim x1 As Double = x(0)
37 | Dim x2 As Double = x(1)
38 | Dim ret As Double = -Math.Cos(x1) * Math.Cos(x2) * Math.Exp(-((x1 - Math.PI) ^ 2 + (x2 - Math.PI) ^ 2))
39 | Return ret
40 | End Function
41 |
42 | Public Overrides Function Gradient(ByVal ai_var As List(Of Double), Optional h As Double = 0.000001) As List(Of Double)
43 | Throw New NotImplementedException
44 | End Function
45 |
46 | Public Overrides Function Hessian(ByVal ai_var As List(Of Double), Optional h As Double = 0.000001) As List(Of List(Of Double))
47 | Throw New NotImplementedException
48 | End Function
49 |
50 | Public Overrides Function NumberOfVariable() As Integer
51 | Return 2
52 | End Function
53 | End Class
54 |
55 | End Namespace
56 |
--------------------------------------------------------------------------------
/LibOptimization/BenchmarkFunctions/clsBenchEllipsoid.vb:
--------------------------------------------------------------------------------
1 | Imports LibOptimization.Optimization
2 |
3 | Namespace BenchmarkFunction
4 | '''
5 | ''' Benchmark function
6 | ''' Ellipsoid function
7 | '''
8 | '''
9 | ''' Minimum:
10 | ''' F(0,...,0) = 0
11 | ''' Range:
12 | ''' -5.12 to 5.12
13 | ''' Referrence:
14 | ''' 小林重信, "実数値GAのフロンティア",人工知能学会誌 Vol. 24, No. 1, pp.147-162 (2009)
15 | '''
16 |
17 | Public Class clsBenchEllipsoid : Inherits absObjectiveFunction
18 | Private dimension As Integer = 0
19 |
20 | '''
21 | ''' Default constructor
22 | '''
23 | ''' Set dimension
24 | '''
25 | Public Sub New(ByVal ai_dim As Integer)
26 | Me.dimension = ai_dim
27 | End Sub
28 |
29 | '''
30 | ''' Target Function
31 | '''
32 | '''
33 | '''
34 | '''
35 | Public Overrides Function F(ByVal ai_var As List(Of Double)) As Double
36 | If ai_var Is Nothing Then
37 | Return 0
38 | End If
39 |
40 | If Me.dimension <> ai_var.Count Then
41 | Return 0
42 | End If
43 |
44 | Dim ret As Double = 0.0
45 | For i As Integer = 0 To Me.dimension - 1
46 | Dim temp As Double = (1000 ^ (i / (Me.dimension - 1))) * ai_var(i)
47 | ret += temp ^ 2
48 | Next
49 |
50 | Return ret
51 | End Function
52 |
53 | Public Overrides Function Gradient(ByVal ai_var As List(Of Double), Optional h As Double = 0.000001) As List(Of Double)
54 | Throw New NotImplementedException
55 | End Function
56 |
57 | Public Overrides Function Hessian(ByVal ai_var As List(Of Double), Optional h As Double = 0.000001) As List(Of List(Of Double))
58 | Throw New NotImplementedException
59 | End Function
60 |
61 | Public Overrides Function NumberOfVariable() As Integer
62 | Return Me.dimension
63 | End Function
64 | End Class
65 |
66 | End Namespace
67 |
--------------------------------------------------------------------------------
/LibOptimization/BenchmarkFunctions/clsBenchFivewellPotential.vb:
--------------------------------------------------------------------------------
1 | Imports LibOptimization.Optimization
2 |
3 | Namespace BenchmarkFunction
4 | '''
5 | ''' Benchmark function
6 | ''' Fivewell-Potential
7 | '''
8 | '''
9 | ''' Minimum:
10 | ''' F(4.92, -9.89) = -1.4616
11 | ''' Range:
12 | ''' -20 to 20
13 | ''' Referrence:
14 | ''' Ilya Pavlyukevich, "Levy flights, non-local search and simulated annealing", Journal of Computational Physics 226 (2007) 1830-1844
15 | '''
16 |
17 | Public Class clsBenchFivewellPotential : Inherits absObjectiveFunction
18 | '''
19 | ''' Default constructor
20 | '''
21 | '''
22 | Public Sub New()
23 | End Sub
24 |
25 | '''
26 | ''' Target Function
27 | '''
28 | '''
29 | '''
30 | '''
31 | Public Overrides Function F(ByVal x As List(Of Double)) As Double
32 | If x Is Nothing Then
33 | Return 0
34 | End If
35 |
36 | If Me.NumberOfVariable <> x.Count Then
37 | Return 0
38 | End If
39 |
40 | Dim ret As Double = 0.0
41 | ret = 1 - 1 / (1 + 0.05 * (x(0) ^ 2 + (x(1) - 10) ^ 2)) - 1 / (1 + 0.05 * ((x(0) - 10)) ^ 2 + x(1) ^ 2) - 1.5 / (1 + 0.03 * ((x(0) + 10)) ^ 2 + x(1) ^ 2) - 2 / (1 + 0.05 * ((x(0) - 5)) ^ 2 + (x(1) + 10) ^ 2) - 1 / (1 + 0.1 * ((x(0) + 5)) ^ 2 + (x(1) + 10) ^ 2)
42 | ret = ret * (1 + 0.0001 * (x(0) ^ 2 + x(1) ^ 2) ^ 1.2)
43 | Return ret
44 | End Function
45 |
46 | Public Overrides Function Gradient(ByVal ai_var As List(Of Double), Optional h As Double = 0.000001) As List(Of Double)
47 | Throw New NotImplementedException
48 | End Function
49 |
50 | Public Overrides Function Hessian(ByVal ai_var As List(Of Double), Optional h As Double = 0.000001) As List(Of List(Of Double))
51 | Throw New NotImplementedException
52 | End Function
53 |
54 | Public Overrides Function NumberOfVariable() As Integer
55 | Return 2
56 | End Function
57 | End Class
58 |
59 | End Namespace
60 |
--------------------------------------------------------------------------------
/LibOptimization/BenchmarkFunctions/clsBenchGriewank.vb:
--------------------------------------------------------------------------------
1 | Imports LibOptimization.Optimization
2 |
3 | Namespace BenchmarkFunction
4 | '''
5 | ''' Benchmark function
6 | ''' Griewank function
7 | '''
8 | '''
9 | ''' Minimum:
10 | ''' F(0,...,0) = 0
11 | ''' Range:
12 | ''' -512 to 512
13 | ''' Referrence:
14 | ''' http://mikilab.doshisha.ac.jp/dia/research/pdga/archive/doc/ga2k_performance.pdf
15 | '''
16 |
17 | Public Class clsBenchGriewank : Inherits absObjectiveFunction
18 | Private dimension As Integer = 0
19 |
20 | '''
21 | ''' Default constructor
22 | '''
23 | '''
24 | Public Sub New(ByVal ai_dim As Integer)
25 | Me.dimension = ai_dim
26 | End Sub
27 |
28 | '''
29 | ''' Target Function
30 | '''
31 | '''
32 | '''
33 | '''
34 | Public Overrides Function F(ByVal ai_var As List(Of Double)) As Double
35 | If ai_var Is Nothing Then
36 | Return 0
37 | End If
38 |
39 | If Me.dimension <> ai_var.Count Then
40 | Return 0
41 | End If
42 |
43 | Dim a As Double = 0.0
44 | Dim b As Double = 0.0
45 | For i As Integer = 0 To Me.dimension - 1
46 | a += (ai_var(i) ^ 2)
47 | b *= Math.Cos(ai_var(i) / Math.Sqrt(i + 1))
48 | Next
49 | Dim ret As Double = a / 4000.0 - b + 1
50 |
51 | Return ret
52 | End Function
53 |
54 | Public Overrides Function Gradient(ByVal ai_var As List(Of Double), Optional h As Double = 0.000001) As List(Of Double)
55 | Throw New NotImplementedException
56 | End Function
57 |
58 | Public Overrides Function Hessian(ByVal ai_var As List(Of Double), Optional h As Double = 0.000001) As List(Of List(Of Double))
59 | Throw New NotImplementedException
60 | End Function
61 |
62 | Public Overrides Function NumberOfVariable() As Integer
63 | Return Me.dimension
64 | End Function
65 | End Class
66 |
67 | End Namespace
68 |
--------------------------------------------------------------------------------
/LibOptimization/BenchmarkFunctions/clsBenchPowell.vb:
--------------------------------------------------------------------------------
1 | Imports LibOptimization.Optimization
2 |
3 | Namespace BenchmarkFunction
4 | '''
5 | ''' Benchmark function
6 | ''' Powell function
7 | '''
8 | '''
9 | ''' Minimum:
10 | ''' F(0,0,0,0) = 0
11 | '''
12 |
13 | Public Class clsBenchPowell : Inherits absObjectiveFunction
14 | '''
15 | ''' Default constructor
16 | '''
17 | '''
18 | Public Sub New()
19 | End Sub
20 |
21 | '''
22 | ''' Target Function
23 | '''
24 | '''
25 | '''
26 | '''
27 | Public Overrides Function F(ByVal ai_var As List(Of Double)) As Double
28 | If ai_var Is Nothing Then
29 | Return 0
30 | End If
31 |
32 | Dim x1 As Double = ai_var(0)
33 | Dim x2 As Double = ai_var(1)
34 | Dim x3 As Double = ai_var(2)
35 | Dim x4 As Double = ai_var(3)
36 | Dim ret As Double = (x1 - 10 * x2) ^ 2 + 5 * (x3 - x4) ^ 2 + (x2 + 2 * x3) ^ 4 + 10 * (x1 - x4) ^ 4
37 | Return ret
38 | End Function
39 |
40 | Public Overrides Function Gradient(ByVal ai_var As List(Of Double), Optional h As Double = 0.000001) As List(Of Double)
41 | Throw New NotImplementedException
42 | End Function
43 |
44 | Public Overrides Function Hessian(ByVal ai_var As List(Of Double), Optional h As Double = 0.000001) As List(Of List(Of Double))
45 | Throw New NotImplementedException
46 | End Function
47 |
48 | Public Overrides Function NumberOfVariable() As Integer
49 | Return 4
50 | End Function
51 | End Class
52 |
53 | End Namespace
54 |
--------------------------------------------------------------------------------
/LibOptimization/BenchmarkFunctions/clsBenchRastrigin.vb:
--------------------------------------------------------------------------------
1 | Imports LibOptimization.Optimization
2 |
3 | Namespace BenchmarkFunction
4 | '''
5 | ''' Benchmark function
6 | ''' Rastrigin function
7 | '''
8 | '''
9 | ''' Minimum:
10 | ''' F(0,...,0) = 0
11 | ''' Range:
12 | ''' -5.12 to 5.12
13 | ''' Referrence:
14 | ''' http://mikilab.doshisha.ac.jp/dia/research/pdga/archive/doc/ga2k_performance.pdf
15 | '''
16 |
17 | Public Class clsBenchRastrigin : Inherits absObjectiveFunction
18 | Private dimension As Integer = 0
19 |
20 | '''
21 | ''' Default constructor
22 | '''
23 | '''
24 | Public Sub New(ByVal ai_dim As Integer)
25 | Me.dimension = ai_dim
26 | End Sub
27 |
28 | '''
29 | ''' Target Function
30 | '''
31 | '''
32 | '''
33 | '''
34 | Public Overrides Function F(ByVal ai_var As List(Of Double)) As Double
35 | If ai_var Is Nothing Then
36 | Return 0
37 | End If
38 |
39 | If Me.dimension <> ai_var.Count Then
40 | Return 0
41 | End If
42 |
43 | Dim A As Double = 10.0
44 | Dim ret As Double = 0.0
45 | For i As Integer = 0 To Me.dimension - 1
46 | ret += ai_var(i) ^ 2 - A * Math.Cos(2.0 * Math.PI * ai_var(i))
47 | Next
48 | ret += A * Me.dimension
49 |
50 | Return ret
51 | End Function
52 |
53 | Public Overloads Function F(ByVal ai_var() As Double) As Double
54 | Return Me.F(New List(Of Double)(ai_var))
55 | End Function
56 |
57 | Public Overrides Function Gradient(ByVal ai_var As List(Of Double), Optional h As Double = 0.000001) As List(Of Double)
58 | Throw New NotImplementedException
59 | End Function
60 |
61 | Public Overrides Function Hessian(ByVal ai_var As List(Of Double), Optional h As Double = 0.000001) As List(Of List(Of Double))
62 | Throw New NotImplementedException
63 | End Function
64 |
65 | Public Overrides Function NumberOfVariable() As Integer
66 | Return Me.dimension
67 | End Function
68 | End Class
69 |
70 | End Namespace
71 |
--------------------------------------------------------------------------------
/LibOptimization/BenchmarkFunctions/clsBenchRidge.vb:
--------------------------------------------------------------------------------
1 | Imports LibOptimization.Optimization
2 |
3 | Namespace BenchmarkFunction
4 | '''
5 | ''' Benchmark function
6 | ''' Ridge Function
7 | '''
8 | '''
9 | ''' Minimum:
10 | ''' F(0,...,0) = 0
11 | ''' Range:
12 | ''' -5.12 to 5.12
13 | ''' Referrence:
14 | ''' http://mikilab.doshisha.ac.jp/dia/research/pdga/archive/doc/ga2k_performance.pdf
15 | '''
16 |
17 | Public Class clsBenchRidge : Inherits absObjectiveFunction
18 | Private dimension As Integer = 0
19 |
20 | '''
21 | ''' Default constructor
22 | '''
23 | '''
24 | Public Sub New(ByVal ai_dim As Integer)
25 | Me.dimension = ai_dim
26 | End Sub
27 |
28 | '''
29 | ''' Target Function
30 | '''
31 | '''
32 | '''
33 | '''
34 | Public Overrides Function F(ByVal ai_var As List(Of Double)) As Double
35 | If ai_var Is Nothing Then
36 | Return 0
37 | End If
38 |
39 | If Me.dimension <> ai_var.Count Then
40 | Return 0
41 | End If
42 |
43 | Dim ret As Double = 0.0
44 | For i As Integer = 0 To Me.dimension - 1
45 | ret += ai_var(i)
46 | Next
47 | ret = ret ^ 2
48 | 'Sum
49 | For i As Integer = 0 To 4
50 | ret += ret
51 | Next
52 | Return ret
53 | End Function
54 |
55 | Public Overloads Function F(ByVal ai_var() As Double) As Double
56 | Return Me.F(New List(Of Double)(ai_var))
57 | End Function
58 |
59 | Public Overrides Function Gradient(ByVal ai_var As List(Of Double), Optional h As Double = 0.000001) As List(Of Double)
60 | Throw New NotImplementedException
61 | End Function
62 |
63 | Public Overrides Function Hessian(ByVal ai_var As List(Of Double), Optional h As Double = 0.000001) As List(Of List(Of Double))
64 | Throw New NotImplementedException
65 | End Function
66 |
67 | Public Overrides Function NumberOfVariable() As Integer
68 | Return Me.dimension
69 | End Function
70 | End Class
71 |
72 | End Namespace
73 |
--------------------------------------------------------------------------------
/LibOptimization/BenchmarkFunctions/clsBenchRosenblock.vb:
--------------------------------------------------------------------------------
1 | Imports LibOptimization.Optimization
2 |
3 | Namespace BenchmarkFunction
4 | '''
5 | ''' Benchmark function
6 | ''' Rosenblock function(Banana function)
7 | '''
8 | '''
9 | ''' Minimum:
10 | ''' F(0,...,0) = 0
11 | '''
12 |
13 | Public Class clsBenchRosenblock : Inherits absObjectiveFunction
14 | Private dimension As Integer = 0
15 |
16 | '''
17 | ''' Default constructor
18 | '''
19 | ''' Set dimension
20 | '''
21 | Public Sub New(ByVal ai_dim As Integer)
22 | If ai_dim <= 1 Then
23 | Throw New NotImplementedException
24 | End If
25 | Me.dimension = ai_dim
26 | End Sub
27 |
28 | '''
29 | ''' Target Function
30 | '''
31 | '''
32 | '''
33 | '''
34 | Public Overrides Function F(ByVal x As List(Of Double)) As Double
35 | If x Is Nothing Then
36 | Return 0
37 | End If
38 |
39 | If Me.dimension <> x.Count Then
40 | Return 0
41 | End If
42 |
43 | Dim ret As Double = 0.0
44 | For i As Integer = 0 To Me.dimension - 2
45 | ret += 100 * (x(i + 1) - x(i) ^ 2) ^ 2 + (x(i) - 1) ^ 2
46 | Next
47 |
48 | Return ret
49 | End Function
50 |
51 | Public Overrides Function Gradient(ByVal x As List(Of Double), Optional h As Double = 0.000001) As List(Of Double)
52 | Dim gradVec As New List(Of Double)
53 |
54 | 'i0
55 | Dim grad As Double = 0
56 | grad = -400 * x(0) * (x(0) - x(1) ^ 2) - 2 * (x(0) - 1)
57 | gradVec.Add(grad)
58 |
59 | 'i1 ~ in-1
60 | For i As Integer = 1 To Me.dimension - 2
61 | grad = -400 * x(i) * (x(i + 1) - x(i) ^ 2) + 200 * (x(i) - x(i - 1) ^ 2) - 2
62 | gradVec.Add(grad)
63 | Next
64 |
65 | 'in
66 | grad = 200 * (x(Me.dimension - 1) - x(Me.dimension - 2) ^ 2)
67 | gradVec.Add(grad)
68 |
69 | Return gradVec
70 | End Function
71 |
72 | Public Overrides Function Hessian(ByVal x As List(Of Double), Optional h As Double = 0.000001) As List(Of List(Of Double))
73 | Dim hesse As New List(Of List(Of Double))
74 | Dim tempVect(Me.dimension - 1) As Double
75 | For i As Integer = 0 To Me.dimension - 1
76 | hesse.Add(New List(Of Double)(tempVect))
77 | Next
78 |
79 | If Me.dimension = 2 Then
80 | For i As Integer = 0 To Me.dimension - 1
81 | For j As Integer = 0 To Me.dimension - 1
82 | If i = j Then
83 | If i <> Me.dimension - 1 Then
84 | hesse(i)(j) = -400 * (x(i + 1) - x(i) ^ 2) + 800 * x(i) ^ 2 - 2
85 | Else
86 | hesse(i)(j) = 200
87 | End If
88 | Else
89 | hesse(i)(j) = -400 * x(0)
90 | End If
91 | Next
92 | Next
93 | Else
94 | For i As Integer = 0 To Me.dimension - 1
95 | For j As Integer = 0 To Me.dimension - 1
96 | If i = j Then
97 | If i = 0 Then
98 | hesse(i)(j) = -400 * (x(i + 1) - x(i) ^ 2) + 800 * x(i) ^ 2 - 2
99 | ElseIf i = Me.dimension - 1 Then
100 | hesse(i)(j) = 200
101 | Else
102 | hesse(i)(j) = -400 * (x(i + 1) - x(i) ^ 2) + 800 * x(i) ^ 2 + 198
103 | End If
104 | End If
105 | If i = j - 1 Then
106 | hesse(i)(j) = -400 * x(i)
107 | End If
108 | If i - 1 = j Then
109 | hesse(i)(j) = -400 * x(j)
110 | End If
111 | Next
112 | Next
113 | End If
114 |
115 | Return hesse
116 | End Function
117 |
118 | Public Overrides Function NumberOfVariable() As Integer
119 | Return Me.dimension
120 | End Function
121 | End Class
122 |
123 | End Namespace
124 |
--------------------------------------------------------------------------------
/LibOptimization/BenchmarkFunctions/clsBenchSchaffer.vb:
--------------------------------------------------------------------------------
1 | Imports LibOptimization.Optimization
2 |
3 | Namespace BenchmarkFunction
4 | '''
5 | ''' Benchmark function
6 | ''' Schaffer function
7 | '''
8 | '''
9 | ''' Minimum:
10 | ''' F(0,...,0) = 0
11 | ''' Range:
12 | ''' -100 to 100
13 | ''' Referrence:
14 | ''' 小林重信, "実数値GAのフロンティア",人工知能学会誌 Vol. 24, No. 1, pp.147-162 (2009)
15 | '''
16 |
17 | Public Class clsBenchSchaffer : Inherits absObjectiveFunction
18 | Private dimension As Integer = 0
19 |
20 | '''
21 | ''' Default constructor
22 | '''
23 | '''
24 | Public Sub New(ByVal ai_dim As Integer)
25 | Me.dimension = ai_dim
26 | End Sub
27 |
28 | '''
29 | ''' Target Function
30 | '''
31 | '''
32 | '''
33 | '''
34 | Public Overrides Function F(ByVal ai_var As List(Of Double)) As Double
35 | If ai_var Is Nothing Then
36 | Return 0
37 | End If
38 |
39 | If Me.dimension <> ai_var.Count Then
40 | Return 0
41 | End If
42 |
43 | Dim ret As Double = 0.0
44 | For i As Integer = 0 To Me.dimension - 2
45 | ret += ((ai_var(i) ^ 2 + ai_var(i + 1) ^ 2) ^ 0.25) * (Math.Sin(50 * ((ai_var(i) ^ 2 + ai_var(i + 1) ^ 2)) ^ 0.1) ^ 2 + 1.0)
46 | Next
47 |
48 | Return ret
49 | End Function
50 |
51 | Public Overloads Function F(ByVal ai_var() As Double) As Double
52 | Return Me.F(New List(Of Double)(ai_var))
53 | End Function
54 |
55 | Public Overrides Function Gradient(ByVal ai_var As List(Of Double), Optional h As Double = 0.000001) As List(Of Double)
56 | Throw New NotImplementedException
57 | End Function
58 |
59 | Public Overrides Function Hessian(ByVal ai_var As List(Of Double), Optional h As Double = 0.000001) As List(Of List(Of Double))
60 | Throw New NotImplementedException
61 | End Function
62 |
63 | Public Overrides Function NumberOfVariable() As Integer
64 | Return Me.dimension
65 | End Function
66 | End Class
67 |
68 | End Namespace
69 |
--------------------------------------------------------------------------------
/LibOptimization/BenchmarkFunctions/clsBenchSchwefel.vb:
--------------------------------------------------------------------------------
1 | Imports LibOptimization.Optimization
2 |
3 | Namespace BenchmarkFunction
4 | '''
5 | ''' Benchmark function
6 | ''' Schwefel function
7 | '''
8 | '''
9 | ''' Minimum:
10 | ''' F(420.96875,...,420.96875) = 0
11 | ''' Range:
12 | ''' -512 to 512
13 | ''' Referrence:
14 | ''' http://mikilab.doshisha.ac.jp/dia/research/pdga/archive/doc/ga2k_performance.pdf
15 | '''
16 |
17 | Public Class clsBenchSchwefel : Inherits absObjectiveFunction
18 | Private dimension As Integer = 0
19 |
20 | '''
21 | ''' Default constructor
22 | '''
23 | '''
24 | Public Sub New(ByVal ai_dim As Integer)
25 | Me.dimension = ai_dim
26 | End Sub
27 |
28 | '''
29 | ''' Target Function
30 | '''
31 | '''
32 | '''
33 | '''
34 | Public Overrides Function F(ByVal x As List(Of Double)) As Double
35 | If x Is Nothing Then
36 | Return 0
37 | End If
38 |
39 | If Me.dimension <> x.Count Then
40 | Return 0
41 | End If
42 |
43 | Dim ret As Double = 0.0
44 | For i As Integer = 0 To Me.dimension - 1
45 | If (x(i) >= -512) AndAlso (x(i) <= 512) Then
46 | ret += -x(i) * Math.Sin(Math.Sqrt(Math.Abs(x(i))))
47 | Else
48 | 'out of range
49 | ret += Math.Abs(x(i))
50 | End If
51 | Next
52 | ret = ret + 418.982887272434 * Me.dimension
53 |
54 | Return ret
55 | End Function
56 |
57 | Public Overrides Function Gradient(ByVal ai_var As List(Of Double), Optional h As Double = 0.000001) As List(Of Double)
58 | Throw New NotImplementedException
59 | End Function
60 |
61 | Public Overrides Function Hessian(ByVal ai_var As List(Of Double), Optional h As Double = 0.000001) As List(Of List(Of Double))
62 | Throw New NotImplementedException
63 | End Function
64 |
65 | Public Overrides Function NumberOfVariable() As Integer
66 | Return Me.dimension
67 | End Function
68 | End Class
69 | End Namespace
70 |
--------------------------------------------------------------------------------
/LibOptimization/BenchmarkFunctions/clsBenchShubertsFunction.vb:
--------------------------------------------------------------------------------
1 | Imports LibOptimization.Optimization
2 |
3 | Namespace BenchmarkFunction
4 | '''
5 | ''' Benchmark function
6 | ''' ShubertsFunction
7 | '''
8 | '''
9 | ''' Minimum:
10 | ''' Fmin = −186.7309
11 | ''' Range:
12 | ''' −10≦x1 , x2≦10
13 | ''' Referrence:
14 | ''' [1]Test fXin-She Yang, "Test Problems in Optimization", arXiv(http://arxiv.org/abs/1008.0549)
15 | '''
16 |
17 | Public Class clsBenchShubertsFunction : Inherits absObjectiveFunction
18 | '''
19 | ''' Default constructor
20 | '''
21 | '''
22 | Public Sub New()
23 | End Sub
24 |
25 | '''
26 | ''' Target Function
27 | '''
28 | '''
29 | '''
30 | '''
31 | Public Overrides Function F(ByVal x As List(Of Double)) As Double
32 | Dim x1 = x(0)
33 | Dim x2 = x(1)
34 | Dim temp1 As Double = (Math.Cos(1 + (1 + 1) * x1) + 2 * Math.Cos(2 + (2 + 1) * x1) + 3 * Math.Cos(3 + (3 + 1) * x1) + 4 * Math.Cos(4 + (4 + 1) * x1) + 5 * Math.Cos(5 + (5 + 1) * x1))
35 | Dim temp2 As Double = (Math.Cos(1 + (1 + 1) * x2) + 2 * Math.Cos(2 + (2 + 1) * x2) + 3 * Math.Cos(3 + (3 + 1) * x2) + 4 * Math.Cos(4 + (4 + 1) * x2) + 5 * Math.Cos(5 + (5 + 1) * x2))
36 |
37 | Return temp1 * temp2
38 | End Function
39 |
40 | Public Overrides Function Gradient(ByVal ai_var As List(Of Double), Optional h As Double = 0.000001) As List(Of Double)
41 | Throw New NotImplementedException
42 | End Function
43 |
44 | Public Overrides Function Hessian(ByVal ai_var As List(Of Double), Optional h As Double = 0.000001) As List(Of List(Of Double))
45 | Throw New NotImplementedException
46 | End Function
47 |
48 | Public Overrides Function NumberOfVariable() As Integer
49 | Return 2
50 | End Function
51 | End Class
52 |
53 | End Namespace
54 |
--------------------------------------------------------------------------------
/LibOptimization/BenchmarkFunctions/clsBenchSphere.vb:
--------------------------------------------------------------------------------
1 | Imports LibOptimization.Optimization
2 |
3 | Namespace BenchmarkFunction
4 | '''
5 | ''' Benchmark function
6 | ''' Sphere Function
7 | '''
8 | '''
9 | ''' Minimum:
10 | ''' F(0,...,0) = 0
11 | ''' Range:
12 | ''' -5.12 to 5.12
13 | ''' Referrence:
14 | ''' http://mikilab.doshisha.ac.jp/dia/research/pdga/archive/doc/ga2k_performance.pdf
15 | '''
16 |
17 | Public Class clsBenchSphere : Inherits absObjectiveFunction
18 | Private dimension As Integer = 0
19 |
20 | '''
21 | ''' Default constructor
22 | '''
23 | ''' Set dimension
24 | '''
25 | Public Sub New(ByVal ai_dim As Integer)
26 | Me.dimension = ai_dim
27 | End Sub
28 |
29 | '''
30 | ''' Target Function
31 | '''
32 | '''
33 | '''
34 | '''
35 | Public Overrides Function F(ByVal ai_var As List(Of Double)) As Double
36 | If ai_var Is Nothing Then
37 | Return 0
38 | End If
39 |
40 | Dim ret As Double = 0
41 | For i As Integer = 0 To Me.dimension - 1
42 | ret += ai_var(i) ^ 2
43 | Next
44 | Return ret
45 | End Function
46 |
47 | Public Overrides Function Gradient(ByVal ai_var As List(Of Double), Optional h As Double = 0.000001) As List(Of Double)
48 | Dim ret As New List(Of Double)
49 | For i As Integer = 0 To Me.dimension - 1
50 | ret.Add(2.0 * ai_var(i))
51 | Next
52 | Return ret
53 | End Function
54 |
55 | Public Overrides Function Hessian(ByVal ai_var As List(Of Double), Optional h As Double = 0.000001) As List(Of List(Of Double))
56 | Dim ret As New List(Of List(Of Double))
57 | For i As Integer = 0 To Me.dimension - 1
58 | ret.Add(New List(Of Double))
59 | For j As Integer = 0 To Me.dimension - 1
60 | If i = j Then
61 | ret(i).Add(2.0)
62 | Else
63 | ret(i).Add(0)
64 | End If
65 | Next
66 | Next
67 | Return ret
68 | End Function
69 |
70 | Public Overrides Function NumberOfVariable() As Integer
71 | Return dimension
72 | End Function
73 | End Class
74 |
75 | End Namespace
76 |
--------------------------------------------------------------------------------
/LibOptimization/BenchmarkFunctions/clsBenchSphereNumericDiff.vb:
--------------------------------------------------------------------------------
1 | Imports LibOptimization.Optimization
2 |
3 | Namespace BenchmarkFunction
4 | '''
5 | ''' Benchmark function
6 | ''' Sphere Function
7 | '''
8 | '''
9 | ''' Minimum:
10 | ''' F(0,...,0) = 0
11 | ''' Range:
12 | ''' -5.12 to 5.12
13 | ''' Referrence:
14 | ''' http://mikilab.doshisha.ac.jp/dia/research/pdga/archive/doc/ga2k_performance.pdf
15 | '''
16 |
17 | Public Class clsBenchSphereNumericDiff : Inherits absObjectiveFunction
18 | Private dimension As Integer = 0
19 |
20 | '''
21 | ''' Default constructor
22 | '''
23 | ''' Set dimension
24 | '''
25 | Public Sub New(ByVal ai_dim As Integer)
26 | Me.dimension = ai_dim
27 | End Sub
28 |
29 | '''
30 | ''' Target Function
31 | '''
32 | '''
33 | '''
34 | '''
35 | Public Overrides Function F(ByVal ai_var As List(Of Double)) As Double
36 | If ai_var Is Nothing Then
37 | Return 0
38 | End If
39 |
40 | Dim ret As Double = 0
41 | For i As Integer = 0 To Me.dimension - 1
42 | ret += ai_var(i) ^ 2
43 | Next
44 | Return ret
45 | End Function
46 |
47 | Public Overrides Function NumberOfVariable() As Integer
48 | Return dimension
49 | End Function
50 | End Class
51 | End Namespace
52 |
--------------------------------------------------------------------------------
/LibOptimization/BenchmarkFunctions/clsBenchTest.vb:
--------------------------------------------------------------------------------
1 | Imports LibOptimization.Optimization
2 |
3 | Namespace BenchmarkFunction
4 | '''
5 | ''' x1^3 + x2^3 - 0*x1*x2 + 27
6 | '''
7 | '''
8 | '''
9 |
10 | Public Class clsBenchTest : Inherits absObjectiveFunction
11 | '''
12 | ''' Default constructor
13 | '''
14 | '''
15 | Public Sub New()
16 | End Sub
17 |
18 | '''
19 | ''' Target Function
20 | '''
21 | '''
22 | '''
23 | '''
24 | Public Overrides Function F(ByVal ai_var As List(Of Double)) As Double
25 | If ai_var Is Nothing Then
26 | Return 0
27 | End If
28 |
29 | Dim ret As Double = ai_var(0) ^ 3 + ai_var(1) ^ 3 - 9 * ai_var(0) * ai_var(1) + 27
30 | Return ret
31 | End Function
32 |
33 | Public Overrides Function Gradient(ByVal ai_var As List(Of Double), Optional h As Double = 0.000001) As List(Of Double)
34 | Dim ret As New List(Of Double)
35 | ret.Add(3 * ai_var(0) ^ 2 - 9 * ai_var(1))
36 | ret.Add(3 * ai_var(1) ^ 2 - 9 * ai_var(0))
37 | Return ret
38 | End Function
39 |
40 | Public Overrides Function Hessian(ByVal ai_var As List(Of Double), Optional h As Double = 0.000001) As List(Of List(Of Double))
41 | Dim ret As New List(Of List(Of Double))
42 |
43 | ret.Add(New List(Of Double))
44 | ret(0).Add(6 * ai_var(0))
45 | ret(0).Add(0)
46 | ret.Add(New List(Of Double))
47 | ret(1).Add(0)
48 | ret(1).Add(6 * ai_var(1))
49 |
50 | Return ret
51 | End Function
52 |
53 | Public Overrides Function NumberOfVariable() As Integer
54 | Return 2
55 | End Function
56 | End Class
57 |
58 | '''
59 | ''' x1^4 - 20*x1^2 + 20*x1 + x2^4 - 20*x2^2 + 20*x2
60 | '''
61 | '''
62 | '''
63 | Public Class clsBenchTest2 : Inherits absObjectiveFunction
64 | '''
65 | ''' Default constructor
66 | '''
67 | '''
68 | Public Sub New()
69 | End Sub
70 |
71 | '''
72 | ''' Target Function
73 | '''
74 | '''
75 | '''
76 | '''
77 | Public Overrides Function F(ByVal ai_var As List(Of Double)) As Double
78 | If ai_var Is Nothing Then
79 | Return 0
80 | End If
81 |
82 | Dim ret As Double = ai_var(0) ^ 4 - 20 * ai_var(0) ^ 2 + 20 * ai_var(0) + ai_var(1) ^ 4 - 20 * ai_var(1) ^ 2 + 20 * ai_var(1)
83 | Return ret
84 | End Function
85 |
86 | Public Overrides Function Gradient(ByVal ai_var As List(Of Double), Optional h As Double = 0.000001) As List(Of Double)
87 | Dim ret As New List(Of Double)
88 | ret.Add(4 * ai_var(0) ^ 3 - 40 * ai_var(0) + 20)
89 | ret.Add(4 * ai_var(1) ^ 3 - 40 * ai_var(1) + 20)
90 | Return ret
91 | End Function
92 |
93 | Public Overrides Function Hessian(ByVal ai_var As List(Of Double), Optional h As Double = 0.000001) As List(Of List(Of Double))
94 | Return Nothing
95 | End Function
96 |
97 | Public Overrides Function NumberOfVariable() As Integer
98 | Return 2
99 | End Function
100 | End Class
101 | End Namespace
102 |
--------------------------------------------------------------------------------
/LibOptimization/LibOptimization.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | LibOptimization
5 | net35;net48;netcoreapp2.1;netcoreapp3.0;netcoreapp3.1;net5.0; net8.0
6 | LibOptimization is a numerical optimization library that simplifies optimization using C#, VisualBasic.Net and other .NET Framework languages. 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, PCX and G3), Particle Swarm Optimization(Basic PSO, LDIW-PSO, CDIW-PSO, CRIW-PSO, AIW-PSO), Differential Evolution(DE/rand/1/bin, DE/best/1/bin, DE/rand/2/bin, DE/best/2/bin, JADE), Cuckoo Search(Standard), FireFry, Simulated Annealing, Evolution Strategy((1+1)-ES) and Hill Climbing.
7 | tomitomi3
8 | tomitomi3
9 | 1.14.0
10 | MIT
11 | https://github.com/tomitomi3/LibOptimization
12 | true
13 | false
14 | false
15 | On
16 |
17 | tomitomi3
18 | optimization heuristic nonlinear numerical math genetic algorithm GA PatternSearch NelderMead ParticleSwarmOptimization DifferentialEvolution CuckooSearch FireFly SimulatedAnnealing EvolutionStrategy HillClimbing
19 | logo_liboptimization.png
20 | https://github.com/tomitomi3/LibOptimization
21 | LibOptimization
22 | some bugfix. Renamed the namespace and class name of my math library.
23 | true
24 | 1.14.0.0
25 | AnyCPU;x86
26 |
27 |
28 |
29 |
30 | 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036
31 |
32 |
33 |
34 | 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036
35 |
36 |
37 |
38 | 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036
39 |
40 |
41 |
42 | 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036
43 |
44 |
45 |
46 | AnyCPU
47 |
48 |
49 |
50 | AnyCPU
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | True
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/LibOptimization/MathTool/ConstantValues.vb:
--------------------------------------------------------------------------------
1 | Namespace MathTool
2 | '''
3 | ''' 定数
4 | '''
5 | Public Class ConstantValues
6 | Public Const SAME_ZERO As Double = 2.0E-50 '2^-50
7 |
8 | Public Const MachineEpsiron As Double = 0.000000000000000222 ' 2.20*E-16 = 2.20*10^-16
9 |
10 | Public Const HalfMachineEpsiron As Double = 0.000000000000000222 * 2.0 ' 1.10*E-16
11 | End Class
12 | End Namespace
13 |
--------------------------------------------------------------------------------
/LibOptimization/MathTool/Eigen.vb:
--------------------------------------------------------------------------------
1 | Namespace MathTool
2 | '''
3 | ''' store Eigen values, vector
4 | '''
5 |
6 | Public Class Eigen
7 | '''
8 | ''' for sort
9 | '''
10 | Private Class ValueDescSort
11 | Implements IComparable
12 |
13 | Public v As Double = 0.0
14 |
15 | Public idx As Integer = 0
16 |
17 | Public Sub New(ByVal v As Double, ByVal idx As Integer)
18 | Me.v = v
19 | Me.idx = idx
20 | End Sub
21 |
22 | Public Function CompareTo(obj As Object) As Integer Implements IComparable.CompareTo
23 | 'Nothing check
24 | If obj Is Nothing Then
25 | Return 1
26 | End If
27 |
28 | 'Type check
29 | If Not Me.GetType() Is obj.GetType() Then
30 | Throw New ArgumentException("Different type", "obj")
31 | End If
32 |
33 | 'Compare descent sort
34 | Dim mineValue As Double = Me.v
35 | Dim compareValue As Double = DirectCast(obj, ValueDescSort).v
36 | If mineValue < compareValue Then
37 | Return 1
38 | ElseIf mineValue > compareValue Then
39 | Return -1
40 | Else
41 | Return 0
42 | End If
43 | End Function
44 | End Class
45 |
46 | Public Property EigenValue As DenseVector = Nothing
47 |
48 | Public Property EigenVector As DenseMatrix = Nothing
49 |
50 | '''
51 | ''' 収束したかのフラグ
52 | '''
53 | '''
54 | Public Property IsConversion As Boolean = Nothing
55 |
56 | Private Sub New()
57 | End Sub
58 |
59 | Public Sub New(ByRef eigeValue As DenseVector, ByRef eigenVec As DenseMatrix)
60 | Me.EigenValue = eigeValue
61 | Me.EigenVector = eigenVec
62 | End Sub
63 |
64 | Public Sub New(ByRef eigeValue As DenseVector, ByRef eigenVec As DenseMatrix, ByVal isconversion As Boolean)
65 | Me.EigenValue = eigeValue
66 | Me.EigenVector = eigenVec
67 | Me.IsConversion = isconversion
68 | End Sub
69 |
70 | '''
71 | ''' sort by eigen value
72 | '''
73 | '''
74 | '''
75 | '''
76 | Public Shared Sub EigenSort(ByRef eigenValue As DenseVector, ByRef eigenVector As DenseMatrix, ByVal isColOrder As Boolean)
77 | Dim n = eigenValue.Count
78 | Dim colSwapInfo = New List(Of ValueDescSort)
79 | For i As Integer = 0 To n - 1
80 | colSwapInfo.Add(New ValueDescSort(eigenValue(i), i))
81 | Next
82 | colSwapInfo.Sort()
83 |
84 | If isColOrder = True Then
85 | Dim newEigenVector = New DenseMatrix(n)
86 | For j As Integer = 0 To n - 1
87 | 'eigen value
88 | eigenValue(j) = colSwapInfo(j).v
89 |
90 | 'eigen vector
91 | Dim k = colSwapInfo(j).idx
92 | For i As Integer = 0 To n - 1
93 | newEigenVector(i)(j) = eigenVector(i)(k)
94 | Next
95 | Next
96 | eigenVector = newEigenVector
97 | Else
98 | Dim newEigenVector = New DenseMatrix(n)
99 | For i = 0 To n - 1
100 | 'eigen value
101 | eigenValue(i) = colSwapInfo(i).v
102 |
103 | 'eigen vector
104 | Dim k = colSwapInfo(i).idx
105 | newEigenVector(i) = eigenVector(k)
106 | Next
107 | eigenVector = newEigenVector
108 | End If
109 | End Sub
110 | End Class
111 | End Namespace
112 |
--------------------------------------------------------------------------------
/LibOptimization/MathTool/LU.vb:
--------------------------------------------------------------------------------
1 | Namespace MathTool
2 | '''
3 | ''' store LU decomposition with solver
4 | '''
5 |
6 | Public Class LU
7 | ''' Pivot matrix
8 | Public Property P As DenseMatrix = Nothing
9 |
10 | ''' Lower matrix
11 | Public Property L As DenseMatrix = Nothing
12 |
13 | ''' Upper matrix
14 | Public Property U As DenseMatrix = Nothing
15 |
16 | ''' Determinant
17 | Public Property Det As Double = 0.0
18 |
19 | ''' pivto row info
20 | Public Property PivotRow As Integer() = Nothing
21 |
22 | '''
23 | ''' default constructtor
24 | '''
25 | Private Sub New()
26 | End Sub
27 |
28 | '''
29 | ''' Constructor
30 | '''
31 | '''
32 | '''
33 | '''
34 | '''
35 | Public Sub New(ByRef matP As DenseMatrix, ByRef matL As DenseMatrix, ByRef matU As DenseMatrix, ByVal det As Double)
36 | Me.P = matP
37 | Me.L = matL
38 | Me.U = matU
39 | Me.Det = det
40 | End Sub
41 |
42 | '''
43 | ''' Constructor
44 | '''
45 | '''
46 | '''
47 | '''
48 | '''
49 | Public Sub New(ByRef matP As DenseMatrix, ByRef matL As DenseMatrix, ByRef matU As DenseMatrix, ByVal det As Double, ByRef p() As Integer)
50 | Me.P = matP
51 | Me.L = matL
52 | Me.U = matU
53 | Me.Det = det
54 | Me.PivotRow = p
55 | End Sub
56 |
57 | '''
58 | ''' solve(Ax=b)
59 | '''
60 | '''
61 | '''
62 | Public Function Solve(ByRef b As DenseVector) As DenseVector
63 | Return Me.Solve(Me.P, Me.L, Me.U, Me.PivotRow, b)
64 | End Function
65 |
66 | '''
67 | ''' solve(Ax=b)
68 | '''
69 | ''' pivot matrix(LU decomposition of A matrix)
70 | ''' lower triangle matrix(LU decomposition of A matrix)
71 | ''' upper triangle matrix(LU decomposition of A matrix)
72 | '''
73 | '''
74 | ''' x
75 | Private Function Solve(ByRef matP As DenseMatrix,
76 | ByRef matL As DenseMatrix,
77 | ByRef matU As DenseMatrix,
78 | ByRef pivotRow() As Integer,
79 | ByRef vecB As DenseVector) As DenseVector
80 | Dim n = matP.ColCount
81 | Dim x = New DenseVector(n)
82 | Dim y = New DenseVector(n)
83 |
84 | 'transopose
85 | 'Dim b = vecB * matP
86 |
87 | For i = 0 To n - 1
88 | Dim s = 0.0
89 | Dim j As Integer = 0
90 | For j = 0 To i - 1
91 | s += matL(i)(j) * y(j)
92 | Next
93 |
94 | 'y(j) = b(i) - s
95 | y(j) = vecB(pivotRow(i)) - s
96 | Next
97 |
98 | For i = n - 1 To 0 Step -1
99 | Dim s = 0.0
100 | For k = i + 1 To n - 1
101 | s += matU(i)(k) * x(k)
102 | Next
103 | x(i) = (y(i) - s) / matU(i)(i)
104 | Next
105 |
106 | Return x
107 | End Function
108 | End Class
109 | End Namespace
110 |
--------------------------------------------------------------------------------
/LibOptimization/MathTool/MathException.vb:
--------------------------------------------------------------------------------
1 | Namespace MathTool
2 | '''
3 | ''' Exception class for SimpleLinearAlgebra lib
4 | '''
5 | Public Class MathException : Inherits Exception
6 | '''
7 | ''' Error series
8 | '''
9 | Public Enum ErrorSeries
10 | UnknownError
11 | NotImplementaion
12 | NotSquare
13 | DifferRowNumberAndCollumnNumber
14 | NotComputable
15 | DifferElementNumber
16 | End Enum
17 |
18 | '''
19 | ''' Default constructor
20 | '''
21 | '''
22 | Private Sub New()
23 | 'nop
24 | End Sub
25 |
26 | '''
27 | ''' Constructor
28 | '''
29 | ''' error series
30 | '''
31 | Public Sub New(ByVal ai_series As ErrorSeries)
32 | MyBase.New(String.Format("ErrorCode:{0}", ai_series))
33 | End Sub
34 |
35 | '''
36 | ''' Constructor
37 | '''
38 | ''' error series
39 | ''' message
40 | '''
41 | Public Sub New(ByVal ai_series As ErrorSeries, ByVal ai_msg As String)
42 | MyBase.New(String.Format("ErrorCode:{0}\nErrorMsg:{1}", ai_series, ai_msg))
43 | End Sub
44 | End Class
45 | End Namespace
46 |
--------------------------------------------------------------------------------
/LibOptimization/MathTool/RNG/RandomUtil.vb:
--------------------------------------------------------------------------------
1 | Namespace MathTool.RNG
2 | '''
3 | ''' Random number generator utility class
4 | '''
5 | Public Class RandomUtil
6 |
7 | '''
8 | ''' Normal Distribution
9 | '''
10 | ''' Average
11 | ''' Varianse s^2
12 | '''
13 | '''
14 | ''' using Box-Muller method
15 | '''
16 | Public Shared Function NormRand(Optional ByVal ai_ave As Double = 0,
17 | Optional ByVal ai_sigma2 As Double = 1) As Double
18 | Dim x As Double = RandomXorshiftSingleton.GetInstance().NextDouble()
19 | Dim y As Double = RandomXorshiftSingleton.GetInstance().NextDouble()
20 |
21 | Dim c As Double = Math.Sqrt(-2.0 * Math.Log(x))
22 | If (0.5 - RandomXorshiftSingleton.GetInstance().NextDouble() > 0.0) Then
23 | Return c * Math.Sin(2.0 * Math.PI * y) * ai_sigma2 + ai_ave
24 | Else
25 | Return c * Math.Cos(2.0 * Math.PI * y) * ai_sigma2 + ai_ave
26 | End If
27 | End Function
28 |
29 | '''
30 | ''' Normal Distribution using Box-Muller method
31 | '''
32 | '''
33 | ''' ai_ave
34 | ''' Varianse s^2
35 | '''
36 | Public Shared Function NormRand(ByVal oRand As System.Random,
37 | Optional ByVal ai_ave As Double = 0,
38 | Optional ByVal ai_sigma2 As Double = 1) As Double
39 | Dim x As Double = oRand.NextDouble()
40 | Dim y As Double = oRand.NextDouble()
41 |
42 | Dim c As Double = Math.Sqrt(-2.0 * Math.Log(x))
43 | If (0.5 - RandomXorshiftSingleton.GetInstance().NextDouble() > 0.0) Then
44 | Return c * Math.Sin(2.0 * Math.PI * y) * ai_sigma2 + ai_ave
45 | Else
46 | Return c * Math.Cos(2.0 * Math.PI * y) * ai_sigma2 + ai_ave
47 | End If
48 | End Function
49 |
50 | '''
51 | ''' Cauchy Distribution
52 | '''
53 | ''' default:0
54 | ''' default:1
55 | '''
56 | '''
57 | ''' http://www.sat.t.u-tokyo.ac.jp/~omi/random_variables_generation.html#Cauchy
58 | '''
59 | Public Shared Function CauchyRand(Optional ByVal ai_mu As Double = 0, Optional ByVal ai_gamma As Double = 1) As Double
60 | Return ai_mu + ai_gamma * Math.Tan(Math.PI * (RandomXorshiftSingleton.GetInstance().NextDouble() - 0.5))
61 | End Function
62 | End Class
63 | End Namespace
64 |
--------------------------------------------------------------------------------
/LibOptimization/MathTool/RNG/RandomXorshiftSingleton.vb:
--------------------------------------------------------------------------------
1 | Namespace MathTool.RNG
2 | '''
3 | ''' Xorshift random algorithm singleton
4 | '''
5 | '''
6 | '''
7 |
8 | Public Class RandomXorshiftSingleton
9 | Private Shared m_rand As New RandomXorshift()
10 |
11 | #Region "Constructor"
12 | '''
13 | ''' Default constructor
14 | '''
15 | '''
16 | Private Sub New()
17 | 'nop
18 | End Sub
19 | #End Region
20 |
21 | #Region "Public"
22 | '''
23 | ''' Instance
24 | '''
25 | '''
26 | '''
27 | Public Shared Function GetInstance() As RandomXorshift
28 | Return m_rand
29 | End Function
30 | #End Region
31 | End Class
32 | End Namespace
33 |
--------------------------------------------------------------------------------
/LibOptimization/MathTool/SVD.vb:
--------------------------------------------------------------------------------
1 | Namespace MathTool
2 | '''
3 | ''' store SVD decomposition
4 | '''
5 |
6 | Public Class SVD
7 | '''
8 | Public Property S As DenseMatrix = Nothing
9 |
10 | '''
11 | Public Property V As DenseVector = Nothing
12 |
13 | '''
14 | Public Property D As DenseMatrix = Nothing
15 |
16 | Private Sub New()
17 | Throw New NotImplementedException
18 | End Sub
19 |
20 | Public Sub New(ByRef matS As DenseMatrix, ByRef matV As DenseVector, ByRef matD As DenseMatrix)
21 | Throw New NotImplementedException
22 |
23 | Me.S = matS
24 | Me.V = matV
25 | Me.D = matD
26 | End Sub
27 | End Class
28 | End Namespace
29 |
--------------------------------------------------------------------------------
/LibOptimization/My Project/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "profiles": {
3 | "LibOptimization": {
4 | "commandName": "Project",
5 | "nativeDebugging": true
6 | }
7 | }
8 | }
--------------------------------------------------------------------------------
/LibOptimization/Optimization/Dto/clsParticle.vb:
--------------------------------------------------------------------------------
1 | Imports LibOptimization.Util
2 | Imports LibOptimization.MathTool
3 |
4 | Namespace Optimization
5 | '''
6 | ''' Particle class for PSO
7 | '''
8 | '''
9 | ''' for Swarm Particle Optimization
10 | '''
11 |
12 | Public Class clsParticle : Implements IComparable
13 | Private m_point As clsPoint
14 | Private m_bestPoint As clsPoint
15 | Private m_velocity As DenseVector
16 |
17 | '''
18 | ''' Default construtor
19 | '''
20 | '''
21 | Private Sub New()
22 | 'nop
23 | End Sub
24 |
25 | '''
26 | ''' Constructor
27 | '''
28 | '''
29 | '''
30 | '''
31 | '''
32 | Public Sub New(ByVal ai_point As clsPoint, ByVal ai_velocity As DenseVector, ByVal ai_bestPoint As clsPoint)
33 | Me.m_point = ai_point
34 | Me.m_velocity = ai_velocity
35 | Me.m_bestPoint = ai_bestPoint
36 | End Sub
37 |
38 | '''
39 | ''' Copy Constructor
40 | '''
41 | '''
42 | '''
43 | Sub New(ByVal ai_particle As clsParticle)
44 | Me.m_point = ai_particle.Point.Copy()
45 | Me.m_velocity = ai_particle.Velocity()
46 | Me.m_bestPoint = ai_particle.BestPoint.Copy()
47 | End Sub
48 |
49 | '''
50 | ''' Point
51 | '''
52 | '''
53 | '''
54 | '''
55 | Public Property Point() As clsPoint
56 | Get
57 | Return Me.m_point
58 | End Get
59 | Set(value As clsPoint)
60 | Me.m_point = value
61 | End Set
62 | End Property
63 |
64 | '''
65 | ''' Velocity
66 | '''
67 | '''
68 | '''
69 | '''
70 | Public Property Velocity As DenseVector
71 | Get
72 | Return Me.m_velocity
73 | End Get
74 | Set(value As DenseVector)
75 | Me.m_velocity = value
76 | End Set
77 | End Property
78 |
79 | '''
80 | ''' BestPoint
81 | '''
82 | '''
83 | '''
84 | '''
85 | Public Property BestPoint As clsPoint
86 | Get
87 | Return Me.m_bestPoint
88 | End Get
89 | Set(value As clsPoint)
90 | Me.m_bestPoint = value
91 | End Set
92 | End Property
93 |
94 | '''
95 | ''' Compare points and best points from eval
96 | '''
97 | '''
98 | Public Function GetBestEval() As Double
99 | If Me.m_bestPoint.Eval < Me.m_point.Eval Then
100 | Return Me.m_bestPoint.Eval
101 | Else
102 | Return Me.m_point.Eval
103 | End If
104 | End Function
105 |
106 | '''
107 | ''' for sort
108 | '''
109 | '''
110 | '''
111 | '''
112 | Public Function CompareTo(ByVal ai_obj As Object) As Integer Implements IComparable.CompareTo
113 | 'Nothing check
114 | If ai_obj Is Nothing Then
115 | Return 1
116 | End If
117 |
118 | 'Type check
119 | If Not Me.GetType() Is ai_obj.GetType() Then
120 | Throw New ArgumentException("Different type", "obj")
121 | End If
122 |
123 | 'Compare
124 | Dim mineValue As Double = Me.m_bestPoint.Eval
125 | Dim compareValue As Double = DirectCast(ai_obj, clsParticle).BestPoint.Eval
126 | If mineValue < compareValue Then
127 | Return -1
128 | ElseIf mineValue > compareValue Then
129 | Return 1
130 | Else
131 | Return 0
132 | End If
133 | End Function
134 | End Class
135 | End Namespace
136 |
--------------------------------------------------------------------------------
/LibOptimization/Util/clsError.vb:
--------------------------------------------------------------------------------
1 | Namespace Util
2 | '''
3 | ''' ErrorManage class
4 | '''
5 | '''
6 | '''
7 |
8 | Public Class clsError
9 | Private m_errList As New List(Of clsErrorInfomation)
10 |
11 | Enum ErrorType
12 | NO_ERR
13 | ERR_INIT
14 | 'ERR_OPT_MAXITERATION
15 | ERR_UNKNOWN
16 | End Enum
17 |
18 | #Region "Error Infomation class"
19 | '''
20 | ''' Error infomation class
21 | '''
22 | '''
23 |
24 | Public Class clsErrorInfomation
25 | '''
26 | ''' Default constructor(do not use)
27 | '''
28 | '''
29 | Private Sub New()
30 | 'nop
31 | End Sub
32 |
33 | '''
34 | ''' Constructor
35 | '''
36 | '''
37 | '''
38 | '''
39 | '''
40 | Public Sub New(ByVal ai_setError As Boolean, ByVal ai_errorType As ErrorType, ByVal ai_errorMsg As String)
41 | Me.ErrorFlg = ai_setError
42 | Me.ErrorType = ai_errorType
43 | Me.ErrorMsg = ai_errorMsg
44 | End Sub
45 |
46 | Public Property ErrorFlg As Boolean = False
47 | Public Property ErrorType As ErrorType = ErrorType.NO_ERR
48 | Public Property ErrorMsg As String = String.Empty
49 | End Class
50 | #End Region
51 |
52 | '''
53 | ''' Default constructor
54 | '''
55 | '''
56 | Public Sub New()
57 | End Sub
58 |
59 | '''
60 | ''' Set Error
61 | '''
62 | '''
63 | '''
64 | '''
65 | '''
66 | Public Sub SetError(ByVal ai_setError As Boolean, ByVal ai_errorType As ErrorType, Optional ByVal ai_errorMsg As String = "")
67 | Me.m_errList.Add(New clsErrorInfomation(ai_setError, ai_errorType, ai_errorMsg))
68 | End Sub
69 |
70 | '''
71 | ''' Is error
72 | '''
73 | '''
74 | '''
75 | Public Function IsError() As Boolean
76 | If Me.m_errList.Count = 0 Then
77 | Return False
78 | End If
79 | Dim index As Integer = Me.m_errList.Count
80 | Return Me.m_errList(index - 1).ErrorFlg
81 | End Function
82 |
83 | '''
84 | ''' Get Last error infomation
85 | '''
86 | '''
87 | '''
88 | Public Function GetLastErrorInfomation() As clsErrorInfomation
89 | If Me.m_errList.Count = 0 Then
90 | Return New clsErrorInfomation(False, ErrorType.NO_ERR, "")
91 | End If
92 | Dim index As Integer = Me.m_errList.Count
93 | Return Me.m_errList(index - 1)
94 | End Function
95 |
96 | '''
97 | ''' Clear error
98 | '''
99 | '''
100 | Public Sub Clear()
101 | Me.m_errList.Clear()
102 | End Sub
103 |
104 | '''
105 | ''' Error Output
106 | '''
107 | '''
108 | Public Shared Sub Print(ByVal ai_errInfomation As clsErrorInfomation)
109 | If ai_errInfomation.ErrorFlg = True Then
110 | Console.WriteLine("IsError :True")
111 | Else
112 | Console.WriteLine("IsError :False")
113 | End If
114 | Console.WriteLine("ErrorType :" & ai_errInfomation.ErrorType)
115 | Console.WriteLine("ErrorMessage:" & ai_errInfomation.ErrorMsg)
116 | End Sub
117 | End Class
118 | End Namespace
119 |
--------------------------------------------------------------------------------
/LibOptimization/Util/clsEval.vb:
--------------------------------------------------------------------------------
1 | Namespace Optimization
2 | '''
3 | ''' Eval
4 | '''
5 | '''
6 | Public Class clsEval
7 | Implements IComparable
8 | Private m_index As Integer = 0
9 | Private m_eval As Double = 0
10 |
11 | '''
12 | ''' Constructor
13 | '''
14 | '''
15 | '''
16 | '''
17 | Public Sub New(ByVal ai_index As Integer, ByVal ai_eval As Double)
18 | Me.m_index = ai_index
19 | Me.m_eval = ai_eval
20 | End Sub
21 |
22 | '''
23 | ''' Eval
24 | '''
25 | '''
26 | '''
27 | '''
28 | Public Sub SetEval(ByVal ai_index As Integer, ByVal ai_eval As Double)
29 | Me.m_index = ai_index
30 | Me.m_eval = ai_eval
31 | End Sub
32 |
33 | '''
34 | ''' get evaluate value
35 | '''
36 | '''
37 | '''
38 | '''
39 | Public ReadOnly Property Eval() As Double
40 | Get
41 | Return Me.m_eval
42 | End Get
43 | End Property
44 |
45 | '''
46 | ''' get index
47 | '''
48 | '''
49 | '''
50 | '''
51 | Public ReadOnly Property Index() As Integer
52 | Get
53 | Return Me.m_index
54 | End Get
55 | End Property
56 |
57 | '''
58 | ''' Compare(ICompareble)
59 | '''
60 | '''
61 | '''
62 | '''
63 | ''' larger Me than obj is -1. smaller Me than obj is 1.
64 | ''' Equal is return to Zero
65 | '''
66 | Public Function CompareTo(ByVal ai_obj As Object) As Integer Implements System.IComparable.CompareTo
67 | 'Nothing check
68 | If ai_obj Is Nothing Then
69 | Return 1
70 | End If
71 |
72 | 'Type check
73 | If Not Me.GetType() Is ai_obj.GetType() Then
74 | Throw New ArgumentException("Different type", "obj")
75 | End If
76 |
77 | 'Compare
78 | Dim mineValue As Double = Me.m_eval
79 | Dim compareValue As Double = DirectCast(ai_obj, clsEval).Eval
80 | If mineValue = compareValue Then
81 | Return 0
82 | ElseIf mineValue < compareValue Then
83 | Return -1
84 | Else
85 | Return 1
86 | End If
87 | End Function
88 | End Class
89 | End Namespace
--------------------------------------------------------------------------------
/LibOptimization/abstract/absObjectiveFunction.vb:
--------------------------------------------------------------------------------
1 | Namespace Optimization
2 | '''
3 | ''' Abstarct objective function class
4 | '''
5 | '''
6 |
7 | Public MustInherit Class absObjectiveFunction
8 | '''
9 | ''' Get number of variables
10 | '''
11 | '''
12 | '''
13 | Public MustOverride Function NumberOfVariable() As Integer
14 |
15 | '''
16 | ''' Evaluate
17 | '''
18 | '''
19 | '''
20 | Public MustOverride Function F(ByVal x As List(Of Double)) As Double
21 |
22 | '''
23 | ''' Gradient vector (for Steepest descent method, newton method)
24 | '''
25 | '''
26 | ''' step default 1e-6
27 | '''
28 | '''
29 | ''' ex)
30 | ''' f(x1,..,xn) = x1^2 + ... + xn^2
31 | ''' del f = [df/dx1 , ... , df/dxn]
32 | '''
33 | Public Overridable Function Gradient(ByVal x As List(Of Double),
34 | Optional ByVal h As Double = 0.000001) As List(Of Double)
35 | Return MathTool.MathUtil.CalcNumericGradient(Me, x, h)
36 | End Function
37 |
38 | '''
39 | ''' Hessian matrix (for newton method)
40 | '''
41 | '''
42 | ''' step default 1e-6
43 | '''
44 | '''
45 | ''' ex)
46 | ''' f(x1,x2) = x1^2 + x2^2
47 | ''' del f = [df/dx1 df/dx2]
48 | ''' del^2 f = [d^2f/d^2x1 d^2f/dx1dx2]
49 | ''' [d^2f/d^2dx2dx1 d^2f/d^2x2]
50 | '''
51 | Public Overridable Function Hessian(ByVal x As List(Of Double),
52 | Optional ByVal h As Double = 0.000001) As List(Of List(Of Double))
53 | Return MathTool.MathUtil.CalcNumericHessian(Me, x, h)
54 | End Function
55 | End Class
56 | End Namespace
--------------------------------------------------------------------------------
/LibOptimization/abstract/absOptimization.vb:
--------------------------------------------------------------------------------
1 | Imports LibOptimization.MathTool.RNG
2 | Imports LibOptimization.Util
3 |
4 | Namespace Optimization
5 | '''
6 | ''' Abstarct optimization Class
7 | '''
8 | '''
9 |
10 | Public MustInherit Class absOptimization
11 | ''' Objective function
12 | Protected m_func As absObjectiveFunction = Nothing
13 |
14 | ''' Iteration count
15 | Protected m_iteration As Integer = 0
16 |
17 | ''' Random object
18 | Protected m_rand As System.Random = New RandomXorshift(BitConverter.ToUInt32(BitConverter.GetBytes(Environment.TickCount), 0))
19 |
20 | ''' Error manage class
21 | Protected m_error As New clsError
22 |
23 | ''' Initial position
24 | Public Property InitialPosition As Double() = Nothing
25 |
26 | ''' Upper range of initial value
27 | ''' This parameters to use when generate a variable
28 | Public Property InitialValueRangeUpper As Double = 5 'parameter range
29 |
30 | ''' Lower range of initial value
31 | ''' This parameters to use when generate a variable
32 | Public Property InitialValueRangeLower As Double = -5 'parameter range
33 |
34 | ''' Use criterion
35 | Public Property IsUseCriterion As Boolean = True
36 |
37 | ''' Memo
38 | Public Property Memo As String = String.Empty
39 |
40 | '''
41 | ''' Objective function Property
42 | '''
43 | '''
44 | '''
45 | '''
46 | Public Property ObjectiveFunction As absObjectiveFunction
47 | Get
48 | Return Me.m_func
49 | End Get
50 | Set(ByVal value As absObjectiveFunction)
51 | Me.m_func = value
52 | End Set
53 | End Property
54 |
55 | '''
56 | ''' Random object Property
57 | '''
58 | '''
59 | '''
60 | '''
61 | Public Property Random As System.Random
62 | Get
63 | Return Me.m_rand
64 | End Get
65 | Set(ByVal value As System.Random)
66 | Me.m_rand = value
67 | End Set
68 | End Property
69 |
70 | '''
71 | ''' Initialize parameter
72 | '''
73 | '''
74 | Public MustOverride Sub Init()
75 |
76 | '''
77 | ''' Do Iteration
78 | '''
79 | ''' Iteration count. When you set zero, use the default value.
80 | ''' true:Stopping Criterion. false:Do not Stopping Criterion
81 | '''
82 | Public MustOverride Function DoIteration(Optional ByVal ai_iteration As Integer = 0) As Boolean
83 |
84 | '''
85 | ''' Result
86 | '''
87 | '''
88 | '''
89 | Public MustOverride ReadOnly Property Result() As clsPoint
90 |
91 | '''
92 | ''' Results
93 | '''
94 | '''
95 | '''
96 | ''' Get all result.
97 | ''' Do not need to implement this method.
98 | ''' e.g)Throw New NotImplementedException
99 | '''
100 | Public MustOverride ReadOnly Property Results() As List(Of clsPoint)
101 |
102 | '''
103 | ''' Recent Error
104 | '''
105 | '''
106 | '''
107 | Public Overridable Function IsRecentError() As Boolean
108 | Return Me.m_error.IsError()
109 | End Function
110 |
111 | '''
112 | ''' Get recent Error
113 | '''
114 | '''
115 | '''
116 | Public Overridable Function GetRecentErrors() As clsError
117 | Return Me.m_error
118 | End Function
119 |
120 | '''
121 | ''' Get recent Error
122 | '''
123 | '''
124 | '''
125 | Public Overridable Function GetRecentError() As clsError.clsErrorInfomation
126 | Return Me.m_error.GetLastErrorInfomation()
127 | End Function
128 |
129 | '''
130 | ''' Max Iteration
131 | '''
132 | '''
133 | Public MustOverride Property Iteration As Integer
134 |
135 | '''
136 | ''' Iteration count
137 | '''
138 | '''
139 | '''
140 | Public ReadOnly Property IterationCount() As Integer
141 | Get
142 | Return Me.m_iteration
143 | End Get
144 | End Property
145 |
146 | '''
147 | ''' Reset Iteration count
148 | '''
149 | '''
150 | Public Sub ResetIterationCount()
151 | Me.m_iteration = 0
152 | End Sub
153 | End Class
154 |
155 | End Namespace
156 |
--------------------------------------------------------------------------------
/LibOptimization/logo_liboptimization.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tomitomi3/LibOptimization/323fb6144be973ddd9e1ec494113f49d035c6711/LibOptimization/logo_liboptimization.png
--------------------------------------------------------------------------------
/LibOptimizationDotNet3.0/My Project/Application.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' このコードはツールによって生成されました。
4 | ' ランタイム バージョン:4.0.30319.34209
5 | '
6 | ' このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
7 | ' コードが再生成されるときに損失したりします。
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
--------------------------------------------------------------------------------
/LibOptimizationDotNet3.0/My Project/Application.myapp:
--------------------------------------------------------------------------------
1 |
2 |
3 | false
4 | false
5 | 0
6 | true
7 | 0
8 | 1
9 | true
10 |
11 |
--------------------------------------------------------------------------------
/LibOptimizationDotNet3.0/My Project/AssemblyInfo.vb:
--------------------------------------------------------------------------------
1 | Imports System
2 | Imports System.Reflection
3 | Imports System.Runtime.InteropServices
4 |
5 | ' アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
6 | ' アセンブリに関連付けられている情報を変更するには、
7 | ' これらの属性値を変更してください。
8 |
9 | ' アセンブリ属性の値を確認します。
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | 'このプロジェクトが COM に公開される場合、次の GUID がタイプ ライブラリの ID になります。
21 |
22 |
23 | ' アセンブリのバージョン情報は、以下の 4 つの値で構成されています:
24 | '
25 | ' Major Version
26 | ' Minor Version
27 | ' Build Number
28 | ' Revision
29 | '
30 | ' すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
31 | ' 既定値にすることができます:
32 | '
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/LibOptimizationDotNet3.0/My Project/Resources.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' このコードはツールによって生成されました。
4 | ' ランタイム バージョン:4.0.30319.34209
5 | '
6 | ' このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
7 | ' コードが再生成されるときに損失したりします。
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 | Imports System
15 |
16 | Namespace My.Resources
17 |
18 | 'このクラスは StronglyTypedResourceBuilder クラスが ResGen
19 | 'または Visual Studio のようなツールを使用して自動生成されました。
20 | 'メンバーを追加または削除するには、.ResX ファイルを編集して、/str オプションと共に
21 | 'ResGen を実行し直すか、または VS プロジェクトをビルドし直します。
22 | '''
23 | ''' ローカライズされた文字列などを検索するための、厳密に型指定されたリソース クラスです。
24 | '''
25 | _
29 | Friend Module Resources
30 |
31 | Private resourceMan As Global.System.Resources.ResourceManager
32 |
33 | Private resourceCulture As Global.System.Globalization.CultureInfo
34 |
35 | '''
36 | ''' このクラスで使用されているキャッシュされた ResourceManager インスタンスを返します。
37 | '''
38 | _
39 | Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
40 | Get
41 | If Object.ReferenceEquals(resourceMan, Nothing) Then
42 | Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("LibOptimization.Resources", GetType(Resources).Assembly)
43 | resourceMan = temp
44 | End If
45 | Return resourceMan
46 | End Get
47 | End Property
48 |
49 | '''
50 | ''' 厳密に型指定されたこのリソース クラスを使用して、すべての検索リソースに対し、
51 | ''' 現在のスレッドの CurrentUICulture プロパティをオーバーライドします。
52 | '''
53 | _
54 | Friend Property Culture() As Global.System.Globalization.CultureInfo
55 | Get
56 | Return resourceCulture
57 | End Get
58 | Set
59 | resourceCulture = value
60 | End Set
61 | End Property
62 | End Module
63 | End Namespace
64 |
--------------------------------------------------------------------------------
/LibOptimizationDotNet3.0/My Project/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/LibOptimizationDotNet3.0/My Project/Settings.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' このコードはツールによって生成されました。
4 | ' ランタイム バージョン:4.0.30319.34209
5 | '
6 | ' このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
7 | ' コードが再生成されるときに損失したりします。
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | _
20 | Partial Friend NotInheritable Class MySettings
21 | Inherits Global.System.Configuration.ApplicationSettingsBase
22 |
23 | Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
24 |
25 | #Region "My.Settings 自動保存機能"
26 | #If _MyType = "WindowsForms" Then
27 | Private Shared addedHandler As Boolean
28 |
29 | Private Shared addedHandlerLockObject As New Object
30 |
31 | _
32 | Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
33 | If My.Application.SaveMySettingsOnExit Then
34 | My.Settings.Save()
35 | End If
36 | End Sub
37 | #End If
38 | #End Region
39 |
40 | Public Shared ReadOnly Property [Default]() As MySettings
41 | Get
42 |
43 | #If _MyType = "WindowsForms" Then
44 | If Not addedHandler Then
45 | SyncLock addedHandlerLockObject
46 | If Not addedHandler Then
47 | AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
48 | addedHandler = True
49 | End If
50 | End SyncLock
51 | End If
52 | #End If
53 | Return defaultInstance
54 | End Get
55 | End Property
56 | End Class
57 | End Namespace
58 |
59 | Namespace My
60 |
61 | _
64 | Friend Module MySettingsProperty
65 |
66 | _
67 | Friend ReadOnly Property Settings() As Global.LibOptimization.My.MySettings
68 | Get
69 | Return Global.LibOptimization.My.MySettings.Default
70 | End Get
71 | End Property
72 | End Module
73 | End Namespace
74 |
--------------------------------------------------------------------------------
/LibOptimizationDotNet3.0/My Project/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/LibOptimizationDotNet3.5/My Project/Application.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' このコードはツールによって生成されました。
4 | ' ランタイム バージョン:4.0.30319.34209
5 | '
6 | ' このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
7 | ' コードが再生成されるときに損失したりします。
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
--------------------------------------------------------------------------------
/LibOptimizationDotNet3.5/My Project/Application.myapp:
--------------------------------------------------------------------------------
1 |
2 |
3 | false
4 | false
5 | 0
6 | true
7 | 0
8 | 1
9 | true
10 |
11 |
--------------------------------------------------------------------------------
/LibOptimizationDotNet3.5/My Project/AssemblyInfo.vb:
--------------------------------------------------------------------------------
1 | Imports System
2 | Imports System.Reflection
3 | Imports System.Runtime.InteropServices
4 |
5 | ' アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
6 | ' アセンブリに関連付けられている情報を変更するには、
7 | ' これらの属性値を変更してください。
8 |
9 | ' アセンブリ属性の値を確認します。
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | 'このプロジェクトが COM に公開される場合、次の GUID がタイプ ライブラリの ID になります。
21 |
22 |
23 | ' アセンブリのバージョン情報は、以下の 4 つの値で構成されています:
24 | '
25 | ' Major Version
26 | ' Minor Version
27 | ' Build Number
28 | ' Revision
29 | '
30 | ' すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
31 | ' 既定値にすることができます:
32 | '
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/LibOptimizationDotNet3.5/My Project/Resources.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' このコードはツールによって生成されました。
4 | ' ランタイム バージョン:4.0.30319.34209
5 | '
6 | ' このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
7 | ' コードが再生成されるときに損失したりします。
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 | Imports System
15 |
16 | Namespace My.Resources
17 |
18 | 'このクラスは StronglyTypedResourceBuilder クラスが ResGen
19 | 'または Visual Studio のようなツールを使用して自動生成されました。
20 | 'メンバーを追加または削除するには、.ResX ファイルを編集して、/str オプションと共に
21 | 'ResGen を実行し直すか、または VS プロジェクトをビルドし直します。
22 | '''
23 | ''' ローカライズされた文字列などを検索するための、厳密に型指定されたリソース クラスです。
24 | '''
25 | _
29 | Friend Module Resources
30 |
31 | Private resourceMan As Global.System.Resources.ResourceManager
32 |
33 | Private resourceCulture As Global.System.Globalization.CultureInfo
34 |
35 | '''
36 | ''' このクラスで使用されているキャッシュされた ResourceManager インスタンスを返します。
37 | '''
38 | _
39 | Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
40 | Get
41 | If Object.ReferenceEquals(resourceMan, Nothing) Then
42 | Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("LibOptimization.Resources", GetType(Resources).Assembly)
43 | resourceMan = temp
44 | End If
45 | Return resourceMan
46 | End Get
47 | End Property
48 |
49 | '''
50 | ''' 厳密に型指定されたこのリソース クラスを使用して、すべての検索リソースに対し、
51 | ''' 現在のスレッドの CurrentUICulture プロパティをオーバーライドします。
52 | '''
53 | _
54 | Friend Property Culture() As Global.System.Globalization.CultureInfo
55 | Get
56 | Return resourceCulture
57 | End Get
58 | Set
59 | resourceCulture = value
60 | End Set
61 | End Property
62 | End Module
63 | End Namespace
64 |
--------------------------------------------------------------------------------
/LibOptimizationDotNet3.5/My Project/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/LibOptimizationDotNet3.5/My Project/Settings.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' このコードはツールによって生成されました。
4 | ' ランタイム バージョン:4.0.30319.34209
5 | '
6 | ' このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
7 | ' コードが再生成されるときに損失したりします。
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | _
20 | Partial Friend NotInheritable Class MySettings
21 | Inherits Global.System.Configuration.ApplicationSettingsBase
22 |
23 | Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
24 |
25 | #Region "My.Settings 自動保存機能"
26 | #If _MyType = "WindowsForms" Then
27 | Private Shared addedHandler As Boolean
28 |
29 | Private Shared addedHandlerLockObject As New Object
30 |
31 | _
32 | Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
33 | If My.Application.SaveMySettingsOnExit Then
34 | My.Settings.Save()
35 | End If
36 | End Sub
37 | #End If
38 | #End Region
39 |
40 | Public Shared ReadOnly Property [Default]() As MySettings
41 | Get
42 |
43 | #If _MyType = "WindowsForms" Then
44 | If Not addedHandler Then
45 | SyncLock addedHandlerLockObject
46 | If Not addedHandler Then
47 | AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
48 | addedHandler = True
49 | End If
50 | End SyncLock
51 | End If
52 | #End If
53 | Return defaultInstance
54 | End Get
55 | End Property
56 | End Class
57 | End Namespace
58 |
59 | Namespace My
60 |
61 | _
64 | Friend Module MySettingsProperty
65 |
66 | _
67 | Friend ReadOnly Property Settings() As Global.LibOptimization.My.MySettings
68 | Get
69 | Return Global.LibOptimization.My.MySettings.Default
70 | End Get
71 | End Property
72 | End Module
73 | End Namespace
74 |
--------------------------------------------------------------------------------
/LibOptimizationDotNet3.5/My Project/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/LibOptimizationDotNet4.6/My Project/Application.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' このコードはツールによって生成されました。
4 | ' ランタイム バージョン:4.0.30319.42000
5 | '
6 | ' このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
7 | ' コードが再生成されるときに損失したりします。
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
--------------------------------------------------------------------------------
/LibOptimizationDotNet4.6/My Project/Application.myapp:
--------------------------------------------------------------------------------
1 |
2 |
3 | false
4 | false
5 | 0
6 | true
7 | 0
8 | 1
9 | true
10 |
11 |
--------------------------------------------------------------------------------
/LibOptimizationDotNet4.6/My Project/AssemblyInfo.vb:
--------------------------------------------------------------------------------
1 | Imports System
2 | Imports System.Reflection
3 | Imports System.Runtime.InteropServices
4 |
5 | ' アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
6 | ' アセンブリに関連付けられている情報を変更するには、
7 | ' これらの属性値を変更してください。
8 |
9 | ' アセンブリ属性の値を確認します。
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | 'このプロジェクトが COM に公開される場合、次の GUID がタイプ ライブラリの ID になります。
21 |
22 |
23 | ' アセンブリのバージョン情報は、以下の 4 つの値で構成されています:
24 | '
25 | ' Major Version
26 | ' Minor Version
27 | ' Build Number
28 | ' Revision
29 | '
30 | ' すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
31 | ' 既定値にすることができます:
32 | '
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/LibOptimizationDotNet4.6/My Project/Resources.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' このコードはツールによって生成されました。
4 | ' ランタイム バージョン:4.0.30319.42000
5 | '
6 | ' このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
7 | ' コードが再生成されるときに損失したりします。
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 | Imports System
15 |
16 | Namespace My.Resources
17 |
18 | 'このクラスは StronglyTypedResourceBuilder クラスが ResGen
19 | 'または Visual Studio のようなツールを使用して自動生成されました。
20 | 'メンバーを追加または削除するには、.ResX ファイルを編集して、/str オプションと共に
21 | 'ResGen を実行し直すか、または VS プロジェクトをビルドし直します。
22 | '''
23 | ''' ローカライズされた文字列などを検索するための、厳密に型指定されたリソース クラスです。
24 | '''
25 | _
29 | Friend Module Resources
30 |
31 | Private resourceMan As Global.System.Resources.ResourceManager
32 |
33 | Private resourceCulture As Global.System.Globalization.CultureInfo
34 |
35 | '''
36 | ''' このクラスで使用されているキャッシュされた ResourceManager インスタンスを返します。
37 | '''
38 | _
39 | Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
40 | Get
41 | If Object.ReferenceEquals(resourceMan, Nothing) Then
42 | Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("LibOptimization.Resources", GetType(Resources).Assembly)
43 | resourceMan = temp
44 | End If
45 | Return resourceMan
46 | End Get
47 | End Property
48 |
49 | '''
50 | ''' 厳密に型指定されたこのリソース クラスを使用して、すべての検索リソースに対し、
51 | ''' 現在のスレッドの CurrentUICulture プロパティをオーバーライドします。
52 | '''
53 | _
54 | Friend Property Culture() As Global.System.Globalization.CultureInfo
55 | Get
56 | Return resourceCulture
57 | End Get
58 | Set
59 | resourceCulture = value
60 | End Set
61 | End Property
62 | End Module
63 | End Namespace
64 |
--------------------------------------------------------------------------------
/LibOptimizationDotNet4.6/My Project/Settings.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' このコードはツールによって生成されました。
4 | ' ランタイム バージョン:4.0.30319.42000
5 | '
6 | ' このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
7 | ' コードが再生成されるときに損失したりします。
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | _
20 | Partial Friend NotInheritable Class MySettings
21 | Inherits Global.System.Configuration.ApplicationSettingsBase
22 |
23 | Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
24 |
25 | #Region "My.Settings 自動保存機能"
26 | #If _MyType = "WindowsForms" Then
27 | Private Shared addedHandler As Boolean
28 |
29 | Private Shared addedHandlerLockObject As New Object
30 |
31 | _
32 | Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
33 | If My.Application.SaveMySettingsOnExit Then
34 | My.Settings.Save()
35 | End If
36 | End Sub
37 | #End If
38 | #End Region
39 |
40 | Public Shared ReadOnly Property [Default]() As MySettings
41 | Get
42 |
43 | #If _MyType = "WindowsForms" Then
44 | If Not addedHandler Then
45 | SyncLock addedHandlerLockObject
46 | If Not addedHandler Then
47 | AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
48 | addedHandler = True
49 | End If
50 | End SyncLock
51 | End If
52 | #End If
53 | Return defaultInstance
54 | End Get
55 | End Property
56 | End Class
57 | End Namespace
58 |
59 | Namespace My
60 |
61 | _
64 | Friend Module MySettingsProperty
65 |
66 | _
67 | Friend ReadOnly Property Settings() As Global.LibOptimization.My.MySettings
68 | Get
69 | Return Global.LibOptimization.My.MySettings.Default
70 | End Get
71 | End Property
72 | End Module
73 | End Namespace
74 |
--------------------------------------------------------------------------------
/LibOptimizationDotNet4.6/My Project/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ReleaseNote.md:
--------------------------------------------------------------------------------
1 |
2 | ---
3 |
4 | # Template Ver x.y.z
5 |
6 | ## description
7 |
8 | ## remarks
9 |
--------------------------------------------------------------------------------
/SampleCSharp/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
6 | // アセンブリに関連付けられている情報を変更するには、
7 | // これらの属性値を変更してください。
8 | [assembly: AssemblyTitle("SampleCSharp")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SampleCSharp")]
13 | [assembly: AssemblyCopyright("Copyright © 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから
18 | // 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、
19 | // その型の ComVisible 属性を true に設定してください。
20 | [assembly: ComVisible(false)]
21 |
22 | // 次の GUID は、このプロジェクトが COM に公開される場合の、typelib の ID です
23 | [assembly: Guid("2e7606f6-7c1a-4357-b031-eb56ad7b2726")]
24 |
25 | // アセンブリのバージョン情報は、以下の 4 つの値で構成されています:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
33 | // 既定値にすることができます:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/SampleCSharp/RosenBrock.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace SampleCSharp
7 | {
8 | ///
9 | /// for Rosen block function(Bench mark function)
10 | ///
11 | class RosenBrock : LibOptimization.Optimization.absObjectiveFunction
12 | {
13 | private int _dim = 0;
14 |
15 | ///
16 | /// Constructor
17 | ///
18 | ///
19 | public RosenBrock(int dim)
20 | {
21 | if(dim <=1)
22 | {
23 | throw new NotImplementedException();
24 | }
25 | this._dim = dim;
26 | }
27 |
28 | public override double F(List x)
29 | {
30 | double ret = 0.0;
31 | for(int i=0;i<_dim-1;i++)
32 | {
33 | var temp1 = x[i + 1] - x[i] * x[i];
34 | var temp2 = x[i] - 1;
35 | ret += 100 * temp1* temp1 + temp2*temp2;
36 | }
37 | return ret;
38 | }
39 |
40 | public override List Gradient(List aa, double h = 1E-08)
41 | {
42 | return null;
43 | }
44 |
45 | public override List> Hessian(List aa, double h = 1E-08)
46 | {
47 | return null;
48 | }
49 |
50 | public override int NumberOfVariable()
51 | {
52 | return this._dim;
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/SampleCSharp/SampleCSharp.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | x86
6 | 8.0.30703
7 | 2.0
8 | {666C2EF2-6772-499B-80F2-8B00A5FEA4BB}
9 | Exe
10 | Properties
11 | SampleCSharp
12 | SampleCSharp
13 | v4.8
14 |
15 |
16 | 512
17 |
18 |
19 | x86
20 | true
21 | full
22 | false
23 | bin\Debug\
24 | DEBUG;TRACE
25 | prompt
26 | 4
27 | false
28 |
29 |
30 | x86
31 | pdbonly
32 | true
33 | bin\Release\
34 | TRACE
35 | prompt
36 | 4
37 | false
38 |
39 |
40 | true
41 | bin\x64\Debug\
42 | DEBUG;TRACE
43 | full
44 | x64
45 | prompt
46 | MinimumRecommendedRules.ruleset
47 | false
48 |
49 |
50 | bin\x64\Release\
51 | TRACE
52 | true
53 | pdbonly
54 | x64
55 | prompt
56 | MinimumRecommendedRules.ruleset
57 | false
58 |
59 |
60 | true
61 | bin\Debug\
62 | DEBUG;TRACE
63 | full
64 | AnyCPU
65 | prompt
66 | MinimumRecommendedRules.ruleset
67 | false
68 |
69 |
70 | bin\Release\
71 | TRACE
72 | true
73 | pdbonly
74 | AnyCPU
75 | prompt
76 | MinimumRecommendedRules.ruleset
77 | false
78 |
79 |
80 | true
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 | {2c280eed-8de4-43bb-9466-000d65794e2d}
103 | LibOptimization
104 |
105 |
106 |
107 |
114 |
--------------------------------------------------------------------------------
/SampleCSharp/SimulatedAnnealingSample.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using LibOptimization.MathTool.RNG;
6 | using LibOptimization.Optimization;
7 | using LibOptimization.Util;
8 |
9 | namespace SampleCSharp
10 | {
11 | ///
12 | /// My Sphere function(inherit absObjectiveFunction)
13 | ///
14 | class MyObjecticeFunctionForSA : LibOptimization.Optimization.absObjectiveFunction
15 | {
16 | ///
17 | /// Constructor
18 | ///
19 | public MyObjecticeFunctionForSA()
20 | {
21 | }
22 |
23 | ///
24 | /// eval
25 | ///
26 | /// variable
27 | /// eval value
28 | public override double F(List x)
29 | {
30 | double ret = 0.0;
31 | for (int i = 0; i < this.NumberOfVariable(); i++)
32 | {
33 | //model(sphere)
34 | ret += x[i] * x[i];
35 | }
36 | return ret;
37 | }
38 |
39 | public override List Gradient(List aa, double h = 1E-08)
40 | {
41 | return null;
42 | }
43 |
44 | public override List> Hessian(List aa, double h = 1E-08)
45 | {
46 | return null;
47 | }
48 |
49 | public override int NumberOfVariable()
50 | {
51 | return 5;
52 | }
53 | }
54 |
55 | ///
56 | /// Neighbor function for SA
57 | ///
58 | class MyNeighborFunc : LibOptimization.Optimization.absNeighbor
59 | {
60 | public MyNeighborFunc()
61 | {
62 | }
63 |
64 | //random
65 | private Random _rng = new Random(DateTime.Now.Millisecond);
66 |
67 | //some parameters...
68 | public int Range = 2;
69 |
70 | ///
71 | /// My neighbor function
72 | ///
73 | ///
74 | ///
75 | public override clsPoint Neighbor(clsPoint p)
76 | {
77 | var retP = p.Copy();
78 | var n = p.GetFunc().NumberOfVariable();
79 |
80 | int i = 0;
81 | for (; i < n - 2; i++)
82 | {
83 | retP[i] = _rng.Next(-this.Range, this.Range); //discrete value
84 | }
85 |
86 | //all 0
87 | for (; i < n; i++)
88 | {
89 | retP[i] = 0;
90 | }
91 |
92 | return retP;
93 | }
94 | }
95 |
96 | ///
97 | /// using SA optimizer
98 | ///
99 | class SimulatedAnnealingSample
100 | {
101 | public SimulatedAnnealingSample()
102 | {
103 | //nop
104 | }
105 |
106 | public void Run()
107 | {
108 | var func = new MyObjecticeFunctionForSA();
109 | var opt = new clsOptSimulatedAnnealing(func);
110 |
111 | //initial position using random
112 | var rng = new RandomXorshift((UInt32)DateTime.Now.Millisecond);
113 | opt.InitialPosition = new double[] { rng.NextDouble(-2, 2), rng.NextDouble(-2, 2), rng.NextDouble(-2, 2), rng.NextDouble(-2, 2), rng.NextDouble(-2, 2) };
114 |
115 | //parameter for SA
116 | opt.Temperature = 1;
117 | opt.StopTemperature = 0.0001;
118 | opt.CoolingRatio = 0.9995;
119 | opt.IsUseCriterion = false;
120 | opt.Iteration = 50000;
121 |
122 | //neighbor function
123 | {
124 | //default neightbor function(default)
125 | //var myNeighborFunc = new LocalRandomSearch();
126 | //myNeighborFunc.NeighborRange = 0.0001;
127 | //opt.Neighbor = myNeighborFunc;
128 | }
129 | {
130 | //designed neightbor function
131 | var myNeighborFunc = new MyNeighborFunc();
132 | myNeighborFunc.Range = 1;
133 | opt.Neighbor = myNeighborFunc;
134 | }
135 | //init
136 | opt.Init();
137 | clsUtil.DebugValue(opt);
138 |
139 | //do optimization
140 | while (opt.DoIteration(2000) == false)
141 | {
142 | clsUtil.DebugValue(opt);
143 | }
144 | clsUtil.DebugValue(opt);
145 |
146 | // restart
147 | opt.InitialPosition = opt.Result.ToArray();
148 | clsUtil.DebugValue(opt);
149 |
150 | //do optimization
151 | while (opt.DoIteration(2000) == false)
152 | {
153 | clsUtil.DebugValue(opt);
154 | }
155 | clsUtil.DebugValue(opt);
156 | }
157 |
158 | }
159 | }
160 |
--------------------------------------------------------------------------------
/SampleCSharp/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/SampleVB/LeastSquaresMethod.vb:
--------------------------------------------------------------------------------
1 | Imports LibOptimization
2 |
3 | '''
4 | ''' 最小二乗法(最小自乗法)Least Squares Method
5 | '''
6 | '''
7 | Public Class LeastSquaresMethod : Inherits Optimization.absObjectiveFunction
8 | ''' Data
9 | Private datas As New List(Of List(Of Double))
10 |
11 | '''
12 | ''' Default constructor
13 | '''
14 | '''
15 | Public Sub New()
16 | 'nop
17 | End Sub
18 |
19 | '''
20 | ''' 初期化
21 | '''
22 | '''
23 | Public Function Init() As Boolean
24 | Me.datas.Add(New List(Of Double)({-20, -1900}))
25 | Me.datas.Add(New List(Of Double)({-19.8, -1918.02392}))
26 | Me.datas.Add(New List(Of Double)({-18.8, -1953.08032}))
27 | Me.datas.Add(New List(Of Double)({-7.2, 62.72128}))
28 | Me.datas.Add(New List(Of Double)({3.8, -359.10232}))
29 | Me.datas.Add(New List(Of Double)({7.2, -630.78272}))
30 | Return True
31 | End Function
32 |
33 | #Region "for LibOptimization"
34 | '''
35 | ''' Model
36 | '''
37 | '''
38 | '''
39 | '''
40 | Public Overrides Function F(x As List(Of Double)) As Double
41 | Dim sumDiffSquare As Double = 0
42 |
43 | For Each temp In Me.datas
44 | Dim predict = x(0) * temp(0) ^ 4 + x(1) * temp(0) ^ 3 + x(2) * temp(0) ^ 2 + x(3) * temp(0) + x(4)
45 | 'Dim predict = x(0) / (1 + x(1) * Math.Exp(-x(2) * DateValue())) 'Logistics
46 | Dim diffSquare = (temp(1) - predict) ^ 2
47 | sumDiffSquare += diffSquare
48 | Next
49 |
50 | Return sumDiffSquare
51 | End Function
52 |
53 | Public Overrides Function Gradient(ByVal x As List(Of Double), Optional h As Double = 0.000001) As List(Of Double)
54 | Throw New NotImplementedException
55 | End Function
56 |
57 | Public Overrides Function Hessian(ByVal x As List(Of Double), Optional h As Double = 0.000001) As List(Of List(Of Double))
58 | Throw New NotImplementedException
59 | End Function
60 |
61 | Public Overrides Function NumberOfVariable() As Integer
62 | Return 5
63 | End Function
64 | #End Region
65 | End Class
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/SampleVB/My Project/Application.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' このコードはツールによって生成されました。
4 | ' ランタイム バージョン:4.0.30319.42000
5 | '
6 | ' このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
7 | ' コードが再生成されるときに損失したりします。
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
--------------------------------------------------------------------------------
/SampleVB/My Project/Application.myapp:
--------------------------------------------------------------------------------
1 |
2 |
3 | false
4 | false
5 | 0
6 | true
7 | 0
8 | 2
9 | true
10 |
11 |
--------------------------------------------------------------------------------
/SampleVB/My Project/AssemblyInfo.vb:
--------------------------------------------------------------------------------
1 | Imports System
2 | Imports System.Reflection
3 | Imports System.Runtime.InteropServices
4 |
5 | ' アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
6 | ' アセンブリに関連付けられている情報を変更するには、
7 | ' これらの属性値を変更してください。
8 |
9 | ' アセンブリ属性の値を確認します。
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | 'このプロジェクトが COM に公開される場合、次の GUID がタイプ ライブラリの ID になります。
21 |
22 |
23 | ' アセンブリのバージョン情報は、以下の 4 つの値で構成されています:
24 | '
25 | ' Major Version
26 | ' Minor Version
27 | ' Build Number
28 | ' Revision
29 | '
30 | ' すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
31 | ' 既定値にすることができます:
32 | '
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/SampleVB/My Project/Resources.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' このコードはツールによって生成されました。
4 | ' ランタイム バージョン:4.0.30319.42000
5 | '
6 | ' このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
7 | ' コードが再生成されるときに損失したりします。
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 | Imports System
15 |
16 | Namespace My.Resources
17 |
18 | 'このクラスは StronglyTypedResourceBuilder クラスが ResGen
19 | 'または Visual Studio のようなツールを使用して自動生成されました。
20 | 'メンバーを追加または削除するには、.ResX ファイルを編集して、/str オプションと共に
21 | 'ResGen を実行し直すか、または VS プロジェクトをビルドし直します。
22 | '''
23 | ''' ローカライズされた文字列などを検索するための、厳密に型指定されたリソース クラスです。
24 | '''
25 | _
29 | Friend Module Resources
30 |
31 | Private resourceMan As Global.System.Resources.ResourceManager
32 |
33 | Private resourceCulture As Global.System.Globalization.CultureInfo
34 |
35 | '''
36 | ''' このクラスで使用されているキャッシュされた ResourceManager インスタンスを返します。
37 | '''
38 | _
39 | Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
40 | Get
41 | If Object.ReferenceEquals(resourceMan, Nothing) Then
42 | Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("SampleVB.Resources", GetType(Resources).Assembly)
43 | resourceMan = temp
44 | End If
45 | Return resourceMan
46 | End Get
47 | End Property
48 |
49 | '''
50 | ''' すべてについて、現在のスレッドの CurrentUICulture プロパティをオーバーライドします
51 | ''' 現在のスレッドの CurrentUICulture プロパティをオーバーライドします。
52 | '''
53 | _
54 | Friend Property Culture() As Global.System.Globalization.CultureInfo
55 | Get
56 | Return resourceCulture
57 | End Get
58 | Set
59 | resourceCulture = value
60 | End Set
61 | End Property
62 | End Module
63 | End Namespace
64 |
--------------------------------------------------------------------------------
/SampleVB/My Project/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/SampleVB/My Project/Settings.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' このコードはツールによって生成されました。
4 | ' ランタイム バージョン:4.0.30319.42000
5 | '
6 | ' このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
7 | ' コードが再生成されるときに損失したりします。
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | _
20 | Partial Friend NotInheritable Class MySettings
21 | Inherits Global.System.Configuration.ApplicationSettingsBase
22 |
23 | Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
24 |
25 | #Region "My.Settings 自動保存機能"
26 | #If _MyType = "WindowsForms" Then
27 | Private Shared addedHandler As Boolean
28 |
29 | Private Shared addedHandlerLockObject As New Object
30 |
31 | _
32 | Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs)
33 | If My.Application.SaveMySettingsOnExit Then
34 | My.Settings.Save()
35 | End If
36 | End Sub
37 | #End If
38 | #End Region
39 |
40 | Public Shared ReadOnly Property [Default]() As MySettings
41 | Get
42 |
43 | #If _MyType = "WindowsForms" Then
44 | If Not addedHandler Then
45 | SyncLock addedHandlerLockObject
46 | If Not addedHandler Then
47 | AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
48 | addedHandler = True
49 | End If
50 | End SyncLock
51 | End If
52 | #End If
53 | Return defaultInstance
54 | End Get
55 | End Property
56 | End Class
57 | End Namespace
58 |
59 | Namespace My
60 |
61 | _
64 | Friend Module MySettingsProperty
65 |
66 | _
67 | Friend ReadOnly Property Settings() As Global.SampleVB.My.MySettings
68 | Get
69 | Return Global.SampleVB.My.MySettings.Default
70 | End Get
71 | End Property
72 | End Module
73 | End Namespace
74 |
--------------------------------------------------------------------------------
/SampleVB/My Project/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/SampleVB/RosenBrock.vb:
--------------------------------------------------------------------------------
1 | '''
2 | ''' my objective function : inherit objective function
3 | '''
4 | '''
5 | Public Class RosenBrock : Inherits LibOptimization.Optimization.absObjectiveFunction
6 | '''
7 | ''' for Rosen block function(Bench mark function)
8 | '''
9 | '''
10 | '''
11 | '''
12 | Public Overrides Function F(ByVal a As List(Of Double)) As Double
13 | If a Is Nothing Then
14 | Return 0.0
15 | End If
16 | Dim x1 = a(0)
17 | Dim x2 = a(1)
18 | Return 100 * (x2 - x1 * x1) * (x2 - x1 * x1) + (1 - x1) * (1 - x1)
19 | End Function
20 |
21 | Public Overrides Function Gradient(ByVal x As List(Of Double), Optional h As Double = 0.000001) As List(Of Double)
22 | Return Nothing
23 | End Function
24 |
25 | Public Overrides Function Hessian(x As List(Of Double), Optional h As Double = 0.000001) As List(Of List(Of Double))
26 | Return Nothing
27 | End Function
28 |
29 | Public Overrides Function NumberOfVariable() As Integer
30 | Return 2
31 | End Function
32 | End Class
33 |
--------------------------------------------------------------------------------
/SampleVB/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/TestCode/My Project/Application.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
--------------------------------------------------------------------------------
/TestCode/My Project/AssemblyInfo.vb:
--------------------------------------------------------------------------------
1 | Imports System
2 | Imports System.Reflection
3 | Imports System.Runtime.InteropServices
4 |
5 | ' アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
6 | ' アセンブリに関連付けられている情報を変更するには、
7 | ' これらの属性値を変更してください。
8 |
9 | ' アセンブリ属性の値を確認します
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | 'このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります
21 |
22 |
23 | ' アセンブリのバージョン情報は次の 4 つの値で構成されています:
24 | '
25 | ' メジャー バージョン
26 | ' マイナー バージョン
27 | ' ビルド番号
28 | ' Revision
29 | '
30 | ' すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
31 | ' 既定値にすることができます:
32 | '
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/TestCode/My Project/Resources.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' このコードはツールによって生成されました。
4 | ' ランタイム バージョン:4.0.30319.42000
5 | '
6 | ' このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
7 | ' コードが再生成されるときに損失したりします。
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 | Imports System
15 |
16 | Namespace My.Resources
17 |
18 | 'このクラスは StronglyTypedResourceBuilder クラスが ResGen
19 | 'または Visual Studio のようなツールを使用して自動生成されました。
20 | 'メンバーを追加または削除するには、.ResX ファイルを編集して、/str オプションと共に
21 | 'ResGen を実行し直すか、または VS プロジェクトをビルドし直します。
22 | '''
23 | ''' ローカライズされた文字列などを検索するための、厳密に型指定されたリソース クラスです。
24 | '''
25 | _
29 | Friend Module Resources
30 |
31 | Private resourceMan As Global.System.Resources.ResourceManager
32 |
33 | Private resourceCulture As Global.System.Globalization.CultureInfo
34 |
35 | '''
36 | ''' このクラスで使用されているキャッシュされた ResourceManager インスタンスを返します。
37 | '''
38 | _
39 | Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
40 | Get
41 | If Object.ReferenceEquals(resourceMan, Nothing) Then
42 | Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("TestCode.Resources", GetType(Resources).Assembly)
43 | resourceMan = temp
44 | End If
45 | Return resourceMan
46 | End Get
47 | End Property
48 |
49 | '''
50 | ''' すべてについて、現在のスレッドの CurrentUICulture プロパティをオーバーライドします
51 | ''' 現在のスレッドの CurrentUICulture プロパティをオーバーライドします。
52 | '''
53 | _
54 | Friend Property Culture() As Global.System.Globalization.CultureInfo
55 | Get
56 | Return resourceCulture
57 | End Get
58 | Set
59 | resourceCulture = value
60 | End Set
61 | End Property
62 | End Module
63 | End Namespace
64 |
--------------------------------------------------------------------------------
/TestCode/My Project/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/TestCode/My Project/Settings.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | _
20 | Partial Friend NotInheritable Class MySettings
21 | Inherits Global.System.Configuration.ApplicationSettingsBase
22 |
23 | Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
24 |
25 | #Region "My.Settings Auto-Save Functionality"
26 | #If _MyType = "WindowsForms" Then
27 | Private Shared addedHandler As Boolean
28 |
29 | Private Shared addedHandlerLockObject As New Object
30 |
31 | _
32 | Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
33 | If My.Application.SaveMySettingsOnExit Then
34 | My.Settings.Save()
35 | End If
36 | End Sub
37 | #End If
38 | #End Region
39 |
40 | Public Shared ReadOnly Property [Default]() As MySettings
41 | Get
42 |
43 | #If _MyType = "WindowsForms" Then
44 | If Not addedHandler Then
45 | SyncLock addedHandlerLockObject
46 | If Not addedHandler Then
47 | AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
48 | addedHandler = True
49 | End If
50 | End SyncLock
51 | End If
52 | #End If
53 | Return defaultInstance
54 | End Get
55 | End Property
56 | End Class
57 | End Namespace
58 |
59 | Namespace My
60 |
61 | _
64 | Friend Module MySettingsProperty
65 |
66 | _
67 | Friend ReadOnly Property Settings() As Global.TestCode.My.MySettings
68 | Get
69 | Return Global.TestCode.My.MySettings.Default
70 | End Get
71 | End Property
72 | End Module
73 | End Namespace
74 |
--------------------------------------------------------------------------------
/TestCode/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/TestLibOptimization/My Project/Application.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' このコードはツールによって生成されました。
4 | ' ランタイム バージョン:4.0.30319.42000
5 | '
6 | ' このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
7 | ' コードが再生成されるときに損失したりします。
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
--------------------------------------------------------------------------------
/TestLibOptimization/My Project/Application.myapp:
--------------------------------------------------------------------------------
1 |
2 |
3 | false
4 | false
5 | 0
6 | true
7 | 0
8 | 1
9 | true
10 |
11 |
--------------------------------------------------------------------------------
/TestLibOptimization/My Project/AssemblyInfo.vb:
--------------------------------------------------------------------------------
1 | Imports System
2 | Imports System.Reflection
3 | Imports System.Runtime.InteropServices
4 |
5 | ' アセンブリに関する情報は、次の属性のセットを通して制御されます。
6 | ' アセンブリに関連付けられている情報を変更するには、
7 | ' これらの属性値を変更してください。
8 |
9 | ' アセンブリ属性の値を確認します。
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | 'このプロジェクトが COM に公開される場合、次の GUID がタイプ ライブラリの ID になります。
21 |
22 |
23 | ' アセンブリのバージョン情報は、以下の 4 つの値で構成されています:
24 | '
25 | ' Major Version
26 | ' Minor Version
27 | ' Build Number
28 | ' Revision
29 | '
30 | ' すべての値を指定するか、以下のように '*' を使用してビルドおよびリビジョン番号を
31 | ' 既定値にすることができます:
32 | '
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/TestLibOptimization/My Project/Resources.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' このコードはツールによって生成されました。
4 | ' ランタイム バージョン:4.0.30319.42000
5 | '
6 | ' このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
7 | ' コードが再生成されるときに損失したりします。
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 | Imports System
15 |
16 | Namespace My.Resources
17 |
18 | 'このクラスは StronglyTypedResourceBuilder クラスが ResGen
19 | 'または Visual Studio のようなツールを使用して自動生成されました。
20 | 'メンバーを追加または削除するには、.ResX ファイルを編集して、/str オプションと共に
21 | 'ResGen を実行し直すか、または VS プロジェクトをビルドし直します。
22 | '''
23 | ''' ローカライズされた文字列などを検索するための、厳密に型指定されたリソース クラスです。
24 | '''
25 | _
29 | Friend Module Resources
30 |
31 | Private resourceMan As Global.System.Resources.ResourceManager
32 |
33 | Private resourceCulture As Global.System.Globalization.CultureInfo
34 |
35 | '''
36 | ''' このクラスで使用されているキャッシュされた ResourceManager インスタンスを返します。
37 | '''
38 | _
39 | Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
40 | Get
41 | If Object.ReferenceEquals(resourceMan, Nothing) Then
42 | Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("TestLibOptimization.Resources", GetType(Resources).Assembly)
43 | resourceMan = temp
44 | End If
45 | Return resourceMan
46 | End Get
47 | End Property
48 |
49 | '''
50 | ''' すべてについて、現在のスレッドの CurrentUICulture プロパティをオーバーライドします
51 | ''' 現在のスレッドの CurrentUICulture プロパティをオーバーライドします。
52 | '''
53 | _
54 | Friend Property Culture() As Global.System.Globalization.CultureInfo
55 | Get
56 | Return resourceCulture
57 | End Get
58 | Set
59 | resourceCulture = value
60 | End Set
61 | End Property
62 | End Module
63 | End Namespace
64 |
--------------------------------------------------------------------------------
/TestLibOptimization/My Project/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/TestLibOptimization/My Project/Settings.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' このコードはツールによって生成されました。
4 | ' ランタイム バージョン:4.0.30319.42000
5 | '
6 | ' このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
7 | ' コードが再生成されるときに損失したりします。
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | _
20 | Partial Friend NotInheritable Class MySettings
21 | Inherits Global.System.Configuration.ApplicationSettingsBase
22 |
23 | Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
24 |
25 | #Region "My.Settings 自動保存機能"
26 | #If _MyType = "WindowsForms" Then
27 | Private Shared addedHandler As Boolean
28 |
29 | Private Shared addedHandlerLockObject As New Object
30 |
31 | _
32 | Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs)
33 | If My.Application.SaveMySettingsOnExit Then
34 | My.Settings.Save()
35 | End If
36 | End Sub
37 | #End If
38 | #End Region
39 |
40 | Public Shared ReadOnly Property [Default]() As MySettings
41 | Get
42 |
43 | #If _MyType = "WindowsForms" Then
44 | If Not addedHandler Then
45 | SyncLock addedHandlerLockObject
46 | If Not addedHandler Then
47 | AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
48 | addedHandler = True
49 | End If
50 | End SyncLock
51 | End If
52 | #End If
53 | Return defaultInstance
54 | End Get
55 | End Property
56 | End Class
57 | End Namespace
58 |
59 | Namespace My
60 |
61 | _
64 | Friend Module MySettingsProperty
65 |
66 | _
67 | Friend ReadOnly Property Settings() As Global.TestLibOptimization.My.MySettings
68 | Get
69 | Return Global.TestLibOptimization.My.MySettings.Default
70 | End Get
71 | End Property
72 | End Module
73 | End Namespace
74 |
--------------------------------------------------------------------------------
/TestLibOptimization/My Project/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/TestLibOptimization/UnitTestOther.vb:
--------------------------------------------------------------------------------
1 |
2 | 'LibOptimization
3 | Imports LibOptimization.MathTool.RNG
4 | Imports Microsoft.VisualStudio.TestTools.UnitTesting
5 |
6 | '''
7 | ''' 単体テスト 最適化、線形代数以外
8 | '''
9 | Public Class UnitTestOther
10 | #Region "Util"
11 | '''
12 | ''' check random lib
13 | '''
14 | Public Sub Other_Random()
15 | Dim rand As System.Random = Nothing
16 | Try
17 | rand = New RandomXorshift()
18 | Catch ex As Exception
19 | Assert.Fail("clsRandomXorshift error")
20 | End Try
21 |
22 | Try
23 | Dim temp As Integer = 123456
24 | rand = New RandomXorshift(BitConverter.ToUInt32(BitConverter.GetBytes(temp), 0))
25 | Catch ex As Exception
26 | Assert.Fail("clsRandomXorshift seed error using positive value.")
27 | End Try
28 |
29 | Try
30 | Dim temp As Integer = -123456
31 | rand = New RandomXorshift(BitConverter.ToUInt32(BitConverter.GetBytes(temp), 0))
32 | Catch ex As Exception
33 | Assert.Fail("clsRandomXorshift seed error using negative value.")
34 | End Try
35 | End Sub
36 | #End Region
37 | End Class
--------------------------------------------------------------------------------
/TestLibOptimizationDotNet3.0/My Project/Application.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
--------------------------------------------------------------------------------
/TestLibOptimizationDotNet3.0/My Project/Application.myapp:
--------------------------------------------------------------------------------
1 |
2 |
3 | false
4 | false
5 | 0
6 | true
7 | 0
8 | 1
9 | true
10 |
11 |
--------------------------------------------------------------------------------
/TestLibOptimizationDotNet3.0/My Project/AssemblyInfo.vb:
--------------------------------------------------------------------------------
1 | Imports System
2 | Imports System.Reflection
3 | Imports System.Runtime.InteropServices
4 |
5 | ' アセンブリに関する情報は、次の属性のセットを通して制御されます。
6 | ' アセンブリに関連付けられている情報を変更するには、
7 | ' これらの属性値を変更してください。
8 |
9 | ' アセンブリ属性の値を確認します
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | 'このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります
21 |
22 |
23 | ' アセンブリのバージョン情報は次の 4 つの値で構成されています:
24 | '
25 | ' メジャー バージョン
26 | ' マイナー バージョン
27 | ' ビルド番号
28 | ' Revision
29 | '
30 | ' すべての値を指定するか、以下のように '*' を使用してビルドおよびリビジョン番号を
31 | ' 既定値にすることができます:
32 | ' <アセンブリ: AssemblyVersion("1.0.*")>
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/TestLibOptimizationDotNet3.0/My Project/Resources.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My.Resources
16 |
17 | 'This class was auto-generated by the StronglyTypedResourceBuilder
18 | 'class via a tool like ResGen or Visual Studio.
19 | 'To add or remove a member, edit your .ResX file then rerun ResGen
20 | 'with the /str option, or rebuild your VS project.
21 | '''
22 | ''' A strongly-typed resource class, for looking up localized strings, etc.
23 | '''
24 | _
28 | Friend Module Resources
29 |
30 | Private resourceMan As Global.System.Resources.ResourceManager
31 |
32 | Private resourceCulture As Global.System.Globalization.CultureInfo
33 |
34 | '''
35 | ''' Returns the cached ResourceManager instance used by this class.
36 | '''
37 | _
38 | Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
39 | Get
40 | If Object.ReferenceEquals(resourceMan, Nothing) Then
41 | Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("TestLibOptimizationDotNet3._0.Resources", GetType(Resources).Assembly)
42 | resourceMan = temp
43 | End If
44 | Return resourceMan
45 | End Get
46 | End Property
47 |
48 | '''
49 | ''' Overrides the current thread's CurrentUICulture property for all
50 | ''' resource lookups using this strongly typed resource class.
51 | '''
52 | _
53 | Friend Property Culture() As Global.System.Globalization.CultureInfo
54 | Get
55 | Return resourceCulture
56 | End Get
57 | Set(ByVal value As Global.System.Globalization.CultureInfo)
58 | resourceCulture = value
59 | End Set
60 | End Property
61 | End Module
62 | End Namespace
63 |
--------------------------------------------------------------------------------
/TestLibOptimizationDotNet3.0/My Project/Settings.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | _
20 | Partial Friend NotInheritable Class MySettings
21 | Inherits Global.System.Configuration.ApplicationSettingsBase
22 |
23 | Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
24 |
25 | #Region "My.Settings Auto-Save Functionality"
26 | #If _MyType = "WindowsForms" Then
27 | Private Shared addedHandler As Boolean
28 |
29 | Private Shared addedHandlerLockObject As New Object
30 |
31 | _
32 | Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
33 | If My.Application.SaveMySettingsOnExit Then
34 | My.Settings.Save()
35 | End If
36 | End Sub
37 | #End If
38 | #End Region
39 |
40 | Public Shared ReadOnly Property [Default]() As MySettings
41 | Get
42 |
43 | #If _MyType = "WindowsForms" Then
44 | If Not addedHandler Then
45 | SyncLock addedHandlerLockObject
46 | If Not addedHandler Then
47 | AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
48 | addedHandler = True
49 | End If
50 | End SyncLock
51 | End If
52 | #End If
53 | Return defaultInstance
54 | End Get
55 | End Property
56 | End Class
57 | End Namespace
58 |
59 | Namespace My
60 |
61 | _
64 | Friend Module MySettingsProperty
65 |
66 | _
67 | Friend ReadOnly Property Settings() As Global.TestLibOptimizationDotNet3._0.My.MySettings
68 | Get
69 | Return Global.TestLibOptimizationDotNet3._0.My.MySettings.Default
70 | End Get
71 | End Property
72 | End Module
73 | End Namespace
74 |
--------------------------------------------------------------------------------
/TestLibOptimizationDotNet3.0/My Project/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/TestLibOptimizationDotNet3.5/My Project/Application.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
--------------------------------------------------------------------------------
/TestLibOptimizationDotNet3.5/My Project/Application.myapp:
--------------------------------------------------------------------------------
1 |
2 |
3 | false
4 | false
5 | 0
6 | true
7 | 0
8 | 1
9 | true
10 |
11 |
--------------------------------------------------------------------------------
/TestLibOptimizationDotNet3.5/My Project/AssemblyInfo.vb:
--------------------------------------------------------------------------------
1 | Imports System
2 | Imports System.Reflection
3 | Imports System.Runtime.InteropServices
4 |
5 | ' アセンブリに関する情報は、次の属性のセットを通して制御されます。
6 | ' アセンブリに関連付けられている情報を変更するには、
7 | ' これらの属性値を変更してください。
8 |
9 | ' アセンブリ属性の値を確認します
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | 'このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります
21 |
22 |
23 | ' アセンブリのバージョン情報は次の 4 つの値で構成されています:
24 | '
25 | ' メジャー バージョン
26 | ' マイナー バージョン
27 | ' ビルド番号
28 | ' Revision
29 | '
30 | ' すべての値を指定するか、以下のように '*' を使用してビルドおよびリビジョン番号を
31 | ' 既定値にすることができます:
32 | ' <アセンブリ: AssemblyVersion("1.0.*")>
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/TestLibOptimizationDotNet3.5/My Project/Resources.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My.Resources
16 |
17 | 'This class was auto-generated by the StronglyTypedResourceBuilder
18 | 'class via a tool like ResGen or Visual Studio.
19 | 'To add or remove a member, edit your .ResX file then rerun ResGen
20 | 'with the /str option, or rebuild your VS project.
21 | '''
22 | ''' A strongly-typed resource class, for looking up localized strings, etc.
23 | '''
24 | _
28 | Friend Module Resources
29 |
30 | Private resourceMan As Global.System.Resources.ResourceManager
31 |
32 | Private resourceCulture As Global.System.Globalization.CultureInfo
33 |
34 | '''
35 | ''' Returns the cached ResourceManager instance used by this class.
36 | '''
37 | _
38 | Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
39 | Get
40 | If Object.ReferenceEquals(resourceMan, Nothing) Then
41 | Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("TestLibOptimizationDotNet3._5.Resources", GetType(Resources).Assembly)
42 | resourceMan = temp
43 | End If
44 | Return resourceMan
45 | End Get
46 | End Property
47 |
48 | '''
49 | ''' Overrides the current thread's CurrentUICulture property for all
50 | ''' resource lookups using this strongly typed resource class.
51 | '''
52 | _
53 | Friend Property Culture() As Global.System.Globalization.CultureInfo
54 | Get
55 | Return resourceCulture
56 | End Get
57 | Set(ByVal value As Global.System.Globalization.CultureInfo)
58 | resourceCulture = value
59 | End Set
60 | End Property
61 | End Module
62 | End Namespace
63 |
--------------------------------------------------------------------------------
/TestLibOptimizationDotNet3.5/My Project/Settings.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | _
20 | Partial Friend NotInheritable Class MySettings
21 | Inherits Global.System.Configuration.ApplicationSettingsBase
22 |
23 | Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
24 |
25 | #Region "My.Settings Auto-Save Functionality"
26 | #If _MyType = "WindowsForms" Then
27 | Private Shared addedHandler As Boolean
28 |
29 | Private Shared addedHandlerLockObject As New Object
30 |
31 | _
32 | Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
33 | If My.Application.SaveMySettingsOnExit Then
34 | My.Settings.Save()
35 | End If
36 | End Sub
37 | #End If
38 | #End Region
39 |
40 | Public Shared ReadOnly Property [Default]() As MySettings
41 | Get
42 |
43 | #If _MyType = "WindowsForms" Then
44 | If Not addedHandler Then
45 | SyncLock addedHandlerLockObject
46 | If Not addedHandler Then
47 | AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
48 | addedHandler = True
49 | End If
50 | End SyncLock
51 | End If
52 | #End If
53 | Return defaultInstance
54 | End Get
55 | End Property
56 | End Class
57 | End Namespace
58 |
59 | Namespace My
60 |
61 | _
64 | Friend Module MySettingsProperty
65 |
66 | _
67 | Friend ReadOnly Property Settings() As Global.TestLibOptimizationDotNet3._5.My.MySettings
68 | Get
69 | Return Global.TestLibOptimizationDotNet3._5.My.MySettings.Default
70 | End Get
71 | End Property
72 | End Module
73 | End Namespace
74 |
--------------------------------------------------------------------------------
/TestLibOptimizationDotNet3.5/My Project/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/TestLibOptimizationDotNetCore/TestLibOptimizationDotNetCore.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | TestLibOptimizationDotNetCore
5 | net5.0
6 |
7 | false
8 |
9 | AnyCPU;x86
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/_BuildLib/release_space.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tomitomi3/LibOptimization/323fb6144be973ddd9e1ec494113f49d035c6711/_BuildLib/release_space.txt
--------------------------------------------------------------------------------
/github_pic/liboptimization_nuget.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tomitomi3/LibOptimization/323fb6144be973ddd9e1ec494113f49d035c6711/github_pic/liboptimization_nuget.png
--------------------------------------------------------------------------------
/github_pic/logo_liboptimization.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tomitomi3/LibOptimization/323fb6144be973ddd9e1ec494113f49d035c6711/github_pic/logo_liboptimization.png
--------------------------------------------------------------------------------
/gitのコマンドメモ.txt:
--------------------------------------------------------------------------------
1 | タグをリモートにプッシュ
2 | $ git push origin タグ名
3 |
4 | すべてのタグをリモートにプッシュ
5 | $ git push origin --tags
6 |
7 | タグを削除
8 | $ git tag -d タグ名
9 |
10 | 直近のコミット、プッシュを削除、リモートも削除
11 | $ git reset --hard HEAD^
12 | $ git push -f origin master
13 |
--------------------------------------------------------------------------------
/nugetメモ.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tomitomi3/LibOptimization/323fb6144be973ddd9e1ec494113f49d035c6711/nugetメモ.txt
--------------------------------------------------------------------------------