diff --git a/BlueM.Opt/Algos/ES/ESController.vb b/BlueM.Opt/Algos/ES/ESController.vb index 4e6a5c54..ebcc2739 100644 --- a/BlueM.Opt/Algos/ES/ESController.vb +++ b/BlueM.Opt/Algos/ES/ESController.vb @@ -15,11 +15,8 @@ 'You should have received a copy of the GNU General Public License 'along with this program. If not, see . ' -Imports BlueM.Opt.Common.Constants -Imports System.Windows.Forms -Imports System.ComponentModel Imports System.Drawing -Imports System.Threading +Imports BlueM.Opt.Common ''' ''' Kontrolliert den Ablauf der Evolutionsstrategie @@ -36,60 +33,60 @@ Public Class ESController End Get End Property - Private myProblem As BlueM.Opt.Common.Problem - Private mySettings As BlueM.Opt.Common.Settings - Private myProgress As BlueM.Opt.Common.Progress - Private myMonitor As BlueM.Opt.Diagramm.Monitor - Private myHauptDiagramm As BlueM.Opt.Diagramm.Hauptdiagramm + Private myProblem As Problem + Private mySettings As Settings + Private myProgress As Progress + Private myMonitor As Diagramm.Monitor + Private myHauptDiagramm As Diagramm.Hauptdiagramm - Private myAppType As BlueM.Opt.Common.ApplicationTypes - Private WithEvents Sim1 As BlueM.Opt.Apps.Sim - Private Testprobleme1 As BlueM.Opt.Apps.Testprobleme + Private myAppType As ApplicationTypes + Private WithEvents Sim1 As Apps.Sim + Private Testprobleme1 As Apps.Testprobleme Private PES1 As PES Private stopped As Boolean - 'Serien für Monitor + 'Serien für Monitor Private Line_Dn() As Steema.TeeChart.Styles.Line Private Line_Hypervolume As Steema.TeeChart.Styles.Line #Region "Methoden" ''' - ''' Initialisiert den ES-Controller und übergibt alle erforderlichen Objekte + ''' Initialisiert den ES-Controller und übergibt alle erforderlichen Objekte ''' ''' ''' ''' ''' - Public Sub Init(ByRef inputProblem As BlueM.Opt.Common.Problem, _ - ByRef inputSettings As BlueM.Opt.Common.Settings, _ - ByRef inputProgress As BlueM.Opt.Common.Progress, _ - ByRef inputHptDiagramm As BlueM.Opt.Diagramm.Hauptdiagramm) Implements IController.Init + Public Sub Init(ByRef inputProblem As Problem, + ByRef inputSettings As Settings, + ByRef inputProgress As Progress, + ByRef inputHptDiagramm As Diagramm.Hauptdiagramm) Implements IController.Init Me.myProblem = inputProblem Me.mySettings = inputSettings Me.myProgress = inputProgress Me.myHauptDiagramm = inputHptDiagramm - Me.myMonitor = BlueM.Opt.Diagramm.Monitor.getInstance() + Me.myMonitor = Diagramm.Monitor.getInstance() End Sub ''' - ''' Initialisiert den Controller für Sim-Anwendungen + ''' Initialisiert den Controller für Sim-Anwendungen ''' ''' die Simulationsanwendung - Public Sub InitApp(ByRef inputSim As BlueM.Opt.Apps.Sim) Implements IController.InitApp + Public Sub InitApp(ByRef inputSim As Apps.Sim) Implements IController.InitApp Me.myAppType = ApplicationTypes.Sim Me.Sim1 = inputSim End Sub ''' - ''' Initialisiert den Controller für Testprobleme + ''' Initialisiert den Controller für Testprobleme ''' - Public Sub InitApp(ByRef inputTestprobleme As BlueM.Opt.Apps.Testprobleme) Implements IController.InitApp + Public Sub InitApp(ByRef inputTestprobleme As Apps.Testprobleme) Implements IController.InitApp Me.myAppType = ApplicationTypes.Testproblems Me.Testprobleme1 = inputTestprobleme End Sub @@ -120,24 +117,24 @@ Public Class ESController ''' ''' zu verarbeitendes Individuum ''' 0-basierte Nachfahre-Nummer - ''' Fängt auch das Multithreading-Event Sim.IndividuumEvaluated ab - Private Sub processIndividuum(ByRef ind As Common.Individuum, ByVal iNachfahre As Integer) Handles Sim1.IndividuumEvaluated + ''' Fängt auch das Multithreading-Event Sim.IndividuumEvaluated ab + Private Sub processIndividuum(ByRef ind As Individuum, ByVal iNachfahre As Integer) Handles Sim1.IndividuumEvaluated Call Me.processIndividuum_PES(ind, iNachfahre) End Sub #Region "PES" - 'Anwendung Evolutionsstrategie für Parameter Optimierung - hier Steuerung + 'Anwendung Evolutionsstrategie für Parameter Optimierung - hier Steuerung '************************************************************************ Private Sub STARTEN_PES() Dim i_Nachf, durchlauf As Integer - Dim inds() As Common.Individuum_PES + Dim inds() As Individuum_PES Dim isOK() As Boolean 'Hypervolumen instanzieren - Dim Hypervolume As BlueM.Opt.MO_Indicators.Indicators - Hypervolume = BlueM.Opt.MO_Indicators.MO_IndicatorFabrik.GetInstance(BlueM.Opt.MO_Indicators.MO_IndicatorFabrik.IndicatorsType.Hypervolume, Me.myProblem.NumPrimObjective) + Dim Hypervolume As MO_Indicators.Indicators + Hypervolume = MO_Indicators.MO_IndicatorFabrik.GetInstance(MO_Indicators.MO_IndicatorFabrik.IndicatorsType.Hypervolume, Me.myProblem.NumPrimObjective) 'Schritte 0: Objekt der Klasse PES wird erzeugt '********************************************** @@ -152,23 +149,23 @@ Public Class ESController durchlauf = 1 - 'Über alle Runden + 'Über alle Runden 'xxxxxxxxxxxxxxxx For PES1.PES_iAkt.iAktRunde = 0 To Me.mySettings.PES.Pop.N_Runden - 1 - Common.Log.AddMessage(Common.Log.levels.info, $"Starting round {PES1.PES_iAkt.iAktRunde}...") + Log.AddMessage(Log.levels.info, $"Starting round {PES1.PES_iAkt.iAktRunde}...") Call PES1.EsResetPopBWSpeicher() 'Nur bei Komma Strategie - 'Über alle Populationen + 'Über alle Populationen 'xxxxxxxxxxxxxxxxxxxxxx For PES1.PES_iAkt.iAktPop = 0 To Me.mySettings.PES.Pop.N_Popul - 1 - Common.Log.AddMessage(Common.Log.levels.info, $"Starting population {PES1.PES_iAkt.iAktPop}...") + Log.AddMessage(Log.levels.info, $"Starting population {PES1.PES_iAkt.iAktPop}...") 'POPULATIONS REPRODUKTIONSPROZESS '################################ - 'Ermitteln der neuen Ausgangswerte für Nachkommen aus den Eltern der Population + 'Ermitteln der neuen Ausgangswerte für Nachkommen aus den Eltern der Population Call PES1.EsPopReproduktion() 'POPULATIONS MUTATIONSPROZESS @@ -176,18 +173,18 @@ Public Class ESController 'Mutieren der Ausgangswerte der Population Call PES1.EsPopMutation() - 'Über alle Generationen + 'Über alle Generationen 'xxxxxxxxxxxxxxxxxxxxxx For PES1.PES_iAkt.iAktGen = 0 To Me.mySettings.PES.N_Gen - 1 - Common.Log.AddMessage(Common.Log.levels.info, $"Starting generation {PES1.PES_iAkt.iAktGen}...") + Log.AddMessage(Log.levels.info, $"Starting generation {PES1.PES_iAkt.iAktGen}...") Call PES1.EsResetBWSpeicher() 'Nur bei Komma Strategie ReDim inds(Me.mySettings.PES.N_Nachf - 1) ReDim isOK(Me.mySettings.PES.N_Nachf - 1) - 'Schleife über alle Nachkommen + 'Schleife über alle Nachkommen 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx For i_Nachf = 0 To Me.mySettings.PES.N_Nachf - 1 @@ -197,7 +194,7 @@ Public Class ESController durchlauf += 1 'Neues Individuum instanzieren - inds(i_Nachf) = New Common.Individuum_PES("PES", durchlauf) + inds(i_Nachf) = New Individuum_PES("PES", durchlauf) 'Neue Parameter holen Call PES_getNewParameters(inds(i_Nachf)) @@ -207,7 +204,7 @@ Public Class ESController 'Testprobleme immer direkt auswerten '=================================== - 'Lösung evaluieren und zeichnen + 'Lösung evaluieren und zeichnen Call Testprobleme1.Evaluate(inds(i_Nachf), PES1.PES_iAkt.iAktPop, Me.myHauptDiagramm) 'Evaluierung verarbeiten @@ -228,7 +225,7 @@ Public Class ESController '---------------------------- If (Not isOK(i_Nachf)) Then - Common.Log.AddMessage(Common.Log.levels.warning, $"Evaluation of child {i_Nachf} was unsuccessful, a new parameter set will be generated and evaluated...") + Log.AddMessage(Log.levels.warning, $"Evaluation of child {i_Nachf} was unsuccessful, a new parameter set will be generated and evaluated...") Dim n_Tries As Integer = 0 @@ -260,7 +257,7 @@ Public Class ESController If (Me.mySettings.General.UseMultithreading) Then 'Simulationsanwendungen mit Multithreading - 'nachträglich auswerten + 'nachträglich auswerten '========================================= 'Alle Individuen evaluieren @@ -277,7 +274,7 @@ Public Class ESController If errorcount > 0 Then Dim msg As String msg = $"Evaluation of {errorcount} children of the current generation failed, will generate and evaluate new parameter sets..." - Common.Log.AddMessage(Common.Log.levels.warning, msg) + Log.AddMessage(Log.levels.warning, msg) End If 'Alle evaluierten Individuen durchlaufen @@ -309,68 +306,68 @@ Public Class ESController End If - 'erfolgreich evaluierte Individuen wurden bereits über Event verarbeitet + 'erfolgreich evaluierte Individuen wurden bereits über Event verarbeitet Next End If 'Ende alle Nachfahren (multithread) 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - Common.Log.AddMessage(Common.Log.levels.info, $"Generation {PES1.PES_iAkt.iAktGen} completed.") + Log.AddMessage(Log.levels.info, $"Generation {PES1.PES_iAkt.iAktGen} completed.") - 'SELEKTIONSPROZESS Schritt 2 für NDSorting sonst Xe = Xb + 'SELEKTIONSPROZESS Schritt 2 für NDSorting sonst Xe = Xb 'Die neuen Eltern werden generiert - Common.Log.AddMessage(Common.Log.levels.info, "Determining new parents...") + Log.AddMessage(Log.levels.info, "Determining new parents...") Call PES1.EsEltern() - 'Sekundäre Population + 'Sekundäre Population '==================== - If (Me.mySettings.PES.OptModus = Common.Constants.EVO_MODE.Multi_Objective) Then + If (Me.mySettings.PES.OptModus = Constants.EVO_MODE.Multi_Objective) Then - Common.Log.AddMessage(Common.Log.levels.info, "Updating secondary population...") + Log.AddMessage(Log.levels.info, "Updating secondary population...") 'SekPop abspeichern '------------------ If (Not IsNothing(Sim1)) Then - Call Sim1.OptResult.setSekPop(PES1.SekundärQb, PES1.PES_iAkt.iAktGen) + Call Sim1.OptResult.setSekPop(PES1.SekundärQb, PES1.PES_iAkt.iAktGen) End If 'SekPop zeichnen '--------------- If (Not IsNothing(Sim1)) Then - 'Umweg über Sim1.OptResult gehen, weil es im PES keine Individuum-IDs gibt (#177) + 'Umweg über Sim1.OptResult gehen, weil es im PES keine Individuum-IDs gibt (#177) Call Me.myHauptDiagramm.ZeichneSekPopulation(Sim1.OptResult.getSekPop()) Else - Call Me.myHauptDiagramm.ZeichneSekPopulation(PES1.SekundärQb) + Call Me.myHauptDiagramm.ZeichneSekPopulation(PES1.SekundärQb) End If 'Hypervolumen berechnen und Zeichnen '----------------------------------- - Call Hypervolume.update_dataset(Common.Individuum.Get_All_Penalty_of_Array(PES1.SekundärQb)) + Call Hypervolume.update_dataset(Common.Individuum.Get_All_Penalty_of_Array(PES1.SekundärQb)) Call Me.ZeichneNadirpunkt(Hypervolume.nadir) Call Me.ZeichneHyperVolumen(PES1.PES_iAkt.iAktGen + 1, Math.Abs(Hypervolume.calc_indicator())) End If - 'ggf. alte Generation aus Diagramm löschen + 'ggf. alte Generation aus Diagramm löschen If (Me.mySettings.General.DrawOnlyCurrentGeneration _ And PES1.PES_iAkt.iAktGen < Me.mySettings.PES.N_Gen - 1) Then - Call Me.myHauptDiagramm.LöscheLetzteGeneration(PES1.PES_iAkt.iAktPop) + Call Me.myHauptDiagramm.LöscheLetzteGeneration(PES1.PES_iAkt.iAktPop) End If 'Verlauf aktualisieren Me.myProgress.iNachf = 0 Me.myProgress.iGen = PES1.PES_iAkt.iAktGen + 1 - System.Windows.Forms.Application.DoEvents() + Windows.Forms.Application.DoEvents() Next 'Ende alle Generationen 'xxxxxxxxxxxxxxxxxxxxxxxxxxx - System.Windows.Forms.Application.DoEvents() + Windows.Forms.Application.DoEvents() 'POPULATIONS SELEKTIONSPROZESS Schritt 1 '######################################## - 'Einordnen der Qualitätsfunktion im PopulationsBestwertspeicher + 'Einordnen der Qualitätsfunktion im PopulationsBestwertspeicher Call PES1.EsPopBest() 'Verlauf aktualisieren @@ -393,13 +390,13 @@ Public Class ESController End Sub ''' - ''' Führt Reproduktion und Mutation aus und kopiert die neu gewonnenen Parameter ins Individuum + ''' Führt Reproduktion und Mutation aus und kopiert die neu gewonnenen Parameter ins Individuum ''' ''' Das Individuum, dessen Parameter erneuert werden soll - Private Sub PES_getNewParameters(ByRef ind As BlueM.Opt.Common.Individuum_PES) + Private Sub PES_getNewParameters(ByRef ind As Individuum_PES) 'REPRODUKTIONSPROZESS - 'Ermitteln der neuen Ausgangswerte für Nachkommen aus den Eltern + 'Ermitteln der neuen Ausgangswerte für Nachkommen aus den Eltern Call PES1.EsReproduktion() 'MUTATIONSPROZESS @@ -407,22 +404,22 @@ Public Class ESController Call PES1.EsMutation() 'Auslesen der variierten Parameter und in Individuum kopieren - ind.OptParameter = BlueM.Opt.Common.OptParameter.Clone_Array(PES1.EsGetParameter()) + ind.OptParameter = OptParameter.Clone_Array(PES1.EsGetParameter()) End Sub ''' - ''' Verarbeitet ein evaluiertes Individuum für PES: + ''' Verarbeitet ein evaluiertes Individuum für PES: ''' * Individuum im PES-Bestwertspeicher einordnen - ''' * Lösung im Hauptdiagramm zeichnen + ''' * Lösung im Hauptdiagramm zeichnen ''' * Dn im Monitor zeichnen ''' * Verlaufsanzeige aktualisieren ''' ''' Das zu verarbeitende Individuum ''' 0-basierte Nachfahrens-Nummer - Private Sub processIndividuum_PES(ByRef ind As Common.Individuum_PES, ByVal iNachfahre As Integer) + Private Sub processIndividuum_PES(ByRef ind As Individuum_PES, ByVal iNachfahre As Integer) - 'Lösung im Hauptdiagramm zeichnen (Testprobleme zeichnen sich selber) + 'Lösung im Hauptdiagramm zeichnen (Testprobleme zeichnen sich selber) If (myAppType = ApplicationTypes.Sim) Then Call Me.myHauptDiagramm.ZeichneIndividuum(ind, PES1.PES_iAkt.iAktRunde, PES1.PES_iAkt.iAktPop, PES1.PES_iAkt.iAktGen, iNachfahre + 1, Color.Orange) End If @@ -431,15 +428,15 @@ Public Class ESController Me.Zeichne_Dn(PES1.PES_iAkt.iAktGen * Me.mySettings.PES.N_Nachf + iNachfahre + 1, ind) 'SELEKTIONSPROZESS Schritt 1 - 'Einordnen der Qualitätsfunktion im Bestwertspeicher bei SO - 'Falls MO Einordnen der Qualitätsfunktion in NDSorting + 'Einordnen der Qualitätsfunktion im Bestwertspeicher bei SO + 'Falls MO Einordnen der Qualitätsfunktion in NDSorting PES1.PES_iAkt.iAktNachf = iNachfahre Call PES1.EsBest(ind) 'Verlauf aktualisieren (don't use iNachf as they are not always processed in order) Me.myProgress.NextNachf() - System.Windows.Forms.Application.DoEvents() + Windows.Forms.Application.DoEvents() End Sub @@ -466,7 +463,7 @@ Public Class ESController If (Me.mySettings.PES.SetMutation.IsDnVektor) Then - 'Bei PES-Schrittweitenvektor eine Linie für jeden Parameter + 'Bei PES-Schrittweitenvektor eine Linie für jeden Parameter ReDim Me.Line_Dn(Me.myProblem.List_OptParameter.Length - 1) For i As Integer = 0 To Me.myProblem.List_OptParameter.Length - 1 Me.Line_Dn(i) = Me.myMonitor.Diag.getSeriesLine("Step size " & Me.myProblem.List_OptParameter(i).Bezeichnung) @@ -511,10 +508,10 @@ Public Class ESController Me.Line_Hypervolume = Me.myMonitor.Diag.getSeriesLine("Hypervolume", "Red") Me.Line_Hypervolume.CustomHorizAxis = Me.myMonitor.Diag.Axes.Top Me.Line_Hypervolume.CustomVertAxis = Me.myMonitor.Diag.Axes.Right - Me.Line_Hypervolume.Color = System.Drawing.Color.Red + Me.Line_Hypervolume.Color = Color.Red Me.Line_Hypervolume.Pointer.Visible = True Me.Line_Hypervolume.Pointer.Style = Steema.TeeChart.Styles.PointerStyles.Circle - Me.Line_Hypervolume.Pointer.Brush.Color = System.Drawing.Color.Red + Me.Line_Hypervolume.Pointer.Brush.Color = Color.Red Me.Line_Hypervolume.Pointer.HorizSize = 2 Me.Line_Hypervolume.Pointer.VertSize = 2 Me.Line_Hypervolume.Pointer.Pen.Visible = False @@ -534,9 +531,9 @@ Public Class ESController ''' ''' Schrittweite(n) in Monitordiagramm eintragen ''' - ''' Durchlaufnummer (für X-Achse) + ''' Durchlaufnummer (für X-Achse) ''' Individuum, dessen Schrittweite(n) gezeichnet werden sollen - Private Sub Zeichne_Dn(ByVal durchlauf As Integer, ByVal ind As Common.Individuum) + Private Sub Zeichne_Dn(ByVal durchlauf As Integer, ByVal ind As Individuum) Dim i As Integer diff --git a/BlueM.Opt/Algos/ES/Functions.vb b/BlueM.Opt/Algos/ES/Functions.vb index 20a2970d..1d2d745b 100644 --- a/BlueM.Opt/Algos/ES/Functions.vb +++ b/BlueM.Opt/Algos/ES/Functions.vb @@ -18,13 +18,13 @@ Imports BlueM.Opt.Common ''' -''' Wird derzeit für das NDSorting verwendet um es für die verschiedenen Kerne anwenden zu können +''' Wird derzeit für das NDSorting verwendet um es für die verschiedenen Kerne anwenden zu können ''' Public Class Functions - 'Die Statische Variablen werden im Konstruktor übergeben + 'Die Statische Variablen werden im Konstruktor übergeben '******************************************************* - Dim mProblem As BlueM.Opt.Common.Problem + Dim mProblem As Problem Dim NNachf As Integer Dim NEltern As Integer Dim isSekPopBegrenzung As Boolean @@ -34,9 +34,9 @@ Public Class Functions Dim iAktGen As Integer Dim iAktPop As Integer - 'Die Statische Variablen werden im Konstruktor übergeben + 'Die Statische Variablen werden im Konstruktor übergeben '******************************************************* - Public Sub New(ByRef prob As BlueM.Opt.Common.Problem, ByVal _NNachf As Integer, ByVal _NEltern As Integer, ByVal _isSekPopBegrenzung As Boolean, ByVal _NMaxMemberSekPop As Integer, ByVal _NInteract As Integer, ByVal _isInteract As Boolean, ByVal _iAktGen As Integer) + Public Sub New(ByRef prob As Problem, ByVal _NNachf As Integer, ByVal _NEltern As Integer, ByVal _isSekPopBegrenzung As Boolean, ByVal _NMaxMemberSekPop As Integer, ByVal _NInteract As Integer, ByVal _isInteract As Boolean, ByVal _iAktGen As Integer) mProblem = prob NNachf = _NNachf @@ -49,12 +49,12 @@ Public Class Functions End Sub - 'Dieser Teil beschäftigt sich nur mit SekundärQb und NDSorting + 'Dieser Teil beschäftigt sich nur mit SekundärQb und NDSorting '2. Die einzelnen Fronten werden bestimmt - '3. Der Bestwertspeicher wird entsprechend der Fronten oder der sekundären Population gefüllt - '4: Sekundäre Population wird bestimmt und gespeichert + '3. Der Bestwertspeicher wird entsprechend der Fronten oder der sekundären Population gefüllt + '4: Sekundäre Population wird bestimmt und gespeichert '-------------------------------------------------------------------------------------------- - Public Sub EsEltern_Pareto(ByVal NDSorting() As Individuum, ByRef SekundärQb() As Individuum, ByRef Best() As Individuum) + Public Sub EsEltern_Pareto(ByVal NDSorting() As Individuum, ByRef SekundärQb() As Individuum, ByRef Best() As Individuum) Dim i As Integer Dim NFrontMember_aktuell As Integer @@ -75,25 +75,25 @@ Public Class Functions 'NDSorting wird in Temp kopiert Temp = Individuum.Clone_Indi_Array(NDSorting) - 'Schleife läuft über die Zahl der Fronten die hier auch bestimmt werden + 'Schleife läuft über die Zahl der Fronten die hier auch bestimmt werden Do 'Entscheidet welche Werte dominiert werden und welche nicht Call Pareto_Non_Dominated_Sorting(Temp, rang) 'Nach Dominanz sortieren NFrontMember_aktuell = Pareto_Non_Dominated_Count_and_Sort(Temp) - 'Array umdrehen, weil wir die nicht dominanten Lösungen oben haben wollen + 'Array umdrehen, weil wir die nicht dominanten Lösungen oben haben wollen Call Array.Reverse(Temp) 'NFrontMember_aktuell: Anzahl der Mitglieder der gerade bestimmten Front 'NFrontMember_gesamt: Alle bisher als nicht dominiert klassifizierten Individuum NFrontMember_gesamt += NFrontMember_aktuell 'Hier wird pro durchlauf die nicht dominierte Front in NDSResult geschaufelt - 'und die bereits klassifizierten Lösungen aus Temp Array gelöscht + 'und die bereits klassifizierten Lösungen aus Temp Array gelöscht Call Pareto_Non_Dominated_Result(Temp, NDSResult, NFrontMember_aktuell, NFrontMember_gesamt) 'Rang ist hier die Nummer der Front rang += 1 Loop While Not (NFrontMember_gesamt = NEltern + NNachf) - '3. Der Bestwertspeicher wird entsprechend der Fronten oder der sekundären Population gefüllt + '3. Der Bestwertspeicher wird entsprechend der Fronten oder der sekundären Population gefüllt '-------------------------------------------------------------------------------------------- NFrontMember_aktuell = 0 NFrontMember_gesamt = 0 @@ -102,8 +102,8 @@ Public Class Functions Do NFrontMember_aktuell = Pareto_Count_Front_Members(aktuelle_Front, NDSResult) - 'Es sind mehr Elterplätze für die nächste Generation verfügaber - '-> schiss wird einfach rüberkopiert + 'Es sind mehr Elterplätze für die nächste Generation verfügaber + '-> schiss wird einfach rüberkopiert If NFrontMember_aktuell <= NEltern - NFrontMember_gesamt Then For i = NFrontMember_gesamt To NFrontMember_aktuell + NFrontMember_gesamt - 1 @@ -114,8 +114,8 @@ Public Class Functions NFrontMember_gesamt = NFrontMember_gesamt + NFrontMember_aktuell Else - 'Es sind weniger Elterplätze für die nächste Generation verfügber - 'als Mitglieder der aktuellen Front. Nur für diesen Rest wird crowding distance + 'Es sind weniger Elterplätze für die nächste Generation verfügber + 'als Mitglieder der aktuellen Front. Nur für diesen Rest wird crowding distance 'gemacht um zu bestimmen wer noch mitspielen darf und wer noch a biserl was druff hat Call Pareto_Crowding_Distance_Sort(NDSResult, NFrontMember_gesamt, NFrontMember_gesamt + NFrontMember_aktuell - 1) @@ -132,22 +132,22 @@ Public Class Functions Loop While Not (NFrontMember_gesamt = NEltern) - '4: Sekundäre Population wird aktualisiert + '4: Sekundäre Population wird aktualisiert '----------------------------------------- - Call SekundärQb_Allocation(NDSResult, SekundärQb) + Call SekundärQb_Allocation(NDSResult, SekundärQb) - 'Prüfen, ob die Population jetzt mit Mitgliedern aus der Sekundären Population aufgefüllt werden soll + 'Prüfen, ob die Population jetzt mit Mitgliedern aus der Sekundären Population aufgefüllt werden soll '---------------------------------------------------------------------------------------------------- If NInteract > 0 And isInteract Then If (iAktGen Mod NInteract) = 0 Then - NFrontMember_aktuell = Pareto_Count_Front_Members(1, SekundärQb) + NFrontMember_aktuell = Pareto_Count_Front_Members(1, SekundärQb) If NFrontMember_aktuell > NEltern Then 'Crowding Distance - Call Pareto_Crowding_Distance_Sort(SekundärQb, 0, SekundärQb.GetUpperBound(0)) - 'Anzahl Eltern wird aus SekundärQb in den Bestwertspeicher kopiert + Call Pareto_Crowding_Distance_Sort(SekundärQb, 0, SekundärQb.GetUpperBound(0)) + 'Anzahl Eltern wird aus SekundärQb in den Bestwertspeicher kopiert For i = 0 To NEltern - 1 - Best(i) = SekundärQb(i).Clone() + Best(i) = SekundärQb(i).Clone() Next i End If End If @@ -168,17 +168,17 @@ Public Class Functions For i = 0 To NDSorting.GetUpperBound(0) For j = 0 To NDSorting.GetUpperBound(0) - 'Überpüfen, ob NDSorting(j) von NDSorting(i) dominiert wird + 'Überpüfen, ob NDSorting(j) von NDSorting(i) dominiert wird '---------------------------------------------------------- If (NDSorting(i).Is_Feasible And Not NDSorting(j).Is_Feasible) Then - 'i gültig und j ungültig + 'i gültig und j ungültig '----------------------- NDSorting(j).dominated = True ElseIf ((Not NDSorting(i).Is_Feasible) And (Not NDSorting(j).Is_Feasible)) Then - 'beide ungültig + 'beide ungültig '-------------- Summe_Constrain(0) = 0 Summe_Constrain(1) = 0 @@ -198,7 +198,7 @@ Public Class Functions ElseIf (NDSorting(i).Is_Feasible And NDSorting(j).Is_Feasible) Then - 'beide gültig + 'beide gültig '------------ isDominated = False @@ -250,7 +250,7 @@ Public Class Functions ''' ''' Sortiert die dominanten Individuen nach oben, die nicht dominanten nach unten, - ''' gibt die Zahl der dominanten Individuen zurück (Front) + ''' gibt die Zahl der dominanten Individuen zurück (Front) ''' ''' zu sortierendes Array von Individuen ''' Anzahl dominanter Individuen (Front) @@ -264,7 +264,7 @@ Public Class Functions 'Anhand von Dominated-Property sortieren (False kommt nach oben) Call Array.Sort(inds, comparer) - 'Nicht-dominierte Individuen zählen + 'Nicht-dominierte Individuen zählen NFrontMembers = 0 For Each ind As Individuum In inds If (ind.Dominated = False) @@ -279,7 +279,7 @@ Public Class Functions End Function 'NON_DOMINATED_RESULT - Hier wird pro durchlauf die nicht dominierte Front in NDSResult - 'geschaufelt und die bereits klassifizierten Lösungen aus Temp Array gelöscht + 'geschaufelt und die bereits klassifizierten Lösungen aus Temp Array gelöscht '************************************************************************************** Private Sub Pareto_Non_Dominated_Result(ByRef Temp() As Individuum, ByRef NDSResult() As Individuum, ByVal NFrontMember_aktuell As Integer, ByVal NFrontMember_gesamt As Integer) @@ -287,17 +287,17 @@ Public Class Functions Position = NFrontMember_gesamt - NFrontMember_aktuell - 'In NDSResult werden die nicht dominierten Lösungen eingefügt + 'In NDSResult werden die nicht dominierten Lösungen eingefügt For i = Temp.GetLength(0) - NFrontMember_aktuell To Temp.GetUpperBound(0) 'NDSResult alle bisher gefundene Fronten NDSResult(Position) = Temp(i).Clone() Position += 1 Next i - 'Die bereits klassifizierten Member werden aus dem Temp Array gelöscht + 'Die bereits klassifizierten Member werden aus dem Temp Array gelöscht If (NNachf + NEltern - NFrontMember_gesamt > 0) Then ReDim Preserve Temp(NNachf + NEltern - NFrontMember_gesamt - 1) - 'Der Flag wird zur klassifizierung in der nächsten Runde zurückgesetzt + 'Der Flag wird zur klassifizierung in der nächsten Runde zurückgesetzt For i = 0 To Temp.GetUpperBound(0) Temp(i).dominated = False Next i @@ -411,9 +411,9 @@ Public Class Functions Next k End Sub - '4: Sekundäre Population wird aktualisiert + '4: Sekundäre Population wird aktualisiert '----------------------------------------- - Private Sub SekundärQb_Allocation(ByVal NDSResult() As Common.Individuum, ByRef SekundärQb() As Common.Individuum) + Private Sub SekundärQb_Allocation(ByVal NDSResult() As Individuum, ByRef SekundärQb() As Individuum) Dim i, NFrontMember_aktuell, NMember_SekPop As Integer @@ -421,48 +421,48 @@ Public Class Functions NFrontMember_aktuell = Pareto_Count_Front_Members(1, NDSResult) 'Aktuelle Anzahl Mitglieder in SekPop bestimmen - NMember_SekPop = SekundärQb.GetLength(0) + NMember_SekPop = SekundärQb.GetLength(0) 'SekPop um die aktuelle Front erweitern - ReDim Preserve SekundärQb(NMember_SekPop + NFrontMember_aktuell - 1) + ReDim Preserve SekundärQb(NMember_SekPop + NFrontMember_aktuell - 1) For i = NMember_SekPop To NMember_SekPop + NFrontMember_aktuell - 1 - SekundärQb(i) = NDSResult(i - NMember_SekPop) + SekundärQb(i) = NDSResult(i - NMember_SekPop) Next i - 'SekPop neu sortieren und hinteren Ränge entfernen - Call Pareto_Non_Dominated_Sorting(SekundärQb, 1) - NFrontMember_aktuell = Pareto_Non_Dominated_Count_and_Sort(SekundärQb) - ReDim Preserve SekundärQb(NFrontMember_aktuell - 1) + 'SekPop neu sortieren und hinteren Ränge entfernen + Call Pareto_Non_Dominated_Sorting(SekundärQb, 1) + NFrontMember_aktuell = Pareto_Non_Dominated_Count_and_Sort(SekundärQb) + ReDim Preserve SekundärQb(NFrontMember_aktuell - 1) 'Dubletten aus SekPop entfernen - Call SekundärQb_Dubletten(SekundärQb) - NFrontMember_aktuell = Pareto_Non_Dominated_Count_and_Sort(SekundärQb) - ReDim Preserve SekundärQb(NFrontMember_aktuell - 1) + Call SekundärQb_Dubletten(SekundärQb) + NFrontMember_aktuell = Pareto_Non_Dominated_Count_and_Sort(SekundärQb) + ReDim Preserve SekundärQb(NFrontMember_aktuell - 1) 'SekPop ggf. auf Maximalanzahl Mitglieder begrenzen (mit Crowding Distance) - If (Me.isSekPopBegrenzung And SekundärQb.GetLength(0) > Me.NMaxMemberSekPop) Then - Call Pareto_Crowding_Distance_Sort(SekundärQb, 0, SekundärQb.GetUpperBound(0)) - ReDim Preserve SekundärQb(Me.NMaxMemberSekPop - 1) + If (Me.isSekPopBegrenzung And SekundärQb.GetLength(0) > Me.NMaxMemberSekPop) Then + Call Pareto_Crowding_Distance_Sort(SekundärQb, 0, SekundärQb.GetUpperBound(0)) + ReDim Preserve SekundärQb(Me.NMaxMemberSekPop - 1) End If End Sub 'Individuen mit identischen Penalties als dominiert markieren '************************************************************ - Private Sub SekundärQb_Dubletten(ByRef SekundärQb() As Common.Individuum) + Private Sub SekundärQb_Dubletten(ByRef SekundärQb() As Individuum) Dim i, j, k As Integer Dim Logical As Boolean - For i = 0 To SekundärQb.GetUpperBound(0) - 1 - For j = i + 1 To SekundärQb.GetUpperBound(0) + For i = 0 To SekundärQb.GetUpperBound(0) - 1 + For j = i + 1 To SekundärQb.GetUpperBound(0) Logical = True For k = 0 To Me.mProblem.NumPrimObjective - 1 - Logical = Logical And (SekundärQb(i).PrimObjectives(k) = SekundärQb(j).PrimObjectives(k)) + Logical = Logical And (SekundärQb(i).PrimObjectives(k) = SekundärQb(j).PrimObjectives(k)) Next k If (Logical) Then 'Duplikat gefunden: als dominiert markieren - SekundärQb(i).dominated = True + SekundärQb(i).Dominated = True End If Next j Next i diff --git a/BlueM.Opt/Algos/ES/PES.vb b/BlueM.Opt/Algos/ES/PES.vb index 194a8a21..9cb9395f 100644 --- a/BlueM.Opt/Algos/ES/PES.vb +++ b/BlueM.Opt/Algos/ES/PES.vb @@ -20,7 +20,7 @@ Imports BlueM.Opt.Common ''' ''' Klasse PES (Parametric Evolution Strategy) ''' Modifizierte Evolutionsstrategie nach Rechenberg und Schwefel -''' Klasse enthält alle Funktionen und Methoden zur Anwendung der Evolutionsstrategie +''' Klasse enthält alle Funktionen und Methoden zur Anwendung der Evolutionsstrategie ''' Literatur: ''' 1) Rechenberg, Ingo, Evolutionsstrategie '94, Fromman-Holzboog, 1994 ''' 2) Schwefel, Hans-Paul, Evolution and Optimum Seeking, Wiley, 1995 @@ -39,12 +39,12 @@ Public Class PES Private AktPara() As OptParameter 'Diese Struktur speichert den aktuellen Zustand - 'ToDo: Könnte man auch entfernen wenn man die Schleifenkontrolle ins Form legt + 'ToDo: Könnte man auch entfernen wenn man die Schleifenkontrolle ins Form legt Public Structure Struct_iAkt - Dim iAktRunde As Integer 'Zähler für aktuelle Runde - Dim iAktPop As Integer 'Zähler für aktuelle Population - Dim iAktGen As Integer 'Zähler für aktuelle Generation - Dim iAktNachf As Integer 'Zähler für aktuellen Nachfahren + Dim iAktRunde As Integer 'Zähler für aktuelle Runde + Dim iAktPop As Integer 'Zähler für aktuelle Population + Dim iAktGen As Integer 'Zähler für aktuelle Generation + Dim iAktNachf As Integer 'Zähler für aktuellen Nachfahren End Structure 'Muss Public sein, da das Form hiermit die Schleifen kontrolliert @@ -55,23 +55,23 @@ Public Class PES Private Dp(,,) As Double 'PopulationsElternschrittweite '---PopBestwerte------- - Private Xbpop(,,) As Double 'Bestwertspeicher Variablenwerte für eine Population - Private Dbpop(,,) As Double 'Bestwertspeicher Schrittweite für eine Population - Private Qbpop(,) As Double 'Bestwertspeicher für eine Population + Private Xbpop(,,) As Double 'Bestwertspeicher Variablenwerte für eine Population + Private Dbpop(,,) As Double 'Bestwertspeicher Schrittweite für eine Population + Private Qbpop(,) As Double 'Bestwertspeicher für eine Population '---Elternwerte-------- Private Xe(,,) As Double 'Elternwerte der Variablen Private De(,,) As Double 'Elternschrittweite - Private Div(,) As Double 'Diversitätsmass + Private Div(,) As Double 'Diversitätsmass Private Front(,) As Integer 'Front '---Bestwerte---------- Public Structure Bestwerte - Dim Xb(,,) As Double 'Bestwertspeicher Variablenwerte für eine Generation - Dim Db(,,) As Double 'Bestwertspeicher Schrittweite für eine Generation - Dim Qb(,,) As Double 'Bestwertspeicher für eine Generation - Dim Rb(,,) As Double 'Restriktionen für eine Generation - Dim Div(,) As Double 'Diversität der Individuen für eine Generation + Dim Xb(,,) As Double 'Bestwertspeicher Variablenwerte für eine Generation + Dim Db(,,) As Double 'Bestwertspeicher Schrittweite für eine Generation + Dim Qb(,,) As Double 'Bestwertspeicher für eine Generation + Dim Rb(,,) As Double 'Restriktionen für eine Generation + Dim Div(,) As Double 'Diversität der Individuen für eine Generation Dim Front(,) As Double 'Front der Individuen End Structure @@ -79,9 +79,9 @@ Public Class PES '---Stuff-------------- Private Distanceb() As Double 'Array mit Crowding-Distance (Neighbourhood-Rekomb.) - Private PenaltyDistance(,) As Double 'Array für normierte Raumabstände (Neighbourhood-Rekomb.) + Private PenaltyDistance(,) As Double 'Array für normierte Raumabstände (Neighbourhood-Rekomb.) '--------------------- - Public SekundärQb(-1) As Individuum 'Sekundäre Population wird mit -1 initialisiert dann länge 0 + Public SekundärQb(-1) As Individuum 'Sekundäre Population wird mit -1 initialisiert dann länge 0 Const galpha As Double = 1.3 'Faktor alpha = 1.3 auf Generationsebene nach Rechenberg Const palpha As Double = 1.1 'Faktor alpha = 1.1 auf Populationsebene nach Rechenberg @@ -121,7 +121,7 @@ Public Class PES Me.mProblem = prob 'Schritt 1: PES - SETTINGS - 'Optionen der Evolutionsstrategie werden übergeben + 'Optionen der Evolutionsstrategie werden übergeben Call PES_Form_Settings(settings) 'Schritt 2: PES - PREPARE @@ -135,20 +135,20 @@ Public Class PES End Sub 'Schritt 1: SETTINGS - 'Function ES_SETTINGS übergibt Optionen für Evolutionsstrategie und Prüft die eingestellten Optionen + 'Function ES_SETTINGS übergibt Optionen für Evolutionsstrategie und Prüft die eingestellten Optionen '*************************************************************************************************** Private Sub PES_Form_Settings(ByRef settings As Settings) - 'Überprüfung der Übergebenen Werte + 'Überprüfung der Übergebenen Werte 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - If (Not System.Enum.IsDefined(GetType(EVO_STRATEGY), settings.PES.Strategie)) Then + If (Not [Enum].IsDefined(GetType(EVO_STRATEGY), settings.PES.Strategie)) Then Throw New Exception("Invalid setting for 'Strategy'!") End If - If (Not System.Enum.IsDefined(GetType(EVO_STARTPARAMETERS), settings.PES.Startparameter)) Then + If (Not [Enum].IsDefined(GetType(EVO_STARTPARAMETERS), settings.PES.Startparameter)) Then Throw New Exception("Invalid setting for 'Start values'!") End If 'Schrittweite - If (Not System.Enum.IsDefined(GetType(PES_MUTATIONSOP), settings.PES.Mutationsop)) Then + If (Not [Enum].IsDefined(GetType(PES_MUTATIONSOP), settings.PES.Mutationsop)) Then Throw New Exception("Invalid setting for 'Mutation'!") End If If (settings.PES.SetMutation.DnStart < 0) Then @@ -168,7 +168,7 @@ Public Class PES Throw New Exception("The number of children can not be less than 1!") End If 'Eltern - If (Not System.Enum.IsDefined(GetType(PES_REPRODOP), settings.PES.Reproduktionsop)) Then + If (Not [Enum].IsDefined(GetType(PES_REPRODOP), settings.PES.Reproduktionsop)) Then Throw New Exception("Invalid setting for the determination of parents!") End If If (settings.PES.OptModus = EVO_MODE.Single_Objective And settings.PES.Reproduktionsop = PES_REPRODOP.Neighborhood) Then @@ -190,14 +190,14 @@ Public Class PES If (settings.PES.Pop.N_Popul < settings.PES.Pop.N_PopEltern) Then Throw New Exception("The number of population parents can not be larger than the number of populations!") End If - If (Not System.Enum.IsDefined(GetType(EVO_POP_ELTERN), settings.PES.Pop.PopEltern)) Then + If (Not [Enum].IsDefined(GetType(EVO_POP_ELTERN), settings.PES.Pop.PopEltern)) Then Throw New Exception("Invalid setting for the determination of population parents!") End If - If (Not System.Enum.IsDefined(GetType(EVO_STRATEGY), settings.PES.Pop.PopStrategie)) Then + If (Not [Enum].IsDefined(GetType(EVO_STRATEGY), settings.PES.Pop.PopStrategie)) Then Throw New Exception("Invalid setting for 'Selection' at the population level!") End If - 'Übergabe der Optionen + 'Übergabe der Optionen 'xxxxxxxxxxxxxxxxxxxxx Me.mSettings = settings @@ -205,15 +205,15 @@ Public Class PES End Sub 'Schritt 2: PREPARE - 'Initialisiert benötigte dynamische Arrays und legt Anzahl der Zielfunktionen fest + 'Initialisiert benötigte dynamische Arrays und legt Anzahl der Zielfunktionen fest 'Initialisiert alle internen Arrays und setzt den - 'Bestwertspeicher auf sehr großen Wert (Strategie minimiert in dieser Umsetzung) - 'TODO: ESPrepare Für Paretooptimierung noch nicht fertig!!!! + 'Bestwertspeicher auf sehr großen Wert (Strategie minimiert in dieser Umsetzung) + 'TODO: ESPrepare Für Paretooptimierung noch nicht fertig!!!! '******************************************************************************* Private Sub PES_Prepare() Dim m, n, l As Integer - 'Überprüfung der Eingabeparameter (es muss mindestens ein Parameter variiert und eine + 'Überprüfung der Eingabeparameter (es muss mindestens ein Parameter variiert und eine 'Penaltyfunktion ausgewertet werden) If (Me.mProblem.NumOptParams <= 0 Or Me.mProblem.NumPrimObjective <= 0) Then @@ -242,7 +242,7 @@ Public Class PES ReDim Best.Div(mSettings.PES.N_Eltern - 1, mSettings.PES.Pop.N_Popul - 1) ReDim Best.Front(mSettings.PES.N_Eltern - 1, mSettings.PES.Pop.N_Popul - 1) - 'NDSorting wird nur benötigt, falls eine Paretofront approximiert wird + 'NDSorting wird nur benötigt, falls eine Paretofront approximiert wird If (mSettings.PES.OptModus = EVO_MODE.Multi_Objective) Then NDSorting = Individuum.New_Indi_Array(Individuum.Individuumsklassen.Individuum_PES, mSettings.PES.N_Eltern + mSettings.PES.N_Nachf, "NDSorting") If (mSettings.PES.Reproduktionsop = PES_REPRODOP.Neighborhood) Then @@ -254,7 +254,7 @@ Public Class PES For n = 0 To mSettings.PES.N_Eltern - 1 For m = 0 To mSettings.PES.Pop.N_Popul - 1 For l = 0 To Me.mProblem.NumPrimObjective - 1 - 'Qualität der Eltern (Anzahl = parents) wird auf sehr großen Wert gesetzt + 'Qualität der Eltern (Anzahl = parents) wird auf sehr großen Wert gesetzt Best.Qb(n, m, l) = 1.0E+300 Next l If (Me.mProblem.NumConstraints > 0) Then @@ -273,11 +273,11 @@ Public Class PES Select Case mSettings.PES.Pop.PopPenalty Case EVO_POP_PENALTY.Crowding - 'Qualität der Populationseltern wird auf sehr großen Wert gesetzt + 'Qualität der Populationseltern wird auf sehr großen Wert gesetzt Qbpop(n, m) = 1.0E+300 Case EVO_POP_PENALTY.Span - 'Qualität der Populationseltern wird auf 0 gesetzt + 'Qualität der Populationseltern wird auf 0 gesetzt Qbpop(n, m) = 0 End Select Next m @@ -285,7 +285,7 @@ Public Class PES Else For n = 0 To mSettings.PES.Pop.N_Popul - 1 For m = 0 To Me.mProblem.NumPrimObjective - 1 - 'Qualität der Populationseltern wird auf sehr großen Wert gesetzt + 'Qualität der Populationseltern wird auf sehr großen Wert gesetzt Qbpop(n, m) = 1.0E+300 Next m Next n @@ -294,7 +294,7 @@ Public Class PES 'Zufallsgenerator initialisieren Randomize() - 'Informationen über aktuelle Runden übergeben + 'Informationen über aktuelle Runden übergeben PES_iAkt.iAktRunde = 0 PES_iAkt.iAktPop = 0 PES_iAkt.iAktGen = 0 @@ -302,9 +302,9 @@ Public Class PES End Sub - 'Schritt 1: Function ES_STARTVALUES setzt die Startwerte - Vorsicht: ÜBERLADEN - 'PES_Settings.iStartPar 1: Zufällige Startwert -> Schrittweite = Startschrittweite - ' -> Parameterwert = zufällig [0,1] + 'Schritt 1: Function ES_STARTVALUES setzt die Startwerte - Vorsicht: ÜBERLADEN + 'PES_Settings.iStartPar 1: Zufällige Startwert -> Schrittweite = Startschrittweite + ' -> Parameterwert = zufällig [0,1] 'PES_Settings.iStartPar 2: Originalparameter -> Schrittweite = Startschrittweite ' -> Parameterwert = Originalparameter '*********************************************************************************** @@ -318,7 +318,7 @@ Public Class PES Throw New Exception($"The start value of the optimization parameter '{Me.mProblem.List_OptParameter(i).Bezeichnung}' is not between 0 und 1. It must be scaled to this range!") End If AktPara(i) = Me.mProblem.List_OptParameter(i).Clone() - 'Startschrittweite übernehmen + 'Startschrittweite übernehmen AktPara(i).Dn = mSettings.PES.SetMutation.DnStart Next @@ -327,16 +327,16 @@ Public Class PES 'Zufallsgenerator initialisieren Randomize() - 'Die Startparameter für die Eltern werden gesetzt + 'Die Startparameter für die Eltern werden gesetzt Select Case Me.mSettings.PES.Startparameter - Case EVO_STARTPARAMETERS.Random 'Zufällige Startwerte + Case EVO_STARTPARAMETERS.Random 'Zufällige Startwerte For v = 0 To Me.mProblem.NumOptParams - 1 For n = 0 To mSettings.PES.N_Eltern - 1 For m = 0 To mSettings.PES.Pop.N_PopEltern - 1 - 'Startwert für die Elternschrittweite wird zugewiesen + 'Startwert für die Elternschrittweite wird zugewiesen Dp(v, n, m) = AktPara(0).Dn - 'Startwert für die Eltern werden zugewiesen + 'Startwert für die Eltern werden zugewiesen '(Zufallszahl zwischen 0 und 1) Xp(v, n, m) = Rnd() Next m @@ -347,9 +347,9 @@ Public Class PES For v = 0 To Me.mProblem.NumOptParams - 1 For n = 0 To mSettings.PES.N_Eltern - 1 For m = 0 To mSettings.PES.Pop.N_PopEltern - 1 - 'Startwert für die Elternschrittweite wird zugewiesen + 'Startwert für die Elternschrittweite wird zugewiesen Dp(v, n, m) = AktPara(0).Dn - 'Startwert für die Eltern werden zugewiesen + 'Startwert für die Eltern werden zugewiesen '(alle gleich Anfangswerte) Xp(v, n, m) = AktPara(v).Xn Next m @@ -359,7 +359,7 @@ Public Class PES End Sub - 'ES_GET_PARAMETER - dient zur Rückgabe der mutierten Parameter + 'ES_GET_PARAMETER - dient zur Rückgabe der mutierten Parameter '************************************************************* Public Function EsGetParameter() As OptParameter() @@ -391,11 +391,11 @@ Public Class PES Public Sub EsPopReproduktion() Dim m, n, v As Integer - Dim R As Integer 'Zufälliger Integer Wert + Dim R As Integer 'Zufälliger Integer Wert Select Case mSettings.PES.Pop.PopEltern - Case EVO_POP_ELTERN.Recombination 'MultiRekombination über alle Eltern (x/x,y) oder (x/x+y) + Case EVO_POP_ELTERN.Recombination 'MultiRekombination über alle Eltern (x/x,y) oder (x/x+y) For n = 0 To mSettings.PES.N_Eltern - 1 R = Int(mSettings.PES.Pop.N_PopEltern * Rnd()) For v = 0 To Me.mProblem.NumOptParams - 1 @@ -406,8 +406,8 @@ Public Class PES Next v Next n - Case EVO_POP_ELTERN.Average 'Mittelwertbildung über alle Eltern - 'Ermitteln der Elter und Schrittweite über Mittelung der Elternschrittweiten + Case EVO_POP_ELTERN.Average 'Mittelwertbildung über alle Eltern + 'Ermitteln der Elter und Schrittweite über Mittelung der Elternschrittweiten For v = 0 To Me.mProblem.NumOptParams - 1 For n = 0 To mSettings.PES.N_Eltern - 1 De(v, n, PES_iAkt.iAktPop) = 0 @@ -421,7 +421,7 @@ Public Class PES Next n Next v - Case EVO_POP_ELTERN.Selection 'Zufallswahl über alle Eltern + Case EVO_POP_ELTERN.Selection 'Zufallswahl über alle Eltern R = Int(mSettings.PES.Pop.N_PopEltern * Rnd()) 'Zufallszahl entscheidet welcher 'Elternteil vererbt wird For v = 0 To Me.mProblem.NumOptParams - 1 @@ -437,12 +437,12 @@ Public Class PES End Sub - 'ES_VARIA - REPRODUKTIONSPROZESS - Ermitteln der neuen Ausgangswerte für Nachkommen aus den Eltern + 'ES_VARIA - REPRODUKTIONSPROZESS - Ermitteln der neuen Ausgangswerte für Nachkommen aus den Eltern '************************************************************************************************* Public Sub EsReproduktion() Dim i, v, n, j As Integer - Dim R As Integer 'Zufälliger Integer Wert + Dim R As Integer 'Zufälliger Integer Wert Dim Realisierungsspeicher() As Integer Dim Elternspeicher() As Integer Dim Elter As Integer @@ -451,7 +451,7 @@ Public Class PES Select Case mSettings.PES.Reproduktionsop - Case PES_REPRODOP.Selection 'Zufallswahl über alle Eltern + Case PES_REPRODOP.Selection 'Zufallswahl über alle Eltern R = Int(mSettings.PES.N_Eltern * Rnd()) 'Zufallszahl entscheidet 'welcher Enternteil vererbt wird @@ -501,9 +501,9 @@ Public Class PES Case PES_REPRODOP.XY_Discrete 'Multi-Rekombination nach X/Y-Schema, diskrete Vertauschung 'Realisierungsspeicher und Elternspeicher initialisieren - 'Anzahl der benötigten Eltern (Y) + 'Anzahl der benötigten Eltern (Y) ReDim Realisierungsspeicher(mSettings.PES.N_RekombXY - 1) - 'Anzahl der Verfügbaren Eltern (n_Eltern) + 'Anzahl der Verfügbaren Eltern (n_Eltern) ReDim Elternspeicher(mSettings.PES.N_Eltern - 1) 'Setzen der Eltern Indizes For i = 0 To (mSettings.PES.N_Eltern - 1) @@ -512,7 +512,7 @@ Public Class PES 'Auswahl der Y-Eltern For i = 0 To mSettings.PES.N_RekombXY - 1 '1. Runde erlaubt Auswahl aus allen Eltern - '2. Runde hat nur noch n_Eltern - 1 zur Verfügung + '2. Runde hat nur noch n_Eltern - 1 zur Verfügung 'usw. 'Kein Elter darf doppelt gezogen werden If (mSettings.PES.Is_DiversityTournament) Then @@ -565,9 +565,9 @@ Public Class PES Case PES_REPRODOP.XY_Average 'Multi-Rekombination nach X/Y-Schema, Mittelung der Gene 'Realisierungsspeicher und Elternspeicher initialisieren - 'Anzahl der benötigten Eltern (Y) + 'Anzahl der benötigten Eltern (Y) ReDim Realisierungsspeicher(mSettings.PES.N_RekombXY - 1) - 'Anzahl der Verfügbaren Eltern (n_Eltern) + 'Anzahl der Verfügbaren Eltern (n_Eltern) ReDim Elternspeicher(mSettings.PES.N_Eltern - 1) 'Setzen der Eltern Indizes For i = 0 To (mSettings.PES.N_Eltern - 1) @@ -576,7 +576,7 @@ Public Class PES 'Auswahl der Y-Eltern For i = 0 To mSettings.PES.N_RekombXY - 1 '1. Runde erlaubt Auswahl aus allen Eltern - '2. Runde hat nur noch n_Eltern - 1 zur Verfügung + '2. Runde hat nur noch n_Eltern - 1 zur Verfügung 'usw. 'Kein Elter darf doppelt gezogen werden If (mSettings.PES.Is_DiversityTournament) Then @@ -631,9 +631,9 @@ Public Class PES Case PES_REPRODOP.XY_Average_Discrete 'Realisierungsspeicher und Elternspeicher initialisieren - 'Anzahl der benötigten Eltern (Y) + 'Anzahl der benötigten Eltern (Y) ReDim Realisierungsspeicher(mSettings.PES.N_RekombXY - 1) - 'Anzahl der Verfügbaren Eltern (n_Eltern) + 'Anzahl der Verfügbaren Eltern (n_Eltern) ReDim Elternspeicher(mSettings.PES.N_Eltern - 1) 'Setzen der Eltern Indizes For i = 0 To (mSettings.PES.N_Eltern - 1) @@ -642,7 +642,7 @@ Public Class PES 'Auswahl der Y-Eltern For i = 0 To mSettings.PES.N_RekombXY - 1 '1. Runde erlaubt Auswahl aus allen Eltern - '2. Runde hat nur noch n_Eltern - 1 zur Verfügung + '2. Runde hat nur noch n_Eltern - 1 zur Verfügung 'usw. 'Kein Elter darf doppelt gezogen werden If (mSettings.PES.Is_DiversityTournament) Then @@ -703,14 +703,14 @@ Public Class PES ' Z2 = Int(Settings.PES.n_Eltern * Rnd()) 'Loop While Z1 = Z2 - ''Tournament über Crowding Distance + ''Tournament über Crowding Distance 'If Distanceb(Z1) > Distanceb(Z2) Then ' Elter = Z1 'Else ' Elter = Z2 'End If - 'Anzahl der Verfügbaren Eltern (n_Eltern) + 'Anzahl der Verfügbaren Eltern (n_Eltern) ReDim Elternspeicher(mSettings.PES.N_Eltern - 1) 'Setzen der Eltern Indizes For i = 0 To (mSettings.PES.N_Eltern - 1) @@ -788,9 +788,9 @@ Public Class PES Public Sub EsPopMutation() Dim i, v, n As Integer - Dim DeTemp(,,) As Double 'Temporäre Schrittweiten für Eltern - Dim XeTemp(,,) As Double 'Temporäre Parameterwerte für Eltern - Dim expo As Integer 'Exponent für Schrittweite (+/-1) + Dim DeTemp(,,) As Double 'Temporäre Schrittweiten für Eltern + Dim XeTemp(,,) As Double 'Temporäre Parameterwerte für Eltern + Dim expo As Integer 'Exponent für Schrittweite (+/-1) ReDim DeTemp(Me.mProblem.NumOptParams - 1, mSettings.PES.N_Eltern - 1, mSettings.PES.Pop.N_Popul - 1) ReDim XeTemp(Me.mProblem.NumOptParams - 1, mSettings.PES.N_Eltern - 1, mSettings.PES.Pop.N_Popul - 1) @@ -802,7 +802,7 @@ Public Class PES expo = (2 * Int(Rnd() + 0.5) - 1) 'Schrittweite wird mutiert DeTemp(0, 0, PES_iAkt.iAktPop) = De(0, 0, PES_iAkt.iAktPop) * palpha ^ expo - 'Schrittweite für alle übernehmen + 'Schrittweite für alle übernehmen For n = 0 To mSettings.PES.N_Eltern - 1 For v = 0 To Me.mProblem.NumOptParams - 1 DeTemp(v, n, PES_iAkt.iAktPop) = DeTemp(0, 0, PES_iAkt.iAktPop) @@ -817,13 +817,13 @@ Public Class PES i = 0 Do i += 1 - 'Abbruchkriterium für abhängige Parameter + 'Abbruchkriterium für abhängige Parameter '---------------------------------------- If (i >= 1000) Then - 'Es konnte kein gültiger Parametersatz generiert werden! - 'Vermutlich ist die aktuelle Schrittweite nicht groß genug. + 'Es konnte kein gültiger Parametersatz generiert werden! + 'Vermutlich ist die aktuelle Schrittweite nicht groß genug. 'Elterwert des aktuellen Parameters auf aktuellen Wert - 'des Parameters setzen, von dem der aktuelle Parameter abhängig ist + 'des Parameters setzen, von dem der aktuelle Parameter abhängig ist Xe(v, n, PES_iAkt.iAktPop) = XeTemp(v - 1, n, PES_iAkt.iAktPop) i = 0 End If @@ -839,23 +839,23 @@ Public Class PES 'Normalverteilte Zufallszahl mit Standardabweichung 1/sqr(varanz) Dim Z As Double - Z = System.Math.Sqrt(-2 * System.Math.Log(1 - Rnd()) / Me.mProblem.NumOptParams) * System.Math.Sin(6.2832 * Rnd()) - 'Mutation wird durchgeführt + Z = Math.Sqrt(-2 * Math.Log(1 - Rnd()) / Me.mProblem.NumOptParams) * Math.Sin(6.2832 * Rnd()) + 'Mutation wird durchgeführt XeTemp(v, n, PES_iAkt.iAktPop) = Xe(v, n, PES_iAkt.iAktPop) + DeTemp(v, n, PES_iAkt.iAktPop) * Z - ' Restriktion für die mutierten Werte + ' Restriktion für die mutierten Werte Loop While (XeTemp(v, n, PES_iAkt.iAktPop) < 0 Or XeTemp(v, n, PES_iAkt.iAktPop) > 1 Or Not checkBeziehungPop(v, n, XeTemp)) Next v - 'Mutierte Werte übernehmen + 'Mutierte Werte übernehmen '------------------------- For v = 0 To Me.mProblem.NumOptParams - 1 De(v, n, PES_iAkt.iAktPop) = DeTemp(v, n, PES_iAkt.iAktPop) Xe(v, n, PES_iAkt.iAktPop) = XeTemp(v, n, PES_iAkt.iAktPop) Next v - Div(n, PES_iAkt.iAktPop) = 0 'Diversität wird erst nach der ersten Generation bestimmt + Div(n, PES_iAkt.iAktPop) = 0 'Diversität wird erst nach der ersten Generation bestimmt Next n @@ -868,10 +868,10 @@ Public Class PES Dim v, i As Integer 'Allgemeine Variablen - Dim XnTemp() As Double 'Temporäre Parameterwerte für Nachkomme - Dim DnTemp() As Double 'Temporäre Schrittweiten für Nachkomme - Dim CTemp() As Double 'Temporäres Schiefemaß für Nachkomme - Dim expo As Integer 'Exponent für Schrittweite (+/-1) + Dim XnTemp() As Double 'Temporäre Parameterwerte für Nachkomme + Dim DnTemp() As Double 'Temporäre Schrittweiten für Nachkomme + Dim CTemp() As Double 'Temporäres Schiefemaß für Nachkomme + Dim expo As Integer 'Exponent für Schrittweite (+/-1) ReDim XnTemp(Me.mProblem.NumOptParams - 1) ReDim DnTemp(Me.mProblem.NumOptParams - 1) @@ -893,16 +893,16 @@ Public Class PES DnTemp(0) = AktPara(0).Dn * galpha ^ expo End If - 'Über alle Parameter + 'Über alle Parameter For v = 0 To Me.mProblem.NumOptParams - 1 i = 0 Do i += 1 - 'Abbruchkriterium für abhängige Parameter + 'Abbruchkriterium für abhängige Parameter '---------------------------------------- If (i >= 1000) Then - 'Es konnte kein gültiger Parametersatz generiert werden! Vermutlich ist die aktuelle Schrittweite nicht groß genug. - 'Elterwert des aktuellen Parameters auf aktuellen Wert des Parameters setzen, von dem der aktuelle Parameter abhängig ist + 'Es konnte kein gültiger Parametersatz generiert werden! Vermutlich ist die aktuelle Schrittweite nicht groß genug. + 'Elterwert des aktuellen Parameters auf aktuellen Wert des Parameters setzen, von dem der aktuelle Parameter abhängig ist i = 0 AktPara(v).Xn = XnTemp(v - 1) End If @@ -919,14 +919,14 @@ Public Class PES End If 'Normalverteilte Zufallszahl mit Standardabweichung 1/sqr(varanz) - 'Z = System.Math.Sqrt(-2 * System.Math.Log(1 - Rnd()) / Me.mProblem.NumParams) * System.Math.Sin(6.2832 * Rnd()) + 'Z = Math.Sqrt(-2 * Math.Log(1 - Rnd()) / Me.mProblem.NumParams) * Math.Sin(6.2832 * Rnd()) 'Normalverteilte Zufallszahl mit Standardabweichung 1/sqr(var.anz), , Mittelwert 0 Z = Me.NormalDistributationRND(1 / Math.Sqrt(Me.mProblem.NumOptParams), 0.0) - 'Mutation wird durchgeführt + 'Mutation wird durchgeführt '************************** XnTemp(v) = AktPara(v).Xn + DnTemp(v) * Z - 'Restriktion für die mutierten Werte + 'Restriktion für die mutierten Werte Loop While (XnTemp(v) < 0 Or XnTemp(v) > 1 Or Not checkBeziehung(v, XnTemp)) Next v @@ -954,17 +954,17 @@ Public Class PES ZFix = Me.NormalDistributationRND(1.0, 0.0) End If - 'Über alle Parameter + 'Über alle Parameter '******************* For v = 0 To Me.mProblem.NumOptParams - 1 i = 0 Do i += 1 - 'Abbruchkriterium für abhängige Parameter + 'Abbruchkriterium für abhängige Parameter '---------------------------------------- If (i >= 1000) Then - 'Es konnte kein gültiger Parametersatz generiert werden! Vermutlich ist die aktuelle Schrittweite nicht groß genug. - 'Elterwert des aktuellen Parameters auf aktuellen Wert des Parameters setzen, von dem der aktuelle Parameter abhängig ist + 'Es konnte kein gültiger Parametersatz generiert werden! Vermutlich ist die aktuelle Schrittweite nicht groß genug. + 'Elterwert des aktuellen Parameters auf aktuellen Wert des Parameters setzen, von dem der aktuelle Parameter abhängig ist i = 0 AktPara(v).Xn = XnTemp(v - 1) End If @@ -984,21 +984,21 @@ Public Class PES End If 'Normalverteilte Zufallszahl mit Standardabweichung 1/sqr(varanz) - 'Z = System.Math.Sqrt(-2 * System.Math.Log(1 - Rnd()) / Me.mProblem.NumParams) * System.Math.Sin(6.2832 * Rnd()) + 'Z = Math.Sqrt(-2 * Math.Log(1 - Rnd()) / Me.mProblem.NumParams) * Math.Sin(6.2832 * Rnd()) 'Normalverteilte Zufallszahl mit Standardabweichung 1, Mittelwert 0 Z = Me.NormalDistributationRND(1.0, 0.0) - 'Mutation wird durchgeführt + 'Mutation wird durchgeführt '************************** XnTemp(v) = AktPara(v).Xn + DnTemp(v) * Z - 'Restriktion für die mutierten Werte + 'Restriktion für die mutierten Werte Loop While (XnTemp(v) < 0 Or XnTemp(v) > 1 Or Not checkBeziehung(v, XnTemp)) Next v End Select - 'Mutierte Werte übernehmen + 'Mutierte Werte übernehmen '------------------------- For v = 0 To Me.mProblem.NumOptParams - 1 AktPara(v).Dn = DnTemp(v) @@ -1007,7 +1007,7 @@ Public Class PES End Sub - 'normalverteilte Zufallszahl für Schwefelmutation + 'normalverteilte Zufallszahl für Schwefelmutation '************************************************ Public Function NormalDistributationRND(ByVal sd As Double, ByVal mean As Double) As Double Dim fac As Double @@ -1026,15 +1026,15 @@ Public Class PES Return gauss End Function - 'ES_POP_BEST - Einordnen der Qualitätsfunktion im PopulationsBestwertspeicher + 'ES_POP_BEST - Einordnen der Qualitätsfunktion im PopulationsBestwertspeicher '**************************************************************************** Public Sub EsPopBest() Dim m, i, j, n As Integer Dim h1, h2 As Double - 'Der schlechtetste der besten Qualitätswerte wird bestimmt ; Position -> i - '(höchster Wert der Penaltyfunktion, niedrigster Wert der Crowding Distance) + 'Der schlechtetste der besten Qualitätswerte wird bestimmt ; Position -> i + '(höchster Wert der Penaltyfunktion, niedrigster Wert der Crowding Distance) i = 0 h1 = Qbpop(0, 0) For m = 1 To mSettings.PES.Pop.N_Popul - 1 @@ -1061,8 +1061,8 @@ Public Class PES End If Next m - 'Der schlechtetste der besten Qualitätswerte wird bestimmt ; Position -> i - '(höchster Wert der Kostenfunktion, niedrigster Wert der Spannweite) + 'Der schlechtetste der besten Qualitätswerte wird bestimmt ; Position -> i + '(höchster Wert der Kostenfunktion, niedrigster Wert der Spannweite) If (mSettings.PES.OptModus = EVO_MODE.Multi_Objective) Then j = 0 h2 = Qbpop(0, 1) @@ -1074,7 +1074,7 @@ Public Class PES Next m End If - 'Qualität der aktuellen Population wird bestimmt + 'Qualität der aktuellen Population wird bestimmt h1 = 0 If (mSettings.PES.OptModus = EVO_MODE.Single_Objective) Then For m = 0 To mSettings.PES.N_Eltern - 1 @@ -1085,16 +1085,16 @@ Public Class PES h1 = NDS_Crowding_Distance_Count(h2) End If - 'Falls die Qualität des aktuellen Population besser ist (Penaltyfunktion geringer) + 'Falls die Qualität des aktuellen Population besser ist (Penaltyfunktion geringer) 'als die schlechteste im Bestwertspeicher, wird diese ersetzt If (mSettings.PES.OptModus = EVO_MODE.Single_Objective) Then If h1 < Qbpop(i, 0) Then Qbpop(i, 0) = h1 For m = 0 To Me.mProblem.NumOptParams - 1 For n = 0 To mSettings.PES.N_Eltern - 1 - 'Die Schrittweite wird ebenfalls übernommen + 'Die Schrittweite wird ebenfalls übernommen Dbpop(m, n, i) = Best.Db(m, n, PES_iAkt.iAktPop) - 'Die eigentlichen Parameterwerte werden übernommen + 'Die eigentlichen Parameterwerte werden übernommen Xbpop(m, n, i) = Best.Xb(m, n, PES_iAkt.iAktPop) Next n Next m @@ -1107,9 +1107,9 @@ Public Class PES Qbpop(i, 0) = h1 For m = 0 To Me.mProblem.NumOptParams - 1 For n = 0 To mSettings.PES.N_Eltern - 1 - 'Die Schrittweite wird ebenfalls übernommen + 'Die Schrittweite wird ebenfalls übernommen Dbpop(m, n, i) = Best.Db(m, n, PES_iAkt.iAktPop) - 'Die eigentlichen Parameterwerte werden übernommen + 'Die eigentlichen Parameterwerte werden übernommen Xbpop(m, n, i) = Best.Xb(m, n, PES_iAkt.iAktPop) Next n Next m @@ -1120,9 +1120,9 @@ Public Class PES Qbpop(j, 1) = h2 For m = 0 To Me.mProblem.NumOptParams - 1 For n = 0 To mSettings.PES.N_Eltern - 1 - 'Die Schrittweite wird ebenfalls übernommen + 'Die Schrittweite wird ebenfalls übernommen Dbpop(m, n, j) = Best.Db(m, n, PES_iAkt.iAktPop) - 'Die eigentlichen Parameterwerte werden übernommen + 'Die eigentlichen Parameterwerte werden übernommen Xbpop(m, n, j) = Best.Xb(m, n, PES_iAkt.iAktPop) Next n Next m @@ -1132,7 +1132,7 @@ Public Class PES End Sub - 'ES_BEST - Einordnen der Qualitätsfunktion im Bestwertspeicher + 'ES_BEST - Einordnen der Qualitätsfunktion im Bestwertspeicher '************************************************************* Public Sub EsBest(ByVal Ind As Individuum) @@ -1142,8 +1142,8 @@ Public Class PES If (mSettings.PES.OptModus = EVO_MODE.Single_Objective) Then 'SO - Standard ES nach Rechenberg '-------------------------------- - 'Der schlechteste der besten Qualitätswerte wird bestimmt ; Position -> j - '(höchster Wert der Penaltyfunktion) + 'Der schlechteste der besten Qualitätswerte wird bestimmt ; Position -> j + '(höchster Wert der Penaltyfunktion) j = 0 h = Best.Qb(0, PES_iAkt.iAktPop, 0) @@ -1154,14 +1154,14 @@ Public Class PES End If Next m - 'Falls die Qualität des aktuellen Nachkommen besser ist (Penaltyfunktion geringer) + 'Falls die Qualität des aktuellen Nachkommen besser ist (Penaltyfunktion geringer) 'als die schlechteste im Bestwertspeicher, wird dieser ersetzt If Ind.PrimObjectives(0) < Best.Qb(j, PES_iAkt.iAktPop, 0) Then Best.Qb(j, PES_iAkt.iAktPop, 0) = Ind.PrimObjectives(0) For v = 0 To Me.mProblem.NumOptParams - 1 - 'Die Schrittweite wird ebenfalls übernommen + 'Die Schrittweite wird ebenfalls übernommen Best.Db(v, j, PES_iAkt.iAktPop) = Ind.OptParameter(v).Dn - 'Die eigentlichen Parameterwerte werden übernommen + 'Die eigentlichen Parameterwerte werden übernommen Best.Xb(v, j, PES_iAkt.iAktPop) = Ind.OptParameter(v).Xn Next v End If @@ -1178,7 +1178,7 @@ Public Class PES End Sub 'ES_BESTWERTSPEICHER - 'Führt einen Reset des Bestwertspeicher durch, falls eine Komma-Strategie gewählt ist + 'Führt einen Reset des Bestwertspeicher durch, falls eine Komma-Strategie gewählt ist '************************************************************************************ Public Sub EsResetBWSpeicher() Dim n, i As Integer @@ -1194,7 +1194,7 @@ Public Class PES End Sub 'ES_POP_BESTWERTSPEICHER - 'Führt einen Reset des Bestwertspeicher auf Populationsebene durch, falls eine Komma-Strategie gewählt ist + 'Führt einen Reset des Bestwertspeicher auf Populationsebene durch, falls eine Komma-Strategie gewählt ist '********************************************************************************************************* Public Sub EsResetPopBWSpeicher() Dim n, i As Integer @@ -1227,7 +1227,7 @@ Public Class PES ReDim Realisierungsspeicher(mSettings.PES.Pop.N_Popul - 1, 1) - 'Die NPopEltern besten Individium-Sätze werden ermittelt + 'Die NPopEltern besten Individium-Sätze werden ermittelt For m = 0 To mSettings.PES.Pop.N_Popul - 1 Realisierungsspeicher(m, 0) = Qbpop(m, Z) Realisierungsspeicher(m, 1) = m @@ -1318,7 +1318,7 @@ Public Class PES 'Multi-Objective Pareto 'xxxxxxxxxxxxxxxxxxxxxx '1. Eltern und Nachfolger werden gemeinsam betrachtet - 'Nur Eltern werden NDSorting hinzugefügt, Kinder sind schon oben drin + 'Nur Eltern werden NDSorting hinzugefügt, Kinder sind schon oben drin '-------------------------------------------------------------------- For i = mSettings.PES.N_Nachf To mSettings.PES.N_Nachf + mSettings.PES.N_Eltern - 1 Call Copy_Bestwert_to_Individuum(i, i - mSettings.PES.N_Nachf, INDSorting) @@ -1334,18 +1334,18 @@ Public Class PES Next '--------------------------------- '2. Die einzelnen Fronten werden bestimmt - '3. Der Bestwertspeicher wird entsprechend der Fronten oder der sekundären Population gefüllt - '4: Sekundäre Population wird bestimmt und gespeichert + '3. Der Bestwertspeicher wird entsprechend der Fronten oder der sekundären Population gefüllt + '4: Sekundäre Population wird bestimmt und gespeichert '-------------------------------- Dim Func1 As ES.Functions = New ES.Functions(Me.mProblem, Me.mSettings.PES.N_Nachf, Me.mSettings.PES.N_Eltern, Me.mSettings.PES.SekPop.Is_Begrenzung, Me.mSettings.PES.SekPop.N_MaxMembers, Me.mSettings.PES.SekPop.N_Interact, Me.mSettings.PES.SekPop.Is_Interact, PES_iAkt.iAktGen) - Call Func1.EsEltern_Pareto(NDSorting, SekundärQb, Best_Indi) + Call Func1.EsEltern_Pareto(NDSorting, SekundärQb, Best_Indi) 'Bestimmen der Crowding Distance falls Diversity-Tournament '---------------------------------------------------------- If (mSettings.PES.Is_DiversityTournament) Then Call Func1.Pareto_Crowding_Distance(Best_Indi) End If - 'Am ende die Bestwerte wieder zurück + 'Am ende die Bestwerte wieder zurück For i = 0 To Best.Qb.GetUpperBound(0) Call Copy_Individuum_to_Bestwert(i, Best_Indi) Next @@ -1364,7 +1364,7 @@ Public Class PES End If Next i - '6: Sortierung der Lösungen ist nur für Neighbourhood-Rekombination notwendig + '6: Sortierung der Lösungen ist nur für Neighbourhood-Rekombination notwendig '---------------------------------------------------------------------------- If (mSettings.PES.Reproduktionsop = PES_REPRODOP.Neighborhood) Then Call Neighbourhood_AbstandsArray() @@ -1454,7 +1454,7 @@ Public Class PES ReDim PenaltyDistance(mSettings.PES.N_Eltern - 1, mSettings.PES.N_Eltern - 1) ReDim d(mSettings.PES.N_Eltern - 1) - 'Bestimmen der normierten Raumabstände zwischen allen Elternindividuen + 'Bestimmen der normierten Raumabstände zwischen allen Elternindividuen For i = 0 To mSettings.PES.N_Eltern - 1 PenaltyDistance(i, i) = 0 For j = i + 1 To mSettings.PES.N_Eltern - 1 @@ -1464,7 +1464,7 @@ Public Class PES TempDistance(k) = TempDistance(k) * TempDistance(k) PenaltyDistance(i, j) += TempDistance(k) Next k - PenaltyDistance(i, j) = System.Math.Sqrt(PenaltyDistance(i, j)) + PenaltyDistance(i, j) = Math.Sqrt(PenaltyDistance(i, j)) PenaltyDistance(j, i) = PenaltyDistance(i, j) Next j Next i @@ -1490,7 +1490,7 @@ Public Class PES Next i NDS_Crowding_Distance_Count = NDS_Crowding_Distance_Count / mSettings.PES.N_Eltern - NDS_Crowding_Distance_Count = System.Math.Sqrt(NDS_Crowding_Distance_Count) + NDS_Crowding_Distance_Count = Math.Sqrt(NDS_Crowding_Distance_Count) Spannweite = 0 For i = 0 To mSettings.PES.N_Eltern - 1 @@ -1502,7 +1502,7 @@ Public Class PES End Function - 'Neighbourhood_AbstandsArray - Bestimme Array der Raumabstände für Neighbourhood-Rekombination + 'Neighbourhood_AbstandsArray - Bestimme Array der Raumabstände für Neighbourhood-Rekombination '********************************************************************************************* Private Sub Neighbourhood_AbstandsArray() @@ -1513,7 +1513,7 @@ Public Class PES Dim Min, Max As Double Dim TempDistance() As Double - 'Bestimmen des Normierungsfaktors für jede Dimension des Lösungsraums (MinMax) + 'Bestimmen des Normierungsfaktors für jede Dimension des Lösungsraums (MinMax) ReDim MinMax(Me.mProblem.NumPrimObjective - 1) For k = 0 To Me.mProblem.NumPrimObjective - 1 MinMax(k) = 0 @@ -1526,7 +1526,7 @@ Public Class PES MinMax(k) = Max - Min Next k - 'Bestimmen der normierten Raumabstände zwischen allen Elternindividuen + 'Bestimmen der normierten Raumabstände zwischen allen Elternindividuen ReDim TempDistance(Me.mProblem.NumPrimObjective) For i = 0 To mSettings.PES.N_Eltern - 1 @@ -1539,8 +1539,8 @@ Public Class PES TempDistance(k) = TempDistance(k) * TempDistance(k) PenaltyDistance(i, j) = PenaltyDistance(i, j) + TempDistance(k) Next k - PenaltyDistance(i, j) = System.Math.Sqrt(PenaltyDistance(i, j)) - 'Die obere Diagonale wird eigentlich nicht benötigt - dient nur der Sicherheit, falls Indizes vertauscht werden!!! + PenaltyDistance(i, j) = Math.Sqrt(PenaltyDistance(i, j)) + 'Die obere Diagonale wird eigentlich nicht benötigt - dient nur der Sicherheit, falls Indizes vertauscht werden!!! PenaltyDistance(j, i) = PenaltyDistance(i, j) Next j Next i @@ -1548,7 +1548,7 @@ Public Class PES End Sub 'Neighbourhood_Eltern - 'Bestimme die NAnzahlEltern mit geringsten Raumabständen für Neighbourhood-Rekombination + 'Bestimme die NAnzahlEltern mit geringsten Raumabständen für Neighbourhood-Rekombination '*************************************************************************************** Private Sub Neighbourhood_Eltern(ByVal IndexElter As Integer, ByRef IndexEltern() As Integer) @@ -1586,7 +1586,7 @@ Public Class PES End Sub 'Neighbourhood_Crowding_Distance - 'Bestimme die NAnzahlEltern mit geringsten Raumabständen für Neighbourhood-Rekombination + 'Bestimme die NAnzahlEltern mit geringsten Raumabständen für Neighbourhood-Rekombination '*************************************************************************************** Private Sub Neighbourhood_Crowding_Distance() @@ -1628,12 +1628,12 @@ Public Class PES End Sub - 'Einen Parameterwert auf Einhaltung der Beziehung überprüfen + 'Einen Parameterwert auf Einhaltung der Beziehung überprüfen '*********************************************************** Private Function checkBeziehung(ByVal ipara As Integer, ByVal XnTemp() As Double) As Boolean - 'ipara ist der Index des zu überprüfenden Parameters, - 'XnTemp() die zu prüfenden (skalierten) Werte + 'ipara ist der Index des zu überprüfenden Parameters, + 'XnTemp() die zu prüfenden (skalierten) Werte Dim isOK As Boolean = False If (AktPara(ipara).Beziehung = Relationship.none) Then @@ -1659,11 +1659,11 @@ Public Class PES End Function - 'Einen Parameterwert auf Einhaltung der Beziehung überprüfen (Populationsebene) + 'Einen Parameterwert auf Einhaltung der Beziehung überprüfen (Populationsebene) '****************************************************************************** Private Function checkBeziehungPop(ByVal ipara As Integer, ByVal iElter As Integer, ByVal XeTemp(,,) As Double) As Boolean - 'ipara ist der Index des zu überprüfenden Parameters, + 'ipara ist der Index des zu überprüfenden Parameters, 'iElter der Index des Elters, 'XeTemp die aktuellen Werte diff --git a/BlueM.Opt/Algos/HookeAndJeeves/HJController.vb b/BlueM.Opt/Algos/HookeAndJeeves/HJController.vb index a6f775a0..75a41b94 100644 --- a/BlueM.Opt/Algos/HookeAndJeeves/HJController.vb +++ b/BlueM.Opt/Algos/HookeAndJeeves/HJController.vb @@ -15,13 +15,13 @@ 'You should have received a copy of the GNU General Public License 'along with this program. If not, see . ' -Imports BlueM.Opt.Common.Constants +Imports BlueM.Opt.Common ''' ''' Controller für Hooke And Jeeves ''' Public Class HJController - Implements BlueM.Opt.Algos.IController + Implements Algos.IController ''' ''' Multithreading Support @@ -32,14 +32,14 @@ Public Class HJController End Get End Property - Private myProblem As BlueM.Opt.Common.Problem - Private mySettings As BlueM.Opt.Common.Settings - Private myProgress As BlueM.Opt.Common.Progress 'TODO: Verlaufsanzeige für H&J - Private myHauptDiagramm As BlueM.Opt.Diagramm.Hauptdiagramm + Private myProblem As Problem + Private mySettings As Settings + Private myProgress As Progress 'TODO: Verlaufsanzeige für H&J + Private myHauptDiagramm As Diagramm.Hauptdiagramm - Private myAppType As BlueM.Opt.Common.ApplicationTypes - Private WithEvents Sim1 As BlueM.Opt.Apps.Sim - Private Testprobleme1 As BlueM.Opt.Apps.Testprobleme + Private myAppType As ApplicationTypes + Private WithEvents Sim1 As Apps.Sim + Private Testprobleme1 As Apps.Testprobleme Private stopped As Boolean @@ -52,9 +52,9 @@ Public Class HJController ''' ''' ''' - Public Sub Init(ByRef inputProblem As Common.Problem, - ByRef inputSettings As Common.Settings, - ByRef inputProgress As Common.Progress, + Public Sub Init(ByRef inputProblem As Problem, + ByRef inputSettings As Settings, + ByRef inputProgress As Progress, ByRef inputHptDiagramm As Diagramm.Hauptdiagramm) Implements IController.Init Me.myProblem = inputProblem @@ -68,7 +68,7 @@ Public Class HJController ''' Initialisiert den Controller für Sim-Anwendungen ''' ''' die Simulationsanwendung - Public Sub InitApp(ByRef inputSim As BlueM.Opt.Apps.Sim) Implements IController.InitApp + Public Sub InitApp(ByRef inputSim As Apps.Sim) Implements IController.InitApp Me.myAppType = ApplicationTypes.Sim Me.Sim1 = inputSim End Sub @@ -76,7 +76,7 @@ Public Class HJController ''' ''' Initialisiert den Controller für Testprobleme ''' - Public Sub InitApp(ByRef inputTestprobleme As BlueM.Opt.Apps.Testprobleme) Implements IController.InitApp + Public Sub InitApp(ByRef inputTestprobleme As Apps.Testprobleme) Implements IController.InitApp Me.myAppType = ApplicationTypes.Testproblems Me.Testprobleme1 = inputTestprobleme End Sub @@ -91,7 +91,7 @@ Public Class HJController Dim j As Integer Dim k As Integer Dim b As Boolean - Dim ind As Common.Individuum + Dim ind As Individuum Dim QNBest() As Double Dim QBest() As Double Dim aktuellePara(Me.myProblem.NumOptParams - 1) As Double @@ -141,7 +141,7 @@ Public Class HJController 'Bestimmen der Ausgangsgüte '========================== 'Individuum instanzieren - ind = New Common.Individuum_PES("HJ", durchlauf) + ind = New Individuum_PES("HJ", durchlauf) 'OptParameter ins Individuum kopieren For i = 0 To ind.OptParameter.Length - 1 @@ -165,7 +165,7 @@ Public Class HJController Call Me.Testprobleme1.Evaluate(ind, 0, Me.myHauptDiagramm) End If - Call System.Windows.Forms.Application.DoEvents() + Call Windows.Forms.Application.DoEvents() 'Penalties in Bestwert kopieren Call ind.PrimObjectives.CopyTo(QNBest, 0) @@ -183,10 +183,10 @@ Public Class HJController durchlauf += 1 'Monitor - Common.Log.AddMessage(Common.Log.levels.info, "Tastschritte aktuell: " & Tastschritte_aktuell.ToString()) + Log.AddMessage(Log.levels.info, "Tastschritte aktuell: " & Tastschritte_aktuell.ToString()) 'Individuum instanzieren - ind = New Common.Individuum_PES("HJ", durchlauf) + ind = New Individuum_PES("HJ", durchlauf) 'OptParameter ins Individuum kopieren For i = 0 To ind.OptParameter.Length - 1 @@ -210,7 +210,7 @@ Public Class HJController Call Me.Testprobleme1.Evaluate(ind, 0, Me.myHauptDiagramm) End If - Call System.Windows.Forms.Application.DoEvents() + Call Windows.Forms.Application.DoEvents() If (ind.PrimObjectives(0) >= QNBest(0)) Then @@ -220,10 +220,10 @@ Public Class HJController durchlauf += 1 'Monitor - Common.Log.AddMessage(Common.Log.levels.info, "Tastschritte aktuell: " & Tastschritte_aktuell.ToString()) + Log.AddMessage(Log.levels.info, "Tastschritte aktuell: " & Tastschritte_aktuell.ToString()) 'Individuum instanzieren - ind = New Common.Individuum_PES("HJ", durchlauf) + ind = New Individuum_PES("HJ", durchlauf) 'OptParameter ins Individuum kopieren For i = 0 To ind.OptParameter.Length - 1 @@ -248,7 +248,7 @@ Public Class HJController Call Me.Testprobleme1.Evaluate(ind, 0, Me.myHauptDiagramm) End If - Call System.Windows.Forms.Application.DoEvents() + Call Windows.Forms.Application.DoEvents() If (ind.PrimObjectives(0) >= QNBest(0)) Then aktuellePara = HookJeeves.TastschrittResetParameter(j) @@ -264,9 +264,9 @@ Public Class HJController Tastschritte_aktuell = 0 'Monitor - Common.Log.AddMessage(Common.Log.levels.info, "Tastschritte gesamt: " & Tastschritte_gesamt.ToString()) - Common.Log.AddMessage(Common.Log.levels.info, "Tastschritte aktuell: " & Tastschritte_aktuell.ToString()) - Common.Log.AddMessage(Common.Log.levels.info, "Tastschritte mittel: " & Math.Round((Tastschritte_gesamt / Iterationen), 2).ToString()) + Log.AddMessage(Log.levels.info, "Tastschritte gesamt: " & Tastschritte_gesamt.ToString()) + Log.AddMessage(Log.levels.info, "Tastschritte aktuell: " & Tastschritte_aktuell.ToString()) + Log.AddMessage(Log.levels.info, "Tastschritte mittel: " & Math.Round((Tastschritte_gesamt / Iterationen), 2).ToString()) 'Extrapolationsschritt If (QNBest(0) < QBest(0)) Then @@ -276,14 +276,14 @@ Public Class HJController serie = Me.myHauptDiagramm.getSeriesPoint("Hooke and Jeeves Best", "Green") Call serie.Add(durchlauf, ind.PrimObjectives(0), durchlauf.ToString()) - Call System.Windows.Forms.Application.DoEvents() + Call Windows.Forms.Application.DoEvents() Call QNBest.CopyTo(QBest, 0) Call HookJeeves.Extrapolationsschritt() Extrapolationsschritte += 1 'Monitor - Common.Log.AddMessage(Common.Log.levels.info, "Extrapolationsschritte: " & Extrapolationsschritte.ToString()) + Log.AddMessage(Log.levels.info, "Extrapolationsschritte: " & Extrapolationsschritte.ToString()) k += 1 aktuellePara = HookJeeves.getLetzteParameter @@ -293,7 +293,7 @@ Public Class HJController Rueckschritte += 1 'Monitor - Common.Log.AddMessage(Common.Log.levels.info, "Rückschritte: " & Rueckschritte.ToString()) + Log.AddMessage(Log.levels.info, "Rückschritte: " & Rueckschritte.ToString()) k += -1 HookJeeves.Schrittweitenhalbierung() @@ -313,7 +313,7 @@ Public Class HJController HookJeeves.Rueckschritt() 'Monitor - Common.Log.AddMessage(Common.Log.levels.info, "Rückschritte: " & Rueckschritte.ToString()) + Log.AddMessage(Log.levels.info, "Rückschritte: " & Rueckschritte.ToString()) HookJeeves.Schrittweitenhalbierung() aktuellePara = HookJeeves.getLetzteParameter() diff --git a/BlueM.Opt/Algos/HookeAndJeeves/HookeAndJeeves.vb b/BlueM.Opt/Algos/HookeAndJeeves/HookeAndJeeves.vb index b98dddfd..177dbc29 100644 --- a/BlueM.Opt/Algos/HookeAndJeeves/HookeAndJeeves.vb +++ b/BlueM.Opt/Algos/HookeAndJeeves/HookeAndJeeves.vb @@ -15,6 +15,8 @@ 'You should have received a copy of the GNU General Public License 'along with this program. If not, see . ' +Imports BlueM.Opt.Common + Public Class HookeAndJeeves 'Settings Private intAnzahlParameter As Integer @@ -31,8 +33,8 @@ Public Class HookeAndJeeves Public Enum TastschrittRichtung As Integer - Vorwärts = 1 - Rückwärts = -1 + Vorwärts = 1 + Rückwärts = -1 End Enum 'Schnittstellen @@ -93,12 +95,12 @@ Public Class HookeAndJeeves ReDim dblExtrapolationsschritt(Anzahlparameter - 1) End Sub - Public Sub Initialize(ByVal OptParameter() As BlueM.Opt.Common.OptParameter) + Public Sub Initialize(ByVal OptParameter() As OptParameter) Dim i As Integer - 'Prüfung + 'Prüfung If OptParameter.GetUpperBound(0) <> intAnzahlParameter - 1 Then - Throw New Exception("Die Anzahl der übergebenen Parameter ist nicht gleich der definierten Anzahl!") + Throw New Exception("Die Anzahl der übergebenen Parameter ist nicht gleich der definierten Anzahl!") End If 'Dynamisches Array wird mit Werten belegt (Vektor der zu optimierenden Parameter) For i = 0 To intAnzahlParameter - 1 @@ -110,7 +112,7 @@ Public Class HookeAndJeeves dblStartparameter.CopyTo(dblLetzteParameter, 0) dblStartparameter.CopyTo(dblLetzteParameterBackup, 0) dblStartparameter.CopyTo(dblAktuelleParameter, 0) - 'Startschrittweite wird übergeben + 'Startschrittweite wird übergeben dblAktuelleSchrittweite = dblStartSchrittweite End Sub @@ -121,39 +123,39 @@ Public Class HookeAndJeeves Public Function Tastschritt(ByVal parameter As Integer, ByVal Richtung As TastschrittRichtung) As Double() - 'Prüfung + 'Prüfung If parameter < 0 Then - Throw New Exception("Der Index des aufgerufenen Parameters für einen Tastschritt muss >= 0 sein!") + Throw New Exception("Der Index des aufgerufenen Parameters für einen Tastschritt muss >= 0 sein!") ElseIf parameter > intAnzahlParameter - 1 Then - Throw New Exception("Der Index des aufgerufenen Parameters für einen Tastschritt ist größer als die Anzahl der definierten Parameter!") + Throw New Exception("Der Index des aufgerufenen Parameters für einen Tastschritt ist größer als die Anzahl der definierten Parameter!") End If 'Tastschritt dblAktuelleParameter(parameter) = dblLetzteParameter(parameter) + dblAktuelleSchrittweite * Richtung If dblAktuelleParameter(parameter) > 1 Or dblAktuelleParameter(parameter) < 0 Then dblAktuelleParameter(parameter) = dblLetzteParameter(parameter) End If - 'Rückgabe des aktuelle Parametervektors + 'Rückgabe des aktuelle Parametervektors Return dblAktuelleParameter End Function Public Function TastschrittResetParameter(ByVal parameter As Integer) As Double() - 'Reset des Übergebenen Parameters + 'Reset des Übergebenen Parameters dblAktuelleParameter(parameter) = dblLetzteParameter(parameter) - 'Rückgabe des aktuelle Parametervektors + 'Rückgabe des aktuelle Parametervektors Return dblAktuelleParameter End Function Public Sub Extrapolationsschritt() Dim i As Integer - 'Bestimmen und Durchführen des Extrapolationsschrittes + 'Bestimmen und Durchführen des Extrapolationsschrittes For i = 0 To intAnzahlParameter - 1 'Bestimmen des Schrittes dblExtrapolationsschritt(i) = Math.Round((dblAktuelleParameter(i) - dblLetzteParameterBackup(i)), 7) - 'Durchführen des Extrapolationsschrittes + 'Durchführen des Extrapolationsschrittes dblLetzteParameter(i) = dblAktuelleParameter(i) + dblExtrapolationsschritt(i) Next - 'Backup des letzten Schrittes, falls Rückschritt erforderlich + 'Backup des letzten Schrittes, falls Rückschritt erforderlich dblAktuelleParameter.CopyTo(dblLetzteParameterBackup, 0) dblLetzteParameter.CopyTo(dblAktuelleParameter, 0) End Sub diff --git a/BlueM.Opt/Algos/IController/IController.vb b/BlueM.Opt/Algos/IController/IController.vb index 261d6c0c..e7868391 100644 --- a/BlueM.Opt/Algos/IController/IController.vb +++ b/BlueM.Opt/Algos/IController/IController.vb @@ -15,6 +15,8 @@ 'You should have received a copy of the GNU General Public License 'along with this program. If not, see . ' +Imports BlueM.Opt.Common + ''' ''' Interface für Algorithmus-Controller ''' @@ -32,22 +34,22 @@ Public Interface IController ''' die Einstellungen ''' der Verlauf ''' das Hauptdiagramm - Sub Init(ByRef inputProblem As BlueM.Opt.Common.Problem, _ - ByRef inputSettings As BlueM.Opt.Common.Settings, _ - ByRef inputProgress As BlueM.Opt.Common.Progress, _ - ByRef inputHptDiagramm As BlueM.Opt.Diagramm.Hauptdiagramm) + Sub Init(ByRef inputProblem As Problem, + ByRef inputSettings As Settings, + ByRef inputProgress As Progress, + ByRef inputHptDiagramm As Diagramm.Hauptdiagramm) ''' ''' Initialisiert den Controller für Sim-Anwendungen ''' ''' die Simulationsanwendung - Sub InitApp(ByRef inputSim As BlueM.Opt.Apps.Sim) + Sub InitApp(ByRef inputSim As Apps.Sim) ''' ''' Initialisiert den Controller für Testprobleme ''' ''' das Testproblem - Sub InitApp(ByRef inputTestprobleme As BlueM.Opt.Apps.Testprobleme) + Sub InitApp(ByRef inputTestprobleme As Apps.Testprobleme) ''' ''' Optimierung starten diff --git a/BlueM.Opt/Algos/SensiPlot/ParameterSampler.vb b/BlueM.Opt/Algos/SensiPlot/ParameterSampler.vb index a18ada08..92861e2a 100644 --- a/BlueM.Opt/Algos/SensiPlot/ParameterSampler.vb +++ b/BlueM.Opt/Algos/SensiPlot/ParameterSampler.vb @@ -1,4 +1,4 @@ -'BlueM.Opt +'BlueM.Opt 'Copyright (C) BlueM Dev Group 'Website: ' @@ -15,6 +15,7 @@ 'You should have received a copy of the GNU General Public License 'along with this program. If not, see . ' +Imports BlueM.Opt.Common ''' ''' Class for sampling the parameter space using different methods @@ -28,14 +29,14 @@ Public Class ParameterSampler ''' number of steps ''' sampling method ''' list of parameter combinations - Public Function Sample(NumParams As Integer, NumSteps As Integer, method As Common.Settings_Sensiplot.SensiType) As List(Of Double()) + Public Function Sample(NumParams As Integer, NumSteps As Integer, method As Settings_Sensiplot.SensiType) As List(Of Double()) Dim random As New Random() Dim parameterCombinations As New List(Of Double()) Select Case method - Case Common.Settings_Sensiplot.SensiType.randomDistribution + Case Settings_Sensiplot.SensiType.randomDistribution ' no. of combinations: NumSteps For n = 0 To NumSteps - 1 @@ -47,7 +48,7 @@ Public Class ParameterSampler parameterCombinations.Add(parameterCombination) Next - Case Common.Settings_Sensiplot.SensiType.evenDistribution + Case Settings_Sensiplot.SensiType.evenDistribution ' no. of combinations: NumSteps ^ NumParams Dim totalCombinations As Integer = NumSteps ^ NumParams @@ -61,7 +62,7 @@ Public Class ParameterSampler parameterCombinations.Add(parameterCombination) Next - Case Common.Settings_Sensiplot.SensiType.latinHypercube + Case Settings_Sensiplot.SensiType.latinHypercube ' no. of combinations: NumSteps Dim lhsMatrix(NumSteps - 1)() As Double diff --git a/BlueM.Opt/Algos/SensiPlot/SensiPlotController.vb b/BlueM.Opt/Algos/SensiPlot/SensiPlotController.vb index b4339ea6..9b4b5fbd 100644 --- a/BlueM.Opt/Algos/SensiPlot/SensiPlotController.vb +++ b/BlueM.Opt/Algos/SensiPlot/SensiPlotController.vb @@ -15,10 +15,10 @@ 'You should have received a copy of the GNU General Public License 'along with this program. If not, see . ' -Imports BlueM.Opt.Common.Constants +Imports BlueM.Opt.Common Public Class SensiPlotController - Implements BlueM.Opt.Algos.IController + Implements Algos.IController ''' ''' Multithreading Support @@ -29,17 +29,17 @@ Public Class SensiPlotController End Get End Property - Private myProblem As BlueM.Opt.Common.Problem - Private mySettings As BlueM.Opt.Common.Settings - Private myProgress As BlueM.Opt.Common.Progress - Private myHauptDiagramm As BlueM.Opt.Diagramm.Hauptdiagramm + Private myProblem As Problem + Private mySettings As Settings + Private myProgress As Progress + Private myHauptDiagramm As Diagramm.Hauptdiagramm - Private myAppType As BlueM.Opt.Common.ApplicationTypes - Private WithEvents Sim1 As BlueM.Opt.Apps.Sim + Private myAppType As ApplicationTypes + Private WithEvents Sim1 As Apps.Sim Private stopped As Boolean - Public Sub Init(ByRef inputProblem As Common.Problem, ByRef inputSettings As Common.Settings, ByRef inputProgress As Common.Progress, ByRef inputHptDiagramm As Diagramm.Hauptdiagramm) Implements IController.Init + Public Sub Init(ByRef inputProblem As Problem, ByRef inputSettings As Settings, ByRef inputProgress As Progress, ByRef inputHptDiagramm As Diagramm.Hauptdiagramm) Implements IController.Init Me.myProblem = inputProblem Me.mySettings = inputSettings Me.myProgress = inputProgress @@ -66,7 +66,7 @@ Public Class SensiPlotController Dim i, n, NumParams, NumSteps As Integer Dim x, y, z As Double Dim isOK As Boolean - Dim ind As Common.Individuum + Dim ind As Individuum Dim serie As Steema.TeeChart.Styles.Points Dim serie3D As New Steema.TeeChart.Styles.Points3D Dim surface As New Steema.TeeChart.Styles.Surface @@ -109,7 +109,7 @@ Public Class SensiPlotController surface.Brush.Transparency = 70 surface.Pen.Visible = False surface.Title = "SensiPlot" - surface.Cursor = System.Windows.Forms.Cursors.Hand + surface.Cursor = Windows.Forms.Cursors.Hand End If End If @@ -129,7 +129,7 @@ Public Class SensiPlotController If (Me.stopped) Then Exit Sub n = i + 1 - Common.Log.AddMessage(Common.Log.levels.info, $"Sensiplot simulation {n}:") + Log.AddMessage(Log.levels.info, $"Sensiplot simulation {n}:") Dim parameterCombination As Double() = parameterCombinations(i) @@ -137,7 +137,7 @@ Public Class SensiPlotController For j = 0 To NumParams - 1 With Me.myProblem.List_OptParameter(Me.mySettings.SensiPlot.Selected_OptParameters(j)) .Xn = parameterCombination(j) - Common.Log.AddMessage(Common.Log.levels.info, $"* OptParameter { .Bezeichnung}: {Convert.ToString(.RWert, Common.Provider.FortranProvider)}") + Log.AddMessage(Log.levels.info, $"* OptParameter { .Bezeichnung}: {Convert.ToString(.RWert, Provider.FortranProvider)}") End With Next @@ -166,19 +166,19 @@ Public Class SensiPlotController If Not relationshipSatisfied Then allRelationshipsSatisfied = False - Common.Log.AddMessage(Common.Log.levels.warning, $"Relationship for optimization parameter {Me.myProblem.List_OptParameter(j).Bezeichnung} is not satisfied!") + Log.AddMessage(Log.levels.warning, $"Relationship for optimization parameter {Me.myProblem.List_OptParameter(j).Bezeichnung} is not satisfied!") End If End If Next If Not allRelationshipsSatisfied Then 'Skip evaluation - Common.Log.AddMessage(Common.Log.levels.warning, $"Skipping evaluation of parameter combination {n} because of parameter relationship violations!") + Log.AddMessage(Log.levels.warning, $"Skipping evaluation of parameter combination {n} because of parameter relationship violations!") Else 'Evaluate parameter combination 'Individuum instanzieren - ind = New Common.Individuum_PES("SensiPlot", n) + ind = New Individuum_PES("SensiPlot", n) 'OptParameter ins Individuum kopieren ind.OptParameter = Me.myProblem.List_OptParameter @@ -235,7 +235,7 @@ Public Class SensiPlotController End If - System.Windows.Forms.Application.DoEvents() + Windows.Forms.Application.DoEvents() Next diff --git a/BlueM.Opt/Algos/TSP/TSP.vb b/BlueM.Opt/Algos/TSP/TSP.vb index d3cfd925..b788cde9 100644 --- a/BlueM.Opt/Algos/TSP/TSP.vb +++ b/BlueM.Opt/Algos/TSP/TSP.vb @@ -15,7 +15,7 @@ 'You should have received a copy of the GNU General Public License 'along with this program. If not, see . ' -Imports System.IO +Imports BlueM.Opt.Common ''' ''' Traveling Salesman Problem @@ -31,7 +31,7 @@ Public Class TSP 'PNG Export exportiert alle 100 Generationen png Bilder Public pngExport As Boolean = True - 'Standardmäig unter den bin Verzeichnis + 'Standardmäig unter den bin Verzeichnis Public ExPath As String 'Batch_Mode @@ -46,7 +46,7 @@ Public Class TSP End Enum 'Settings - Private mySettings As Common.Settings_TSP + Private mySettings As Settings_TSP Public ListOfCities(,) As Object @@ -69,7 +69,7 @@ Public Class TSP '******************************** Initialisierung ************************************* - Public Sub TSP_Initialize(ByRef mySettingsInput As Common.Settings_TSP) + Public Sub TSP_Initialize(ByRef mySettingsInput As Settings_TSP) mySettings = mySettingsInput @@ -82,7 +82,7 @@ Public Class TSP Select Case mySettings.Problem - Case Common.EnProblem.circle + Case EnProblem.circle Dim Radius As Integer = 45 Dim factor As Double = (Math.PI * 2) / mySettings.N_Cities For i = 0 To mySettings.N_Cities - 1 @@ -92,7 +92,7 @@ Public Class TSP Next circumference = 2 * Math.PI * Radius - Case Common.EnProblem.random + Case EnProblem.random Dim lowerb As Integer = 2 Dim upperb1 As Integer = 98 Dim upperb2 As Integer = 128 @@ -104,8 +104,8 @@ Public Class TSP End Select If pngExport = True Then - Directory.CreateDirectory(IO.Path.Combine(Directory.GetCurrentDirectory, "TSP_Export")) - ExPath = IO.Path.Combine(Directory.GetCurrentDirectory, "TSP_Export") + IO.Directory.CreateDirectory(IO.Path.Combine(IO.Directory.GetCurrentDirectory, "TSP_Export")) + ExPath = IO.Path.Combine(IO.Directory.GetCurrentDirectory, "TSP_Export") End If End Sub @@ -141,7 +141,7 @@ Public Class TSP End Sub - 'Generiert zufällige Paths für alle Kinder + 'Generiert zufällige Paths für alle Kinder Public Sub Generate_Random_Path_TSP() Dim i, j As Integer Dim tmp As Integer @@ -163,7 +163,7 @@ Public Class TSP '************************ Functionen innerhalb der Generationsschleife **************************** - 'Weist den KinderPfaden die Städte zu + 'Weist den KinderPfaden die Städte zu Public Sub Cities_according_ChildPath() Dim i, j As Integer @@ -178,7 +178,7 @@ Public Class TSP End Sub - 'Ermittelt die Qualität bzw. die Länge des Weges Für TSP + 'Ermittelt die Qualität bzw. die Länge des Weges Für TSP Public Sub Evaluate_child_Quality() Dim i, j As Integer Dim distance As Double @@ -211,14 +211,14 @@ Public Class TSP Public Sub Selection_Process() Dim i, j As Integer - If mySettings.Strategy = Common.EVO_STRATEGY.Comma_Strategy Then + If mySettings.Strategy = Constants.EVO_STRATEGY.Comma_Strategy Then For i = 0 To mySettings.N_Parents - 1 ParentList(i).Penalty = ChildrenList(i).Penalty Array.Copy(ChildrenList(i).Image, ParentList(i).Image, ChildrenList(i).Image.Length) Array.Copy(ChildrenList(i).Path, ParentList(i).Path, ChildrenList(i).Path.Length) Next i - ElseIf mySettings.Strategy = Common.EVO_STRATEGY.Plus_Strategy Then + ElseIf mySettings.Strategy = Constants.EVO_STRATEGY.Plus_Strategy Then j = 0 For i = 0 To mySettings.N_Parents - 1 If ParentList(i).Penalty < ChildrenList(j).Penalty Then @@ -234,7 +234,7 @@ Public Class TSP End Sub - 'Kinder werden zur Sicherheit gelöscht aber nicht zerstört ;-) + 'Kinder werden zur Sicherheit gelöscht aber nicht zerstört ;-) Public Sub Reset_Children() Dim i As Integer @@ -256,8 +256,8 @@ Public Class TSP Dim Einzelkind(mySettings.N_Cities - 1) As Integer Select Case mySettings.ReprodOperator - 'UPGRADE: Eltern werden nicht zufällig gewählt sondern immer in Top Down Reihenfolge - Case Common.EnReprodOperator.Order_Crossover_OX + 'UPGRADE: Eltern werden nicht zufällig gewählt sondern immer in Top Down Reihenfolge + Case Constants.EnReprodOperator.Order_Crossover_OX x = 0 y = 1 For i = 0 To mySettings.N_Children - 2 Step 2 @@ -271,7 +271,7 @@ Public Class TSP Call ReprodOp_OX(ParentList(x).Path, ParentList(y).Path, ChildrenList(mySettings.N_Children - 1).Path, Einzelkind) End If - Case Common.EnReprodOperator.Partially_Mapped_Crossover_PMX + Case Constants.EnReprodOperator.Partially_Mapped_Crossover_PMX x = 0 y = 1 For i = 0 To mySettings.N_Children - 2 Step 2 @@ -289,8 +289,8 @@ Public Class TSP End Sub 'Reproductionsoperator "Order_Crossover (OX)" - 'Kopiert den mittleren Teil des einen Elter und füllt den Rest aus der Reihenfolge des anderen Elter auf - 'UPGRADE: Es wird immer nur der mittlere Teil Kopiert, könnte auch mal ein einderer sein + 'Kopiert den mittleren Teil des einen Elter und füllt den Rest aus der Reihenfolge des anderen Elter auf + 'UPGRADE: Es wird immer nur der mittlere Teil Kopiert, könnte auch mal ein einderer sein Private Sub ReprodOp_OX(ByVal ParPath_A() As Integer, ByVal ParPath_B() As Integer, ByRef ChildPath_A() As Integer, ByRef ChildPath_B() As Integer) Dim i As Integer @@ -304,7 +304,7 @@ Public Class TSP ChildPath_A(i) = ParPath_A(i) ChildPath_B(i) = ParPath_B(i) Next - 'Auffüllen des Paths Teil 3 des Child A mit dem anderen Elter beginnend bei 0 + 'Auffüllen des Paths Teil 3 des Child A mit dem anderen Elter beginnend bei 0 x = 0 For i = CutPoint(1) + 1 To mySettings.N_Cities - 1 If Is_No_OK(ParPath_B(x), ChildPath_A) Then @@ -314,7 +314,7 @@ Public Class TSP End If x += 1 Next - 'Auffüllen des Paths Teil 3 des Child B mit dem anderen Elter beginnend bei 0 + 'Auffüllen des Paths Teil 3 des Child B mit dem anderen Elter beginnend bei 0 y = 0 For i = CutPoint(1) + 1 To mySettings.N_Cities - 1 If Is_No_OK(ParPath_A(y), ChildPath_B) Then @@ -324,7 +324,7 @@ Public Class TSP End If y += 1 Next - 'Auffüllen des Paths Teil 1 des Child A mit dem anderen Elter beginnend bei 0 + 'Auffüllen des Paths Teil 1 des Child A mit dem anderen Elter beginnend bei 0 For i = 0 To CutPoint(0) If Is_No_OK(ParPath_B(x), ChildPath_A) Then ChildPath_A(i) = ParPath_B(x) @@ -333,7 +333,7 @@ Public Class TSP End If x += 1 Next - 'Auffüllen des Paths Teil 1 des Child B mit dem anderen Elter beginnend bei 0 + 'Auffüllen des Paths Teil 1 des Child B mit dem anderen Elter beginnend bei 0 For i = 0 To CutPoint(0) If Is_No_OK(ParPath_A(y), ChildPath_B) Then ChildPath_B(i) = ParPath_A(y) @@ -345,7 +345,7 @@ Public Class TSP End Sub 'Reproductionsoperator: "Partially_Mapped_Crossover_(PMX)" - 'Kopiert den mittleren Teil des anderen Elter und füllt den Rest mit dem eigenen auf. Falls Doppelt wird gemaped. + 'Kopiert den mittleren Teil des anderen Elter und füllt den Rest mit dem eigenen auf. Falls Doppelt wird gemaped. Public Sub ReprodOp_PMX(ByVal ParPath_A() As Integer, ByVal ParPath_B() As Integer, ByRef ChildPath_A() As Integer, ByRef ChildPath_B() As Integer) Dim i As Integer Dim x As Integer @@ -357,7 +357,7 @@ Public Class TSP Call Create_n_Cutpoints(CutPoint) Next - 'Kopieren des mittleren Paths und füllen des Mappers + 'Kopieren des mittleren Paths und füllen des Mappers x = 0 For i = CutPoint(0) + 1 To CutPoint(1) ChildPath_B(i) = ParPath_A(i) @@ -365,9 +365,9 @@ Public Class TSP x += 1 Next - 'Auffüllen des Paths Teil 1 des Child A und B mit dem anderen Elter beginnend bei 0 + 'Auffüllen des Paths Teil 1 des Child A und B mit dem anderen Elter beginnend bei 0 For i = 0 To CutPoint(0) - 'für Child A + 'für Child A If Is_No_OK(ParPath_A(i), ChildPath_A) Then ChildPath_A(i) = ParPath_A(i) Else @@ -379,7 +379,7 @@ Public Class TSP ChildPath_A(i) = mapper End If - 'für Child B + 'für Child B If Is_No_OK(ParPath_B(i), ChildPath_B) Then ChildPath_B(i) = ParPath_B(i) Else @@ -392,9 +392,9 @@ Public Class TSP End If Next i - 'Auffüllen des Paths Teil 3 des Child A und B mit dem anderen Elter beginnend bei 0 + 'Auffüllen des Paths Teil 3 des Child A und B mit dem anderen Elter beginnend bei 0 For i = CutPoint(1) + 1 To mySettings.N_Cities - 1 - 'für Child A + 'für Child A If Is_No_OK(ParPath_A(i), ChildPath_A) Then ChildPath_A(i) = ParPath_A(i) Else @@ -406,7 +406,7 @@ Public Class TSP ChildPath_A(i) = mapper End If - 'für Child B + 'für Child B If Is_No_OK(ParPath_B(i), ChildPath_B) Then ChildPath_B(i) = ParPath_B(i) Else @@ -427,23 +427,23 @@ Public Class TSP Dim i As Integer Select Case mySettings.MutOperator - Case Common.EnMutOperator.Inversion_SIM + Case Constants.EnMutOperator.Inversion_SIM For i = 0 To mySettings.N_Children - 1 Call MutOp_SIM(ChildrenList(i).Path) 'If PathValid(ChildList(i).Path) = False Then Throw New Exception("Fehler im Path") Next i - Case Common.EnMutOperator.Translocation_3_Opt + Case Constants.EnMutOperator.Translocation_3_Opt For i = 0 To mySettings.N_Children - 1 Call MutOp_3_opt(ChildrenList(i).Path) 'If PathValid(ChildList(i).Path) = False Then Throw New Exception("Fehler im Path") Next i - Case Common.EnMutOperator.Translocation_n_Opt + Case Constants.EnMutOperator.Translocation_n_Opt For i = 0 To mySettings.N_Children - 1 Call MutOp_n_opt(ChildrenList(i).Path) 'If PathValid(ChildList(i).Path) = False Then Throw New Exception("Fehler im Path") Next i - Case Common.EnMutOperator.Exchange_Mutation_EM + Case Constants.EnMutOperator.Exchange_Mutation_EM For i = 0 To mySettings.N_Children - 1 Call MutOp_EM(ChildrenList(i).Path) Next @@ -452,7 +452,7 @@ Public Class TSP End Sub 'Mutationsoperator "Inversion (SIM)" - 'Schneidet ein Segment aus dem Path heraus und fügt es invers wieder ein + 'Schneidet ein Segment aus dem Path heraus und fügt es invers wieder ein 'UPGRADE: Wird bis jetzt nur auf den mittleren Teil angewendet Private Sub MutOp_SIM(ByVal Path() As Integer) Dim i As Integer @@ -470,7 +470,7 @@ Public Class TSP x += 1 Next - 'Invertiertes einfügen + 'Invertiertes einfügen For i = CutPoint(0) + 1 To CutPoint(1) x -= 1 Path(i) = SubPath(x) @@ -479,8 +479,8 @@ Public Class TSP End Sub 'Mutationsoperator "Translocation (3-Opt" - 'Vertauscht zufällig 3 Abschnitte aus dem String und verwendet Bernoulli verteilt die Inverse - 'UPGRADE: Jetzt werden immer 3 Translocation durchgeführt könnte man auf n-Ausbauen + 'Vertauscht zufällig 3 Abschnitte aus dem String und verwendet Bernoulli verteilt die Inverse + 'UPGRADE: Jetzt werden immer 3 Translocation durchgeführt könnte man auf n-Ausbauen Private Sub MutOp_3_opt(ByVal Path() As Integer) Dim i, j As Integer Dim x As Integer @@ -529,7 +529,7 @@ Public Class TSP SwapPath(i) -= 1 Next - 'Übertragen der Substrings in den Path + 'Übertragen der Substrings in den Path x = 0 For i = 0 To 2 For j = 0 To SubPath(SwapPath(i)).GetUpperBound(0) @@ -540,7 +540,7 @@ Public Class TSP End Sub 'Mutationsoperator "Translocation (n-Opt)" - 'Vertauscht zufällig n Abschnitte aus dem String und verwendet Bernoulli verteilt die Inverse + 'Vertauscht zufällig n Abschnitte aus dem String und verwendet Bernoulli verteilt die Inverse Private Sub MutOp_n_opt(ByVal Path() As Integer) Dim i, j As Integer Dim x As Integer @@ -593,7 +593,7 @@ Public Class TSP SwapPath(i) -= 1 Next - 'Übertragen der Substrings in den Path + 'Übertragen der Substrings in den Path x = 0 For i = 0 To n_SP - 1 For j = 0 To SubPath(SwapPath(i)).GetUpperBound(0) @@ -634,18 +634,18 @@ Public Class TSP 'Hilfsfunktion: Validierung der Paths 'UPGRADE:Option zum ein und Ausschalten dieser Function - Public Function PathValid(ByVal Path() As Integer) As Boolean + Public Function PathValid(ByVal path() As Integer) As Boolean Dim i As Integer - Array.Sort(Path) - For i = 0 To Path.GetUpperBound(0) - If Path(i) <> i + 1 Then + Array.Sort(path) + For i = 0 To path.GetUpperBound(0) + If path(i) <> i + 1 Then Exit Function End If Next PathValid = True End Function - 'Hilfsfunktion um zu Prüfen ob eine Zahl bereits in einem Array vorhanden ist oder nicht + 'Hilfsfunktion um zu Prüfen ob eine Zahl bereits in einem Array vorhanden ist oder nicht Public Function Is_No_OK(ByRef No As Integer, ByRef Path() As Integer) As Boolean Is_No_OK = True @@ -683,7 +683,7 @@ Public Class TSP End Sub - 'Hilfsfunktion zum generieren von zufälligen Schnittpunkten innerhalb eines Pfades + 'Hilfsfunktion zum generieren von zufälligen Schnittpunkten innerhalb eines Pfades Public Sub Create_n_Cutpoints(ByRef CutPoint() As Integer) Dim i As Integer diff --git a/BlueM.Opt/Algos/TSP/TSPController.vb b/BlueM.Opt/Algos/TSP/TSPController.vb index 211365f4..bb59be06 100644 --- a/BlueM.Opt/Algos/TSP/TSPController.vb +++ b/BlueM.Opt/Algos/TSP/TSPController.vb @@ -15,8 +15,11 @@ 'You should have received a copy of the GNU General Public License 'along with this program. If not, see . ' +Imports System.Drawing +Imports BlueM.Opt.Common + Public Class TSPController - Implements BlueM.Opt.Algos.IController + Implements Algos.IController ''' ''' Multithreading Support @@ -27,10 +30,10 @@ Public Class TSPController End Get End Property - Private myHauptDiagramm As BlueM.Opt.Diagramm.Hauptdiagramm - Private myProblem As BlueM.Opt.Common.Problem - Private mySettings As BlueM.Opt.Common.Settings - Private myProgress As BlueM.Opt.Common.Progress + Private myHauptDiagramm As Diagramm.Hauptdiagramm + Private myProblem As Problem + Private mySettings As Settings + Private myProgress As Progress Private TSP1 As TSP Private Stopp As Boolean @@ -43,7 +46,7 @@ Public Class TSPController ''' ''' ''' - Public Sub Init(ByRef inputProblem As Common.Problem, ByRef inputSettings As Common.Settings, ByRef inputProgress As Common.Progress, ByRef inputHptDiagramm As Diagramm.Hauptdiagramm) Implements IController.Init + Public Sub Init(ByRef inputProblem As Problem, ByRef inputSettings As Settings, ByRef inputProgress As Progress, ByRef inputHptDiagramm As Diagramm.Hauptdiagramm) Implements IController.Init Me.myProblem = inputProblem Me.mySettings = inputSettings Me.myProgress = inputProgress @@ -81,14 +84,14 @@ Public Class TSPController Me.myProgress.Initialize(0, 0, Me.mySettings.TSP.N_Gen, Me.mySettings.TSP.N_Children) 'Log - Common.Log.AddMessage(Common.Log.levels.info, "Cities: " & Me.mySettings.TSP.N_Cities) - Common.Log.AddMessage(Common.Log.levels.info, "Combinations: " & TSP1.n_Comb(Me.mySettings.TSP.N_Cities)) - Common.Log.AddMessage(Common.Log.levels.info, "Parents: " & Me.mySettings.TSP.N_Parents) - Common.Log.AddMessage(Common.Log.levels.info, "Children: " & Me.mySettings.TSP.N_Children) - Common.Log.AddMessage(Common.Log.levels.info, "Generations: " & Me.mySettings.TSP.N_Gen) - Common.Log.AddMessage(Common.Log.levels.info, "Evaluations: " & Me.mySettings.TSP.N_Children * Me.mySettings.TSP.N_Gen) - If Me.mySettings.TSP.Problem = Common.EnProblem.circle Then - Common.Log.AddMessage(Common.Log.levels.info, "Quality Aim: " & Conversion.Int(TSP1.circumference)) + Log.AddMessage(Log.levels.info, "Cities: " & Me.mySettings.TSP.N_Cities) + Log.AddMessage(Log.levels.info, "Combinations: " & TSP1.n_Comb(Me.mySettings.TSP.N_Cities)) + Log.AddMessage(Log.levels.info, "Parents: " & Me.mySettings.TSP.N_Parents) + Log.AddMessage(Log.levels.info, "Children: " & Me.mySettings.TSP.N_Children) + Log.AddMessage(Log.levels.info, "Generations: " & Me.mySettings.TSP.N_Gen) + Log.AddMessage(Log.levels.info, "Evaluations: " & Me.mySettings.TSP.N_Children * Me.mySettings.TSP.N_Gen) + If Me.mySettings.TSP.Problem = Constants.EnProblem.circle Then + Log.AddMessage(Log.levels.info, "Quality Aim: " & Conversion.Int(TSP1.circumference)) End If Select Case TSP1.Mode @@ -108,7 +111,7 @@ Public Class TSPController For M = 1 To 4 Me.mySettings.TSP.MutOperator = M - Common.Log.AddMessage(Common.Log.levels.info, $"ReprodOperator: {Me.mySettings.TSP.ReprodOperator}; MutationOperator: {Me.mySettings.TSP.MutOperator}") + Log.AddMessage(Log.levels.info, $"ReprodOperator: {Me.mySettings.TSP.ReprodOperator}; MutationOperator: {Me.mySettings.TSP.MutOperator}") 'n Wiederholungen For i = 1 To TSP1.nTests @@ -134,8 +137,8 @@ Public Class TSPController Next Time.Stop() - Common.Log.AddMessage(Common.Log.levels.info, $"Number of calculations: {j}") - Common.Log.AddMessage(Common.Log.levels.info, $"Time elapsed: {Time.Elapsed.Hours}h {Time.Elapsed.Minutes}m {Time.Elapsed.Seconds}s {Time.Elapsed.Milliseconds}ms") + Log.AddMessage(Log.levels.info, $"Number of calculations: {j}") + Log.AddMessage(Log.levels.info, $"Time elapsed: {Time.Elapsed.Hours}h {Time.Elapsed.Minutes}m {Time.Elapsed.Seconds}s {Time.Elapsed.Milliseconds}ms") End Select End Sub @@ -201,7 +204,7 @@ Public Class TSPController jepp += increm Me.myProgress.iGen() = gen If Batch_Mode = False Then - Common.Log.AddMessage(Common.Log.levels.info, $"Gen.: {gen}; Length: {Conversion.Int(TSP1.ParentList(0).Penalty)}; Factor: {Math.Round(TSP1.ParentList(0).Penalty / TSP1.circumference, 3, MidpointRounding.ToEven)}") + Log.AddMessage(Log.levels.info, $"Gen.: {gen}; Length: {Conversion.Int(TSP1.ParentList(0).Penalty)}; Factor: {Math.Round(TSP1.ParentList(0).Penalty / TSP1.circumference, 3, MidpointRounding.ToEven)}") 'png Export If TSP1.pngExport = True And Conversion.Int(TSP1.ParentList(0).Penalty) < PenaltyTMP Then Me.myHauptDiagramm.Export.Image.PNG.Save(TSP1.ExPath & gen.ToString.PadLeft(7, "0") & " Qualität " & Conversion.Int(TSP1.ParentList(0).Penalty).ToString.PadLeft(5, "0") & ".png") @@ -211,7 +214,7 @@ Public Class TSPController End If 'Fall die Problemstellung ein Kreis ist wird abgebrochen, wenn das Optimum erreicht ist - If Me.mySettings.TSP.Problem = Common.EnProblem.circle And TSP1.ParentList(0).Penalty < TSP1.circumference Then + If Me.mySettings.TSP.Problem = Constants.EnProblem.circle And TSP1.ParentList(0).Penalty < TSP1.circumference Then GoToExit = True Select Case TSP1.ParentList(0).Path(0) < TSP1.ParentList(0).Path(1) Case True @@ -236,7 +239,7 @@ Public Class TSPController If Batch_Mode = False Then Call Zeichnen_TSP(TSP1.ParentList(0).Image) Me.myHauptDiagramm.Update() - Common.Log.AddMessage(Common.Log.levels.info, $"Gen.: {gen}; Length: {Conversion.Int(TSP1.ParentList(0).Penalty)}; Factor: {Math.Round(TSP1.ParentList(0).Penalty / TSP1.circumference, 3, MidpointRounding.ToEven)}") + Log.AddMessage(Log.levels.info, $"Gen.: {gen}; Length: {Conversion.Int(TSP1.ParentList(0).Penalty)}; Factor: {Math.Round(TSP1.ParentList(0).Penalty / TSP1.circumference, 3, MidpointRounding.ToEven)}") 'png Export If TSP1.pngExport = True Then Me.myHauptDiagramm.Export.Image.PNG.Save(TSP1.ExPath & gen.ToString.PadLeft(7, "0") & " Qualität " & Conversion.Int(TSP1.ParentList(0).Penalty).ToString.PadLeft(5, "0") & ".png") @@ -256,7 +259,7 @@ Public Class TSPController Next gen - Common.Log.AddMessage(Common.Log.levels.info, "Final Quality: " & Conversion.Int(TSP1.ParentList(0).Penalty)) + Log.AddMessage(Log.levels.info, "Final Quality: " & Conversion.Int(TSP1.ParentList(0).Penalty)) End Sub @@ -286,9 +289,9 @@ Public Class TSPController 'Printversion .Header.Visible = False - .Panel.Color = Drawing.Color.White - .Chart.Axes.Left.Ticks.Color = Drawing.Color.Black - .Chart.Axes.Right.Ticks.Color = Drawing.Color.Black + .Panel.Color = Color.White + .Chart.Axes.Left.Ticks.Color = Color.Black + .Chart.Axes.Right.Ticks.Color = Color.Black .Chart.Axes.Left.Ticks.Width = 1 .Chart.Axes.Right.Ticks.Width = 1 @@ -306,7 +309,7 @@ Public Class TSPController Dim Point1 As New Steema.TeeChart.Styles.Points(.Chart) Point1.Title = "Städte" Point1.Pointer.Style = Steema.TeeChart.Styles.PointerStyles.Circle - Point1.Color = System.Drawing.Color.Orange + Point1.Color = Color.Orange Point1.Pointer.HorizSize = 2 Point1.Pointer.VertSize = 2 @@ -315,7 +318,7 @@ Public Class TSPController Dim Line1 As New Steema.TeeChart.Styles.Line(.Chart) Line1.Title = "Reisen" Line1.Pointer.Style = Steema.TeeChart.Styles.PointerStyles.Circle - Line1.Color = System.Drawing.Color.Blue + Line1.Color = Color.Blue Line1.Pointer.HorizSize = 3 Line1.Pointer.VertSize = 3 Next @@ -344,8 +347,8 @@ Public Class TSPController .Series(1).Clear() For i = 1 To Me.mySettings.TSP.N_Cities - 1 .Series(i + 1).Clear() - .Series(i + 1).Add(TmpListOfCities(i, 1), TmpListOfCities(i, 2), Drawing.Color.Blue) - .Series(i).Add(TmpListOfCities(i, 1), TmpListOfCities(i, 2), Drawing.Color.Blue) + .Series(i + 1).Add(TmpListOfCities(i, 1), TmpListOfCities(i, 2), Color.Blue) + .Series(i).Add(TmpListOfCities(i, 1), TmpListOfCities(i, 2), Color.Blue) Next 'Zeichnen der Verbindung von der ersten bis zur letzten Stadt diff --git a/BlueM.Opt/Apps/BlueM.Opt.Apps.vbproj b/BlueM.Opt/Apps/BlueM.Opt.Apps.vbproj index ebf6ea6b..ee9e64dc 100644 --- a/BlueM.Opt/Apps/BlueM.Opt.Apps.vbproj +++ b/BlueM.Opt/Apps/BlueM.Opt.Apps.vbproj @@ -112,11 +112,6 @@ True - - Code - - - @@ -175,10 +170,6 @@ - - - Always - Always diff --git a/BlueM.Opt/Apps/BlueM/BlueM.vb b/BlueM.Opt/Apps/BlueM/BlueM.vb index 4d4c11f4..50a958f6 100644 --- a/BlueM.Opt/Apps/BlueM/BlueM.vb +++ b/BlueM.Opt/Apps/BlueM/BlueM.vb @@ -15,11 +15,9 @@ 'You should have received a copy of the GNU General Public License 'along with this program. If not, see . ' -Imports System.IO Imports System.Threading -Imports BlueM.DllAdapter -Imports BlueM Imports BlueM.Opt.Common +Imports BlueM.DllAdapter ''' ''' Klasse BlueMSim @@ -51,9 +49,9 @@ Public Class BlueMSim #Region "Properties" ''' - ''' Alle Dateiendungen (ohne Punkt), die in einem Datensatz vorkommen können + ''' Alle Dateiendungen (ohne Punkt), die in einem Datensatz vorkommen können ''' - ''' Die erste Dateiendung in dieser Collection repräsentiert den Datensatz (wird z.B. als Filter für OpenFile-Dialoge verwendet) + ''' Die erste Dateiendung in dieser Collection repräsentiert den Datensatz (wird z.B. als Filter für OpenFile-Dialoge verwendet) Public Overrides ReadOnly Property DatensatzDateiendungen() As Collections.Specialized.StringCollection Get Dim exts As New Collections.Specialized.StringCollection() @@ -70,7 +68,7 @@ Public Class BlueMSim End Property ''' - ''' Ob die Anwendung Multithreading unterstützt + ''' Ob die Anwendung Multithreading unterstützt ''' ''' True Public Overrides ReadOnly Property MultithreadingSupported() As Boolean @@ -98,9 +96,9 @@ Public Class BlueMSim 'Pfad zu BlueM.DLL bestimmen '--------------------------- - dll_path = IO.Path.Combine(System.Windows.Forms.Application.StartupPath(), "BlueM\BlueM.Sim.dll") + dll_path = IO.Path.Combine(Windows.Forms.Application.StartupPath(), "BlueM\BlueM.Sim.dll") - If (Not File.Exists(dll_path)) Then + If (Not IO.File.Exists(dll_path)) Then Throw New Exception("BlueM.Sim.dll nicht gefunden!") End If @@ -132,13 +130,13 @@ Public Class BlueMSim End Sub - Public Overrides Sub setProblem(ByRef prob As BlueM.Opt.Common.Problem) + Public Overrides Sub setProblem(ByRef prob As Problem) Call MyBase.setProblem(prob) 'BlueM-spezifische Weiterverarbeitung von ZielReihen: '==================================================== - Dim objective As Common.ObjectiveFunction + Dim objective As ObjectiveFunction 'KWL: Feststellen, ob irgendeine Zielfunktion die KWL-Datei benutzt '------------------------------------------------------------------ @@ -169,12 +167,12 @@ Public Class BlueMSim Dim Ganglinie As String = "" Dim CSV_Format As String = "" - 'ALL-Datei öffnen + 'ALL-Datei öffnen '---------------- Dim Datei As String = IO.Path.Combine(Me.WorkDir_Original, Me.Datensatz & ".ALL") - Dim FiStr As FileStream = New FileStream(Datei, FileMode.Open, IO.FileAccess.Read) - Dim StrRead As StreamReader = New StreamReader(FiStr, System.Text.Encoding.GetEncoding("iso8859-1")) + Dim FiStr As New IO.FileStream(Datei, IO.FileMode.Open, IO.FileAccess.Read) + Dim StrRead As New IO.StreamReader(FiStr, Text.Encoding.GetEncoding("iso8859-1")) 'Alle Zeilen durchlaufen Dim Zeile As String @@ -192,12 +190,12 @@ Public Class BlueMSim SimDT_str = Zeile.Substring(35).Trim End If - 'Überprüfen ob die Ganglinien (.WEL Datei) ausgegeben wird + 'Überprüfen ob die Ganglinien (.WEL Datei) ausgegeben wird If (Zeile.StartsWith(" Ganglinienausgabe ....... [J/N] :")) Then Ganglinie = Zeile.Substring(35).Trim End If - 'Überprüfen ob CSV Format eingeschaltet ist + 'Überprüfen ob CSV Format eingeschaltet ist If (Zeile.StartsWith(" ... CSV-Format .......... [J/N] :")) Then CSV_Format = Zeile.Substring(35).Trim End If @@ -218,7 +216,7 @@ Public Class BlueMSim 'Fehlermeldung CSv Format nicht eingeschaltet If CSV_Format <> "J" Then - Throw New Exception("Das CSV Format für die .WEL Datei ist nicht eingeschaltet. Bitte in .ALL unter '... CSV-Format' einschalten.") + Throw New Exception("Das CSV Format für die .WEL Datei ist nicht eingeschaltet. Bitte in .ALL unter '... CSV-Format' einschalten.") End If @@ -228,7 +226,7 @@ Public Class BlueMSim #Region "Evaluierung" - 'Gibt zurück ob ein beliebiger Thread beendet ist und ibt die ID diesen freien Threads zurück + 'Gibt zurück ob ein beliebiger Thread beendet ist und ibt die ID diesen freien Threads zurück '******************************************************************************************** Protected Overrides Function ThreadFree(ByRef Thread_ID As Integer) As Boolean ThreadFree = False @@ -243,8 +241,8 @@ Public Class BlueMSim End Function - 'BlauesModell ausführen (simulieren) - 'Startet einen neuen Thread und übergibt ihm die Child ID + 'BlauesModell ausführen (simulieren) + 'Startet einen neuen Thread und übergibt ihm die Child ID '******************************************************** Protected Overrides Function launchSim(ByVal Thread_ID As Integer, ByVal Child_ID As Integer) As Boolean @@ -253,8 +251,9 @@ Public Class BlueMSim Folder = getThreadWorkDir(Thread_ID) MyBlueMThreads(Thread_ID) = New BlueMSimThread(Thread_ID, Child_ID, Folder, Datensatz, bluem_dll(Thread_ID)) - MyThreads(Thread_ID) = New Thread(AddressOf MyBlueMThreads(Thread_ID).launchSim) - MyThreads(Thread_ID).IsBackground = True + MyThreads(Thread_ID) = New Thread(AddressOf MyBlueMThreads(Thread_ID).launchSim) With { + .IsBackground = True + } MyThreads(Thread_ID).Start() launchSim = True @@ -262,7 +261,7 @@ Public Class BlueMSim End Function - 'BlueM ohne Thread ausführen + 'BlueM ohne Thread ausführen '*************************** Protected Overrides Function launchSim() As Boolean @@ -270,7 +269,7 @@ Public Class BlueMSim Try - 'Datensatz übergeben und initialisieren + 'Datensatz übergeben und initialisieren Call bluem_dll(0).Initialize(IO.Path.Combine(Me.WorkDir_Current, Me.Datensatz)) Dim SimEnde As DateTime = BlueM_EngineDotNetAccess.BlueMDate2DateTime(bluem_dll(0).GetSimulationEndDate()) @@ -289,7 +288,7 @@ Public Class BlueMSim Catch ex As Exception 'Simulationsfehler aufgetreten - Common.Log.AddMessage(Common.Log.levels.error, ex.Message) + Log.AddMessage(Log.levels.error, ex.Message) 'Simulation abschliessen Call bluem_dll(0).Finish() @@ -308,8 +307,8 @@ Public Class BlueMSim End Function - 'Prüft ob des aktuelle Child mit der ID die oben übergeben wurde fertig ist - 'Gibt die Thread ID zurück um zum auswerten in das Arbeitsverzeichnis zu wechseln + 'Prüft ob des aktuelle Child mit der ID die oben übergeben wurde fertig ist + 'Gibt die Thread ID zurück um zum auswerten in das Arbeitsverzeichnis zu wechseln '******************************************************************************** Protected Overrides Function ThreadReady(ByRef Thread_ID As Integer, ByRef SimIsOK As Boolean, ByVal Child_ID As Integer) As Boolean ThreadReady = False @@ -331,13 +330,14 @@ Public Class BlueMSim '------------------------------- Protected Overrides Sub SIM_Ergebnis_Lesen() - 'Altes Simulationsergebnis löschen + 'Altes Simulationsergebnis löschen Me.SimResult.Clear() - 'Benötigte SimReihen zusammenstellen + 'Benötigte SimReihen zusammenstellen {file: [series]} 'TODO: das braucht eigentlich nicht nach jeder Simulation nochmal neu getan zu werden - Dim SimReihen As New Dictionary(Of String, List(Of String)) '{file: [series]} - SimReihen.Add("WEL", New List(Of String)) + Dim SimReihen As New Dictionary(Of String, List(Of String)) From { + {"WEL", New List(Of String)} + } If Me.useKWL Then SimReihen.Add("KWL", New List(Of String)) End If @@ -357,15 +357,15 @@ Public Class BlueMSim 'WEL-Datei einlesen '------------------ - Dim WELtmp As Wave.Fileformats.WEL = New Wave.Fileformats.WEL(IO.Path.Combine(Me.WorkDir_Current, Me.Datensatz & ".WEL")) + Dim WELtmp As New Wave.Fileformats.WEL(IO.Path.Combine(Me.WorkDir_Current, Me.Datensatz & ".WEL")) - 'Benötigte Reihen für Import selektieren + 'Benötigte Reihen für Import selektieren For Each series As String In SimReihen("WEL") WELtmp.selectSeries(series) Next 'Datei einlesen WELtmp.readFile() - 'Zeitreihen übernehmen + 'Zeitreihen übernehmen For Each zre As Wave.TimeSeries In WELtmp.TimeSeries.Values Me.SimResult.Series.Add(zre.Title, zre) Next @@ -375,15 +375,15 @@ Public Class BlueMSim If (Me.useKWL) Then Dim KWLpath As String = IO.Path.Combine(Me.WorkDir_Current, Me.Datensatz & ".KWL") - Dim KWLtmp As Wave.Fileformats.WEL = New Wave.Fileformats.WEL(KWLpath) + Dim KWLtmp As New Wave.Fileformats.WEL(KWLpath) - 'Benötigte Reihen für Import selektieren + 'Benötigte Reihen für Import selektieren For Each series As String In SimReihen("KWL") KWLtmp.selectSeries(series) Next 'Datei einlesen KWLtmp.readFile() - 'Zeitreihen übernehmen + 'Zeitreihen übernehmen For Each zre As Wave.TimeSeries In KWLtmp.TimeSeries.Values Me.SimResult.Series.Add(zre.Title, zre) Next @@ -394,12 +394,12 @@ Public Class BlueMSim #End Region 'Evaluierung -#Region "Qualitätswertberechnung" +#Region "Qualitätswertberechnung" - 'Qualitätswert aus PRB-Datei + 'Qualitätswert aus PRB-Datei 'TODO: PRB geht nicht (#153) '*********************** - Private Function CalculateObjective_PRB(ByVal objective As Common.ObjectiveFunction) As Double + Private Function CalculateObjective_PRB(ByVal objective As ObjectiveFunction) As Double 'Dim i As Integer 'Dim IsOK As Boolean @@ -411,9 +411,9 @@ Public Class BlueMSim ''Diff ''---- - ''Überflüssige Stützstellen (P) entfernen + ''Überflüssige Stützstellen (P) entfernen ''--------------------------------------- - ''Anzahl Stützstellen bestimmen + ''Anzahl Stützstellen bestimmen 'Dim stuetz As Integer = 0 'Dim P_vorher As Double = -99 'For i = 0 To SimReihe.GetUpperBound(0) @@ -433,16 +433,16 @@ Public Class BlueMSim ' stuetz += 1 ' End If 'Next - ''Reihe um eine Stützstelle erweitern + ''Reihe um eine Stützstelle erweitern ''PRBtmp(stuetz, 0) = PRBtmp(stuetz - 1, 0) ''PRBtmp(stuetz, 1) = PRBtmp(stuetz - 1, 1) - ''An Stützstellen der ZielReihe interpolieren + ''An Stützstellen der ZielReihe interpolieren ''------------------------------------------- 'Dim PRBintp(ziel.ZielReihe.GetUpperBound(0), 1) As Object 'Dim j As Integer 'For i = 0 To ziel.ZielReihe.GetUpperBound(0) - ' 'zugehörige Lamelle in SimReihe finden + ' 'zugehörige Lamelle in SimReihe finden ' j = 0 ' Do While (PRBtmp(j, 1) < ziel.ZielReihe(i, 1)) ' j += 1 @@ -470,9 +470,9 @@ Public Class BlueMSim Dim Zeile As String Read_PRB = True - Dim FiStr As FileStream = New FileStream(DateiPfad, FileMode.Open, IO.FileAccess.ReadWrite) - Dim StrRead As StreamReader = New StreamReader(FiStr, System.Text.Encoding.GetEncoding("iso8859-1")) - Dim StrReadSync As TextReader = TextReader.Synchronized(StrRead) + Dim FiStr As New IO.FileStream(DateiPfad, IO.FileMode.Open, IO.FileAccess.ReadWrite) + Dim StrRead As New IO.StreamReader(FiStr, Text.Encoding.GetEncoding("iso8859-1")) + Dim StrReadSync As IO.TextReader = IO.TextReader.Synchronized(StrRead) 'Array redimensionieren ReDim PRB(AnzZeil - 1, 1) @@ -485,7 +485,7 @@ Public Class BlueMSim End If Loop Until StrRead.Peek() = -1 - 'Zeile mit Spaltenüberschriften überspringen + 'Zeile mit Spaltenüberschriften überspringen Zeile = StrRead.ReadLine.ToString For j = 0 To AnzZeil - 1 @@ -497,9 +497,9 @@ Public Class BlueMSim StrRead.Close() FiStr.Close() - 'Überflüssige Stützstellen (P) entfernen + 'Überflüssige Stützstellen (P) entfernen '--------------------------------------- - 'Anzahl Stützstellen bestimmen + 'Anzahl Stützstellen bestimmen Dim stuetz As Integer = 0 Dim P_vorher As Double = -99 For j = 0 To PRB.GetUpperBound(0) @@ -523,7 +523,7 @@ Public Class BlueMSim End Function -#End Region 'Qualitätswertberechnung +#End Region 'Qualitätswertberechnung #End Region 'Methoden diff --git a/BlueM.Opt/Apps/BlueM/BlueMThread.vb b/BlueM.Opt/Apps/BlueM/BlueMThread.vb index 1c6e6620..8809de92 100644 --- a/BlueM.Opt/Apps/BlueM/BlueMThread.vb +++ b/BlueM.Opt/Apps/BlueM/BlueMThread.vb @@ -18,6 +18,7 @@ 'Klasse beinhaltet alle Infomationen für einen Simulationslauf im Thread '*********************************************************************** Imports BlueM.DllAdapter +Imports BlueM.Opt.Common Public Class BlueMSimThread @@ -45,7 +46,7 @@ Public Class BlueMSimThread Me.launchReady = False 'Priority - System.Threading.Thread.CurrentThread.Priority = Threading.ThreadPriority.Normal + Threading.Thread.CurrentThread.Priority = Threading.ThreadPriority.Normal Try 'Datensatz übergeben und initialisieren @@ -67,7 +68,7 @@ Public Class BlueMSimThread Catch ex As Exception 'Simulationsfehler aufgetreten - Common.Log.AddMessage(Common.Log.levels.error, ex.Message) + Log.AddMessage(Log.levels.error, ex.Message) 'Simulation abschliessen Call bluem_dll.Finish() diff --git a/BlueM.Opt/Apps/SMUSI/Smusi.vb b/BlueM.Opt/Apps/SMUSI/Smusi.vb deleted file mode 100644 index 48c5e9b4..00000000 --- a/BlueM.Opt/Apps/SMUSI/Smusi.vb +++ /dev/null @@ -1,383 +0,0 @@ -'BlueM.Opt -'Copyright (C) BlueM Dev Group -'Website: -' -'This program is free software: you can redistribute it and/or modify -'it under the terms of the GNU General Public License as published by -'the Free Software Foundation, either version 3 of the License, or -'(at your option) any later version. -' -'This program is distributed in the hope that it will be useful, -'but WITHOUT ANY WARRANTY; without even the implied warranty of -'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -'GNU General Public License for more details. -' -'You should have received a copy of the GNU General Public License -'along with this program. If not, see . -' -Imports System.IO -Imports IHWB.SMUSI.DllAdapter - -''' -''' Klasse SMUSI -''' Funktionen zur Kontrolle von SMUSI -''' -Public Class Smusi - Inherits Sim - -#Region "Eigenschaften" - - 'Eigenschaften - '############# - - Private Const useSmusiExe As Boolean = False 'true = EXE, false = DLL - - 'SMUSI DLL - '--------- - Private dll_path As String - Private smusi_dll As SMUSI_EngineDotNetAccess - -#End Region 'Eigenschaften - -#Region "Properties" - - ''' - ''' Alle Dateiendungen (ohne Punkt), die in einem Datensatz vorkommen können - ''' - ''' Die erste Dateiendung in dieser Collection repräsentiert den Datensatz (wird z.B. als Filter für OpenFile-Dialoge verwendet) - Public Overrides ReadOnly Property DatensatzDateiendungen() As Collections.Specialized.StringCollection - Get - Dim exts As New Collections.Specialized.StringCollection() - - exts.AddRange(New String() {"ALL", "AUS", "BEK", "BKL", "BOF", "BWN", "DRO", - "EIN", "FKA", "JGG", "KLA", "RKL", "RUE", "SAM", - "SMZ", "SOP", "SYS", "TGG", "VER", "WIN", "WMB", - "XYZ"}) - - 'TODO: Dateiendungen für SMUSI-Datensatz auf Komplettheit prüfen - - Return exts - - End Get - End Property - - ''' - ''' Ob die Anwendung Multithreading unterstützt - ''' - ''' False - Public Overrides ReadOnly Property MultithreadingSupported() As Boolean - Get - Return False - End Get - End Property - -#End Region 'Properties - -#Region "Methoden" - - 'Methoden - '######## - - 'Konstruktor - '*********** - Public Sub New() - - Call MyBase.New() - - If (Not useSmusiExe) Then - - 'SMUSI DLL instanzieren - '---------------------- - Me.dll_path = IO.Path.Combine(System.Windows.Forms.Application.StartupPath(), "SMUSI\smusi.dll") - - If (File.Exists(Me.dll_path)) Then - Me.smusi_dll = New SMUSI_EngineDotNetAccess(Me.dll_path) - Else - Throw New Exception("SMUSI.dll nicht gefunden!") - End If - End If - - End Sub - - 'Simulationsparameter einlesen - '***************************** - Protected Overrides Sub Read_SimParameter() - - Dim SimStart_str As String = "" - Dim SimEnde_str As String = "" - - 'ALL-Datei öffnen - '---------------- - Dim Datei As String = IO.Path.Combine(Me.WorkDir_Original, Me.Datensatz & ".ALL") - - Dim FiStr As FileStream = New FileStream(Datei, FileMode.Open, IO.FileAccess.ReadWrite) - Dim StrRead As StreamReader = New StreamReader(FiStr, System.Text.Encoding.GetEncoding("iso8859-1")) - Dim StrReadSync As TextReader = TextReader.Synchronized(StrRead) - - 'Alle Zeilen durchlaufen - Dim Zeile As String - Do - Zeile = StrRead.ReadLine.ToString() - - 'Simulationszeitraum auslesen - If (Zeile.StartsWith(" SimBeginn - SimEnde")) Then - SimStart_str = Zeile.Substring(37, 16) - SimEnde_str = Zeile.Substring(56, 16) - Exit Do 'Sobald das Datum gefunden wurde, kann die schleife verlassen werden - End If - - Loop Until StrRead.Peek() = -1 - - 'Schließen der ALL-Datei - StrReadSync.Close() - StrRead.Close() - FiStr.Close() - - 'SimStart und SimEnde in echtes Datum konvertieren - Me.SimStart = New DateTime(SimStart_str.Substring(6, 4), SimStart_str.Substring(3, 2), SimStart_str.Substring(0, 2), SimStart_str.Substring(11, 2), SimStart_str.Substring(14, 2), 0) - Me.SimEnde = New DateTime(SimEnde_str.Substring(6, 4), SimEnde_str.Substring(3, 2), SimEnde_str.Substring(0, 2), SimEnde_str.Substring(11, 2), SimEnde_str.Substring(14, 2), 0) - - 'Zeitschrittweite ist immer 5 Minuten - Me.SimDT = New TimeSpan(0, 5, 0) - - End Sub - - 'SMUSI ausführen (simulieren) - '**************************** - Protected Overrides Function launchSim() As Boolean - - Dim simOK As Boolean - Dim SimCurrent, SimStart, SimEnde As DateTime - - If (useSmusiExe) Then - - 'verwende SMUSI.Win.exe - '---------------------- - Dim exe_path As String - Dim String1 As String - Dim String3 As String - Dim String4 As String - - exe_path = IO.Path.Combine(System.Windows.Forms.Application.StartupPath(), "SMUSI.WIN.exe") - String1 = exe_path - String3 = IO.Path.Combine(Me.WorkDir_Current, Me.Datensatz & ".all") - String4 = """" - - Dim ExterneAnwendung As New System.Diagnostics.Process() - - ExterneAnwendung.StartInfo.FileName = String1 - ExterneAnwendung.StartInfo.Arguments = String4 & String3 & String4 - ExterneAnwendung.StartInfo.CreateNoWindow = True - ExterneAnwendung.Start() - - Do While (Not ExterneAnwendung.HasExited) - ExterneAnwendung.WaitForExit(250) - Loop - - If Not ExterneAnwendung.HasExited Then - ExterneAnwendung.Kill() - End If - ExterneAnwendung = Nothing - - - If File.Exists(IO.Path.Combine(Me.WorkDir_Current, Me.Datensatz & ".sum")) Then - simOK = True - Else - simOK = False - End If - - Else - - 'verwende SMUSI.dll und SMUSI.DllAdapter.dll - '------------------------------------------- - - 'SMUSI DLL neu instanzieren (muss das sein?) - '------------------------------------------- - Me.smusi_dll = Nothing - - Me.smusi_dll = New SMUSI_EngineDotNetAccess(dll_path) - - 'Falls vorher schon initialisiert wurde - Call Me.smusi_dll.Finish() - Call Me.smusi_dll.Dispose() - - Try - - Call smusi_dll.Initialize(IO.Path.Combine(Me.WorkDir_Current, Me.Datensatz)) - - 'Dim SimEnde As DateTime = SMUSI_EngineDotNetAccess.DateTime(smusi_dll.GetSimulationEndDate()) - - ''Simulationszeitraum - 'Do While (SMUSI_EngineDotNetAccess.DateTime(smusi_dll.GetCurrentTime) < SimEnde) - ' Call smusi_dll.PerformTimeStep() - 'Loop - 'Simulationsdaten auslesen - SimStart = SMUSI_EngineDotNetAccess.DateTime(smusi_dll.GetSimulationStartDate()) - SimEnde = SMUSI_EngineDotNetAccess.DateTime(smusi_dll.GetSimulationEndDate()) - SimCurrent = SimStart - Do While (SimCurrent < SimEnde) - - Call smusi_dll.PerformTimeStep() - 'Me.ProgressBar1.PerformStep() - - SimCurrent = SMUSI_EngineDotNetAccess.DateTime(smusi_dll.GetCurrentTime) - - 'If (SimCurrent.Hour = 0 And SimCurrent.Minute = 0) Then - ' 'Nach Warnungen überprüfen - ' 'Call checkForWarnings() - ' 'Anzeige aktualisieren - ' Me.Label_SimDate.Text = SimCurrent - 'End If - - Loop - - 'Simulation erfolgreich - simOK = True - - Catch ex As Exception - - 'Simulationsfehler aufgetreten - MsgBox(ex.Message, MsgBoxStyle.Exclamation, "SMUSI") - simOK = False - - Finally - - Call Me.smusi_dll.Finish() - Call Me.smusi_dll.Dispose() - - End Try - - Me.smusi_dll = Nothing - - End If - - Return simOK - - End Function - - 'TODO: SMUSI Thread-Funktionen - '############################# - Protected Overrides Function launchSim(ByVal Thread_ID As Integer, ByVal Child_ID As Integer) As Boolean - Return Me.launchSim() - End Function - - Protected Overrides Function ThreadFree(ByRef Thread_ID As Integer) As Boolean - Return True - End Function - - Protected Overrides Function ThreadReady(ByRef Thread_ID As Integer, ByRef SimIsOK As Boolean, ByVal Child_ID As Integer) As Boolean - Return True - End Function - - 'Simulationsergebnis verarbeiten - '------------------------------- - Protected Overrides Sub SIM_Ergebnis_Lesen() - - Dim datei As String, DateiPfad As String, element As String, Zeile As String - Dim ASCtmp As Wave.Fileformats.ASC - Dim SpalteVon As Long, SpalteLen As Long, BezVon As Integer - Dim blnValueAdded As Boolean - - 'Altes SimErgebnis löschen - Me.SimResult.Clear() - - 'Neu Steffen - For Each obj As Common.ObjectiveFunction In Me.mProblem.List_ObjectiveFunctions - 'Unterscheidung nach ObjectiveType - Select Case obj.GetObjType - Case Common.ObjectiveFunction.ObjectiveType.Series - element = obj.SimResultName.Substring(0, 4) - datei = element & "_WEL.ASC" - ASCtmp = New Wave.Fileformats.ASC(IO.Path.Combine(Me.WorkDir_Current, datei), True) - 'Simulationsergebnis abspeichern - For Each zre As Wave.TimeSeries In ASCtmp.TimeSeries.Values - Me.SimResult.Series.Add(element & "_" & zre.Title, zre) - Next - ASCtmp = Nothing - 'Next - Case Common.ObjectiveFunction.ObjectiveType.Value - 'TODO: Umbauen, so dass Datei nicht jedes mal geoeffnet werden muss - '.RPT-Datei oeffnen - DateiPfad = IO.Path.Combine(WorkDir_Current, Datensatz & "." & obj.FileExtension) - Dim FiStr As FileStream = New FileStream(DateiPfad, FileMode.Open, IO.FileAccess.Read) - Dim StrRead As StreamReader = New StreamReader(FiStr, System.Text.Encoding.GetEncoding("iso8859-1")) - Dim KeyWord_Block As String - Dim tmpValue As Double - 'Datei durchgehen und mit Block und Spaltenangabe aus obj den gesuchten Wert ermitteln - 'und diesen dann in Sim_Ergebnis schreiben - Dim objValue As Common.Objectivefunction_Value - objValue = obj - Select Case objValue.Block - Case "EntlVolumen" - KeyWord_Block = "* Zulauf" - Select Case objValue.Column - Case "SumVol" - SpalteVon = 116 - SpalteLen = 10 - BezVon = 3 - Case Else - Throw New Exception("Das Schluesselwort für die Spalte ist ungueltig!") - End Select - Case "MaxAbfluss" - KeyWord_Block = "* Maximal" - Select Case objValue.Column - Case "Qmax" - SpalteVon = 22 - SpalteLen = 7 - BezVon = 3 - Case Else - Throw New Exception("Das Schluesselwort für die Spalte ist ungueltig!") - End Select - Case "EntlFracht" - KeyWord_Block = "* Schmutzfracht" - Select Case objValue.Column - Case "CSBspez" - SpalteVon = 108 - SpalteLen = 5 - BezVon = 27 - Case Else - Throw New Exception("Das Schluesselwort für die Spalte ist ungueltig!") - End Select - Case Else - Throw New Exception("Das Schluesselword für den Block ist ungueltig") - End Select - 'Datei durchgehen und nach Schluesselwort suchen - blnValueAdded = False - Do - Zeile = Trim(StrRead.ReadLine.ToString) - Debug.Print(Zeile) - If (Zeile.StartsWith(KeyWord_Block)) Then - Do - Zeile = StrRead.ReadLine.ToString - If (Trim(Zeile.Substring(BezVon, 4)) = obj.SimResultName) Then - tmpValue = Convert.ToDouble(Zeile.Substring(SpalteVon, SpalteLen)) - Me.SimResult.Values.Add(obj.Description, tmpValue) - blnValueAdded = True - Exit Do - End If - Loop Until StrRead.Peek() = -1 - End If - If blnValueAdded Then Exit Do - Loop Until StrRead.Peek() = -1 - StrRead.Close() - FiStr.Close() - - - Case Common.ObjectiveFunction.ObjectiveType.ValueFromSeries - 'TODO - Case Else - 'TODO - End Select - Next - 'Ende neu Steffen - - 'Dateien einlesen - - - 'elemente = Nothing - - End Sub - -#End Region 'Methoden - -End Class diff --git a/BlueM.Opt/Apps/SWMM/IHWB.SWMM.DllAdapter.dll b/BlueM.Opt/Apps/SWMM/IHWB.SWMM.DllAdapter.dll deleted file mode 100644 index 8cfd8e04..00000000 Binary files a/BlueM.Opt/Apps/SWMM/IHWB.SWMM.DllAdapter.dll and /dev/null differ diff --git a/BlueM.Opt/Apps/SWMM/SWMM.vb b/BlueM.Opt/Apps/SWMM/SWMM.vb deleted file mode 100644 index 74f4c73f..00000000 --- a/BlueM.Opt/Apps/SWMM/SWMM.vb +++ /dev/null @@ -1,462 +0,0 @@ -'BlueM.Opt -'Copyright (C) BlueM Dev Group -'Website: -' -'This program is free software: you can redistribute it and/or modify -'it under the terms of the GNU General Public License as published by -'the Free Software Foundation, either version 3 of the License, or -'(at your option) any later version. -' -'This program is distributed in the hope that it will be useful, -'but WITHOUT ANY WARRANTY; without even the implied warranty of -'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -'GNU General Public License for more details. -' -'You should have received a copy of the GNU General Public License -'along with this program. If not, see . -' -Imports System.IO -Imports IHWB.SWMM.DLLAdapter -Imports System.Threading - -''' -''' Klasse SWMM -''' Funktionen zur Kontrolle von EPA SWMM5 -''' -Public Class SWMM - Inherits Sim - -#Region "Eigenschaften" - - 'Eigenschaften - '############# - - 'SWMM DLL - '--------- - Private dll_path As String - Private swmm_dll() As SWMM_EngineDotNetAccess - - 'Multithreading - '-------------- - Dim MySWMMThreads() As SWMMThread - Dim MyThreads() As Thread - -#End Region 'Eigenschaften - -#Region "Properties" - - ''' - ''' Alle Dateiendungen (ohne Punkt), die in einem Datensatz vorkommen können - ''' - ''' Die erste Dateiendung in dieser Collection repräsentiert den Datensatz (wird z.B. als Filter für OpenFile-Dialoge verwendet) - Public Overrides ReadOnly Property DatensatzDateiendungen() As Collections.Specialized.StringCollection - Get - Dim exts As New Collections.Specialized.StringCollection() - - exts.AddRange(New String() {"INP", "DAT", "INI"}) - - Return exts - - End Get - End Property - - ''' - ''' Ob die Anwendung Multithreading unterstützt - ''' - ''' True - Public Overrides ReadOnly Property MultithreadingSupported() As Boolean - Get - Return True - End Get - End Property - -#End Region 'Properties - -#Region "Methoden" - - 'Methoden - '######## - - 'Konstruktor - '*********** - Public Sub New() - - Call MyBase.New() - - 'Pfad zu SWMM5.DLL bestimmen - '--------------------------- - dll_path = IO.Path.Combine(System.Windows.Forms.Application.StartupPath(), "SWMM\SWMM5.dll") - - If (Not File.Exists(dll_path)) Then - Throw New Exception("SWMM.dll nicht gefunden!") - End If - - End Sub - - ''' - ''' SWMM Simulationen vorbereiten - ''' - Public Overrides Sub prepareSimulation() - - Call MyBase.prepareSimulation() - - 'SWMM DLL instanzieren je nach Anzahl der Threads - '------------------------------------------------ - If swmm_dll Is Nothing Then - ReDim swmm_dll(Me.n_Threads - 1) - Dim i As Integer - - For i = 0 To Me.n_Threads - 1 - 'toDo: prüfen, ob schon instanziert - swmm_dll(i) = New SWMM_EngineDotNetAccess(dll_path) - Next - End If - - 'Thread-Objekte instanzieren - ReDim MySWMMThreads(Me.n_Threads - 1) - For i = 0 To Me.n_Threads - 1 - MySWMMThreads(i) = New SWMMThread(i, -1, "Folder", Datensatz, swmm_dll(i)) - MySWMMThreads(i).set_is_OK() - Next - ReDim MyThreads(Me.n_Threads - 1) - - End Sub - - 'Simulationsparameter einlesen - '***************************** - Protected Overrides Sub Read_SimParameter() - - Dim SimStart_Date_str As String = "" - Dim SimEnde_Date_str As String = "" - Dim SimStart_Time_str As String = "" - Dim SimEnde_Time_str As String = "" - Dim ROUTING_STEP_str As String = "" - - 'INP-Datei öffnen - '---------------- - Dim Datei As String = IO.Path.Combine(Me.WorkDir_Original, Me.Datensatz & ".inp") - - Dim FiStr As FileStream = New FileStream(Datei, FileMode.Open, IO.FileAccess.ReadWrite) - Dim StrRead As StreamReader = New StreamReader(FiStr, System.Text.Encoding.GetEncoding("iso8859-1")) - Dim StrReadSync As TextReader = TextReader.Synchronized(StrRead) - - 'Alle Zeilen durchlaufen - Dim Zeile As String - Dim readok As Integer = 0 - Do - Zeile = StrRead.ReadLine.ToString() - 'Simulationszeitraum auslesen - - If Zeile.StartsWith("START_DATE") Then - SimStart_Date_str = Zeile.Substring(21, 10) - readok += 1 - ElseIf Zeile.StartsWith("START_TIME") Then - SimStart_Time_str = Zeile.Substring(21, 8) - readok += 1 - ElseIf Zeile.StartsWith("END_DATE") Then - SimEnde_Date_str = Zeile.Substring(21, 10) - readok += 1 - ElseIf Zeile.StartsWith("END_TIME") Then - SimEnde_Time_str = Zeile.Substring(21, 8) - readok += 1 - ElseIf Zeile.StartsWith("ROUTING_STEP") Then - ROUTING_STEP_str = Zeile.Substring(21, 7) - End If - If readok > 4 Then Exit Do 'Sobald alle Bestandteile des Datum - 'und des Zeitschrittes gefunden wurde, - 'kann die Schleife verlassen werden - Loop Until StrRead.Peek() = -1 - - 'Schließen der INP-Datei - StrReadSync.Close() - StrRead.Close() - FiStr.Close() - - 'SimStart und SimEnde in echtes Datum konvertieren - Me.SimStart = New DateTime(SimStart_Date_str.Substring(6, 4), SimStart_Date_str.Substring(0, 2), SimStart_Date_str.Substring(3, 2), SimStart_Time_str.Substring(0, 2), SimStart_Time_str.Substring(3, 2), SimStart_Time_str.Substring(6, 2)) - Me.SimEnde = New DateTime(SimEnde_Date_str.Substring(6, 4), SimEnde_Date_str.Substring(0, 2), SimEnde_Date_str.Substring(3, 2), SimEnde_Time_str.Substring(0, 2), SimEnde_Time_str.Substring(3, 2), SimEnde_Time_str.Substring(6, 2)) - - 'Zeitschrittweite ist variable - Me.SimDT = New TimeSpan(ROUTING_STEP_str.Substring(0, 1), ROUTING_STEP_str.Substring(2, 2), ROUTING_STEP_str.Substring(5, 2)) - - End Sub - - 'SWMM ausführen (simulieren) - 'Startet einen neuen Thread und übergibt ihm die Child ID - '******************************************************** - Protected Overrides Function launchSim(ByVal Thread_ID As Integer, ByVal Child_ID As Integer) As Boolean - - launchSim = False - Dim Folder As String - - Folder = getThreadWorkDir(Thread_ID) - MySWMMThreads(Thread_ID) = New SWMMThread(Thread_ID, Child_ID, Folder, Datensatz, swmm_dll(Thread_ID)) - MyThreads(Thread_ID) = New Thread(AddressOf MySWMMThreads(Thread_ID).launchSim) - MyThreads(Thread_ID).IsBackground = True - MyThreads(Thread_ID).Start() - launchSim = True - - Return launchSim - - End Function - - 'SWMM ohne Thread ausführen (simulieren) - '**************************** - Protected Overrides Function launchSim() As Boolean - - Dim simOK As Boolean - - Try - - Call swmm_dll(0).Initialize(IO.Path.Combine(Me.WorkDir_Current, Me.Datensatz)) - Call swmm_dll(0).Start(1) - - Dim elapsedTime As Double = 0.0 - - Do - Call swmm_dll(0).PerformTimeStep(elapsedTime) - Loop While (elapsedTime > 0.0) - - 'Simulation abschliessen - Call swmm_dll(0).Finish() - - ''überprüfen, ob Simulation erfolgreich - ''------------------------------------- - ''rpt-Datei öffnen - 'Dim FiStr As FileStream = New FileStream(IO.Path.Combine(Me.WorkDir_Current, Me.Datensatz & ".rpt"), FileMode.Open, IO.FileAccess.ReadWrite) - 'Dim StrRead As StreamReader = New StreamReader(FiStr, System.Text.Encoding.GetEncoding("iso8859-1")) - 'Dim StrReadSync As TextReader = TextReader.Synchronized(StrRead) - - ''Alle Zeilen durchlaufen - 'Dim Zeile As String - 'simOK = False - 'Do - ' Zeile = StrRead.ReadLine.ToString() - ' If (Zeile.StartsWith(" Runoff Quantity Continuity")) Then - ' simOK = True - ' Exit Do - ' End If - - 'Loop Until StrRead.Peek() = -1 - - 'StrReadSync.Close() - 'StrRead.Close() - 'FiStr.Close() - - 'Simulation abschliessen - Call swmm_dll(0).Finish() - - 'Simulation erfolgreich - simOK = True - - Catch ex As Exception - - 'Simulationsfehler aufgetreten - MsgBox(ex.Message, MsgBoxStyle.Exclamation, "SWMM") - - 'Simulation nicht erfolgreich - simOK = False - - Finally - - 'Ressourcen deallokieren - Call swmm_dll(0).Dispose() - - End Try - - Return simOK - - End Function - - 'Gibt zurück ob ein beliebiger Thread beendet ist und ibt die ID diesen freien Threads zurück - '******************************************************************************************** - Protected Overrides Function ThreadFree(ByRef Thread_ID As Integer) As Boolean - ThreadFree = False - - For Each Thr_C As SWMMThread In MySWMMThreads - If Thr_C.Sim_Is_OK = True And Thr_C.get_Child_ID = -1 Then - ThreadFree = True - Thread_ID = Thr_C.get_Thread_ID - Exit For - End If - Next - - End Function - - 'Prüft ob des aktuelle Child mit der ID die oben übergeben wurde fertig ist - 'Gibt die Thread ID zurück um zum auswerten in das Arbeitsverzeichnis zu wechseln - '******************************************************************************** - Protected Overrides Function ThreadReady(ByRef Thread_ID As Integer, ByRef SimIsOK As Boolean, ByVal Child_ID As Integer) As Boolean - ThreadReady = False - - For Each Thr_C As SWMMThread In MySWMMThreads - If Thr_C.launch_Ready = True And Thr_C.get_Child_ID = Child_ID Then - ThreadReady = True - SimIsOK = Thr_C.Sim_Is_OK - Thread_ID = Thr_C.get_Thread_ID - MyThreads(Thread_ID).Join() - MySWMMThreads(Thread_ID) = New SWMMThread(Thread_ID, -1, "Folder", Datensatz, swmm_dll(Thread_ID)) - MySWMMThreads(Thread_ID).set_is_OK() - End If - Next - - End Function - - 'Simulationsergebnis einlesen - '---------------------------- - Protected Overrides Sub SIM_Ergebnis_Lesen() - - 'TODO: Objectives durchgehen und erforderliche Werte in SimErgebnis speichern (#2) - 'bisher nur Einlesen der RPT-Datei moeglich - 'Einlesen des Binaerfiles mit den Ganglinien spaeter dazunehmen - Dim DateiPfad As String - Dim Zeile As String - - 'Altes Simulationsergebnis löschen - Me.SimResult.Clear() - - 'Ablauf - 'Durchgehen aller ObjectiveFunctions - Objekte - 'Einlesen in das Objekt SimErgebnis - - For Each obj As Common.ObjectiveFunction In Me.mProblem.List_ObjectiveFunctions - - 'Unterscheidung nach ObjectiveType - Select Case obj.GetObjType - Case Common.ObjectiveFunction.ObjectiveType.Series - 'TODO - 'Zeitreihe einlesen - Case Common.ObjectiveFunction.ObjectiveType.Value - 'TODO: Umbauen, so dass Datei nicht jedes mal geoeffnet werden muss - '.RPT-Datei oeffnen - DateiPfad = IO.Path.Combine(WorkDir_Current, Datensatz & "." & obj.FileExtension) - Dim FiStr As FileStream = New FileStream(DateiPfad, FileMode.Open, IO.FileAccess.Read) - Dim StrRead As StreamReader = New StreamReader(FiStr, System.Text.Encoding.GetEncoding("iso8859-1")) - Dim KeyWord_Block As String, KeyWord_SimGr As String - Dim NoSpalte As Short - Dim tmpValue As Double - Dim blnValueAdded As Boolean - 'Datei durchgehen und mit Block und Spaltenangabe aus obj den gesuchten Wert ermitteln - 'und diesen dann in Sim_Ergebnis schreiben - Dim objValue As Common.Objectivefunction_Value - objValue = obj - Select Case objValue.Block - Case "NodeFlooding" - KeyWord_Block = " Node Flooding Summary" - Select Case objValue.Column - Case "HoursFlooded" - NoSpalte = 2 - Case "FloodVolume" - NoSpalte = 6 - Case Else - Throw New Exception("Das Schluesselwort für die Spalte ist ungueltig!") - End Select - Case "StorageVolume" - KeyWord_Block = " Storage Volume Summary" - Select Case objValue.Column - Case "AvgVolume" - NoSpalte = 2 - Case "AvgPctFull" - NoSpalte = 3 - Case "MaxVolume" - NoSpalte = 4 - Case "MaxPctFull" - NoSpalte = 5 - Case "MaxOutflow" - NoSpalte = 8 - Case Else - Throw New Exception("Das Schluesselwort für die Spalte ist ungueltig!") - End Select - Case "OutfallLoad" - KeyWord_Block = " Outfall Loading Summary" - Select Case objValue.Column - Case "MaxFlow" - NoSpalte = 4 - Case "FlowVolume" - NoSpalte = 5 - Case "Pollutant_01" - NoSpalte = 6 - Case "Pollutant_02" - NoSpalte = 7 - Case "Pollutant_03" - NoSpalte = 8 - Case "Pollutant_04" - NoSpalte = 9 - Case "Pollutant_05" - NoSpalte = 10 - Case "Pollutant_06" - NoSpalte = 11 - Case Else - Throw New Exception("Das Schluesselwort für die Spalte ist ungueltig!") - End Select - Case "LinkFlow" - KeyWord_Block = " Link Flow Summary" - Case "ConduitSurcharge" - KeyWord_Block = " Conduit Surcharge Summary" - Case "Pumping" - KeyWord_Block = " Pumping Summary" - Select Case objValue.Column - Case "OnlineTime" - NoSpalte = 2 - Case "TotalEnergy" - NoSpalte = 6 - Throw New Exception("Das Schluesselwort für die Spalte ist ungueltig!") - End Select - Case Else - Throw New Exception("Das Schluesselword für den Block ist ungueltig") - End Select - 'Datei durchgehen und nach Schluesselwort suchen - blnValueAdded = False - Do - KeyWord_SimGr = " " & objValue.SimResultName - Zeile = StrRead.ReadLine.ToString - If (Zeile.StartsWith(KeyWord_Block)) Then - Zeile = StrRead.ReadLine.ToString 'Es folgt immer eine Zeile mit Sternen - Zeile = StrRead.ReadLine.ToString 'und dann noch eine Leerzeile - Do - Zeile = StrRead.ReadLine.ToString - If (Zeile.StartsWith(KeyWord_SimGr)) Then - tmpValue = Convert.ToDouble(Zeile.Split(" ", options:=StringSplitOptions.RemoveEmptyEntries)(NoSpalte - 1), Common.Provider.FortranProvider) - Me.SimResult.Values.Add(obj.Description, tmpValue) - blnValueAdded = True - Exit Do - 'Falls keine Nodes überstaut sind bei Node Flooding Summary muss geährleistet werden, - 'dass der Wert 0 übergeben wird. - 'Select Case objValue.Block - ' Case "NodeFlooding" - ' If Zeile.TrimStart.StartsWith("No nodes were flooded.") Then - ' tmpValue = 0.0 - ' Me.SimErgebnis.Werte.Add(obj.Bezeichnung, tmpValue) - ' blnValueAdded = True - ' Exit Do - 'Case Else - 'End Select - 'Wenn die SimGr nicht im Block auftaucht muss tmpvalue = 0 gesetzt werden - ElseIf Zeile.TrimStart.StartsWith("**********************") Then 'nächster Block beginnt - tmpValue = 0.0 - Me.SimResult.Values.Add(obj.Description, tmpValue) - blnValueAdded = True - Exit Do - End If - Loop Until StrRead.Peek() = -1 - End If - If blnValueAdded Then Exit Do - Loop Until StrRead.Peek() = -1 - StrRead.Close() - FiStr.Close() - - - Case Common.ObjectiveFunction.ObjectiveType.ValueFromSeries - 'TODO - Case Else - 'TODO - End Select - Next - - - End Sub - -#End Region 'Methoden - -End Class - diff --git a/BlueM.Opt/Apps/SWMM/SWMM5.dll b/BlueM.Opt/Apps/SWMM/SWMM5.dll deleted file mode 100644 index c4753fce..00000000 Binary files a/BlueM.Opt/Apps/SWMM/SWMM5.dll and /dev/null differ diff --git a/BlueM.Opt/Apps/SWMM/SWMMThread.vb b/BlueM.Opt/Apps/SWMM/SWMMThread.vb deleted file mode 100644 index e64be723..00000000 --- a/BlueM.Opt/Apps/SWMM/SWMMThread.vb +++ /dev/null @@ -1,116 +0,0 @@ -'BlueM.Opt -'Copyright (C) BlueM Dev Group -'Website: -' -'This program is free software: you can redistribute it and/or modify -'it under the terms of the GNU General Public License as published by -'the Free Software Foundation, either version 3 of the License, or -'(at your option) any later version. -' -'This program is distributed in the hope that it will be useful, -'but WITHOUT ANY WARRANTY; without even the implied warranty of -'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -'GNU General Public License for more details. -' -'You should have received a copy of the GNU General Public License -'along with this program. If not, see . -' -'Klasse beinhaltet alle Infomationen für einen Simulationslauf im Thread -'*********************************************************************** -Imports IHWB.SWMM.DllAdapter - -Public Class SWMMThread - - Private Thread_ID As Integer - Private Child_ID As Integer - Private WorkFolder As String - Private DS_Name As String - Private SWMM_dll As SWMM_EngineDotNetAccess - Private SimIsOK As Boolean - Private launchReady As Boolean - - Public Sub New(ByVal _Thread_ID As Integer, ByVal _Child_ID As Integer, ByVal _WorkFolder As String, ByVal _DS_Name As String, ByRef _SWMM_dll As SWMM_EngineDotNetAccess) - Me.Thread_ID = _Thread_ID - Me.Child_ID = _Child_ID - Me.WorkFolder = _WorkFolder - Me.DS_Name = _DS_Name - Me.SWMM_dll = _SWMM_dll - End Sub - - 'Die Funktion startet die Simulation mit dem entsprechendem WorkingDir - '********************************************************************* - Public Sub launchSim() - - Me.SimIsOK = False - Me.launchReady = False - - 'Priority - System.Threading.Thread.CurrentThread.Priority = Threading.ThreadPriority.BelowNormal - - Try - 'Datensatz übergeben und initialisieren - Call SWMM_dll.Initialize(IO.Path.Combine(Me.WorkFolder, Me.DS_Name)) - Call SWMM_dll.Start(1) - - 'Simulationszeitraum - Dim elapsedTime As Double = 0.0 - - Do - Call SWMM_dll.PerformTimeStep(elapsedTime) - Loop While (elapsedTime > 0.0) - - 'Simulation abschliessen - Call SWMM_dll.Finish() - - 'Simulation erfolgreich - Me.SimIsOK = True - - Catch ex As Exception - - 'Simulationsfehler aufgetreten - MsgBox(ex.Message, MsgBoxStyle.Exclamation, "SWMM") - - ''Simulation abschliessen - 'Call SWMM_dll.Finish() - - 'Simulation nicht erfolgreich - Me.SimIsOK = False - - Finally - - 'Ressourcen deallokieren - Call SWMM_dll.Dispose() - - End Try - - 'Me.SimIsOK = False - Me.launchReady = True - - End Sub - - Public Function Sim_Is_OK() As Boolean - - Sim_Is_OK = Me.SimIsOK - End Function - - Public Function launch_Ready() As Boolean - - launch_Ready = Me.launchReady - End Function - - Public Sub set_is_OK() - - Me.SimIsOK = True - End Sub - - Public Function get_Thread_ID() As Integer - - get_Thread_ID = Me.Thread_ID - End Function - - Public Function get_Child_ID() As Integer - - get_Child_ID = Me.Child_ID - End Function - -End Class diff --git a/BlueM.Opt/Apps/Sim.vb b/BlueM.Opt/Apps/Sim.vb index 4f6affc4..933b9ef0 100644 --- a/BlueM.Opt/Apps/Sim.vb +++ b/BlueM.Opt/Apps/Sim.vb @@ -15,16 +15,11 @@ 'You should have received a copy of the GNU General Public License 'along with this program. If not, see . ' -Imports System.IO -Imports System.Windows.Forms -Imports System.Globalization -Imports System.Threading -Imports BlueM.Opt.Common.Constants -Imports BlueM +Imports BlueM.Opt.Common ''' ''' Klasse Sim -''' Basisklasse für Simulationsmodelle wie BlueM und SMUSI +''' Basisklasse für Simulationsmodelle wie BlueM und Talsim ''' Public MustInherit Class Sim @@ -36,13 +31,13 @@ Public MustInherit Class Sim 'Generelle Eigenschaften '----------------------- ''' - ''' Eine StringCollection mit allen Dateiendungen (ohne Punkt), die in einem Datensatz vorkommen können + ''' Eine StringCollection mit allen Dateiendungen (ohne Punkt), die in einem Datensatz vorkommen können ''' - ''' Die erste Dateiendung in dieser Collection repräsentiert den Datensatz (wird z.B. als Filter für OpenFile-Dialoge verwendet) + ''' Die erste Dateiendung in dieser Collection repräsentiert den Datensatz (wird z.B. als Filter für OpenFile-Dialoge verwendet) Public MustOverride ReadOnly Property DatensatzDateiendungen() As Collections.Specialized.StringCollection ''' - ''' Die einen Datensatz repräsentierende Dateiendung (mit Punkt) + ''' Die einen Datensatz repräsentierende Dateiendung (mit Punkt) ''' Public ReadOnly Property DatensatzExtension() As String Get @@ -62,14 +57,14 @@ Public MustInherit Class Sim ''' ''' The simulation result ''' - Public SimResult As BlueM.Opt.Common.ObjectiveFunction.SimResults + Public SimResult As ObjectiveFunction.SimResults 'Das Problem '----------- - Protected mProblem As BlueM.Opt.Common.Problem + Protected mProblem As Problem 'Die Einstellungen - Protected mSettings As BlueM.Opt.Common.Settings + Protected mSettings As Settings Protected Structure Aktuell Public OptPara() As Double @@ -98,13 +93,13 @@ Public MustInherit Class Sim #Region "Events" ''' - ''' Wird ausgelöst, wenn ein Individuum, - ''' das in einem Array an die Evaluate() Methode übergeben wurde, + ''' Wird ausgelöst, wenn ein Individuum, + ''' das in einem Array an die Evaluate() Methode übergeben wurde, ''' erfolgreich evaluiert wurde ''' ''' das evaluierte Individuum ''' 0-basierte Nachfahren-Nummer - Public Event IndividuumEvaluated(ByRef ind As BlueM.Opt.Common.Individuum, ByVal i_Nachf As Integer) + Public Event IndividuumEvaluated(ByRef ind As Individuum, ByVal i_Nachf As Integer) #End Region @@ -113,7 +108,7 @@ Public MustInherit Class Sim ''' ''' Gibt an, ob evaluierte Individuen abgespeichert werden sollen ''' - ''' standardmässig True + ''' standardmässig True Public Property StoreIndividuals() As Boolean Get Return Me.mStoreIndividuals @@ -162,7 +157,7 @@ Public MustInherit Class Sim 'Simulationsergebnis instanzieren Me.SimResult.Clear() - 'Standardmässig OptResult verwenden + 'Standardmässig OptResult verwenden Me.mStoreIndividuals = True Me.isPause = False @@ -171,14 +166,14 @@ Public MustInherit Class Sim End Sub ''' - ''' Die Sim-Anwendung für die Simulation vorbereiten + ''' Die Sim-Anwendung für die Simulation vorbereiten ''' Public Overridable Sub prepareSimulation() - 'Datensätze für Multithreading kopieren + 'Datensätze für Multithreading kopieren Call Me.createThreadWorkDirs() - 'Standardmäßig in Ordner Thread_0 simulieren + 'Standardmäßig in Ordner Thread_0 simulieren Me.WorkDir_Current = Me.getThreadWorkDir(0) End Sub @@ -189,12 +184,12 @@ Public MustInherit Class Sim ''' Der Pfad Public Sub setDatensatz(ByVal pfad As String) - If (File.Exists(pfad)) Then + If (IO.File.Exists(pfad)) Then 'Datensatzname bestimmen - Me.Datensatz = Path.GetFileNameWithoutExtension(pfad) + Me.Datensatz = IO.Path.GetFileNameWithoutExtension(pfad) 'Arbeitsverzeichnis bestimmen - Me.WorkDir_Current = Path.GetDirectoryName(pfad) - Me.WorkDir_Original = Path.GetDirectoryName(pfad) + Me.WorkDir_Current = IO.Path.GetDirectoryName(pfad) + Me.WorkDir_Original = IO.Path.GetDirectoryName(pfad) Else Throw New Exception($"Dataset '{pfad}' not found!") End If @@ -203,16 +198,16 @@ Public MustInherit Class Sim Try Call Me.Read_SimParameter() Catch ex As Exception - Throw New Exception("Unable to read simulation parameters!" & eol & ex.Message) + Throw New Exception("Unable to read simulation parameters!" & Constants.eol & ex.Message) End Try End Sub ''' - ''' Das Problem übergeben + ''' Das Problem übergeben ''' ''' Das Problem - Public Overridable Sub setProblem(ByRef prob As BlueM.Opt.Common.Problem) + Public Overridable Sub setProblem(ByRef prob As Problem) 'Problem speichern Me.mProblem = prob @@ -235,7 +230,7 @@ Public MustInherit Class Sim ''' Einstellungen setzen ''' ''' Die Einstellungen - Public Sub setSettings(ByRef settings As BlueM.Opt.Common.Settings) + Public Sub setSettings(ByRef settings As Settings) 'Settings speichern Me.mSettings = settings @@ -264,12 +259,12 @@ Public MustInherit Class Sim ''' ''' Evaluiert ein einzelnes Individuum. - ''' Durchläuft alle Schritte vom Schreiben der Modellparameter bis zum Berechnen der Objectives. + ''' Durchläuft alle Schritte vom Schreiben der Modellparameter bis zum Berechnen der Objectives. ''' ''' das zu evaluierende Individuum ''' Ob das Individuum in OptResult-DB gespeichert werden soll ''' True wenn erfolgreich, False wenn fehlgeschlagen - Public Overloads Function Evaluate(ByRef ind As BlueM.Opt.Common.Individuum, Optional ByVal storeInDB As Boolean = True) As Boolean + Public Overloads Function Evaluate(ByRef ind As Individuum, Optional ByVal storeInDB As Boolean = True) As Boolean Dim isOK As Boolean @@ -279,7 +274,7 @@ Public MustInherit Class Sim '---------------------- Call Me.PREPARE_Evaluation_PES(ind.OptParameter) - 'Simulation ausführen + 'Simulation ausführen '-------------------- isOK = Me.launchSim() @@ -290,7 +285,7 @@ Public MustInherit Class Sim Try Call Me.SIM_Ergebnis_auswerten(ind, storeInDB) Catch e As Exception - Common.Log.AddMessage(Common.Log.levels.error, "Failed to evaluate simulation: " & eol & e.Message) + Log.AddMessage(Log.levels.error, "Failed to evaluate simulation: " & Constants.eol & e.Message) Return False End Try @@ -300,17 +295,17 @@ Public MustInherit Class Sim ''' ''' Evaluiert ein Array von Individuen - ''' Durchläuft alle Schritte vom Schreiben der Modellparameter bis zum Berechnen der Objectives. - ''' Erfolgreich evaluierte Individuen werden mit dem Event IndividuumEvaluated zurückgegeben. + ''' Durchläuft alle Schritte vom Schreiben der Modellparameter bis zum Berechnen der Objectives. + ''' Erfolgreich evaluierte Individuen werden mit dem Event IndividuumEvaluated zurückgegeben. ''' ''' Ein Array von zu evaluierenden Individuen ''' Ob das Individuum in OptResult-DB gespeichert werden soll - ''' True/False für jedes Individuum - ''' je nach Einstellung läuft die Evaluierung in multiplen Threads oder single-threaded ab - Public Overloads Function Evaluate(ByRef inds() As BlueM.Opt.Common.Individuum, Optional ByVal storeInDB As Boolean = True) As Boolean() + ''' True/False für jedes Individuum + ''' je nach Einstellung läuft die Evaluierung in multiplen Threads oder single-threaded ab + Public Overloads Function Evaluate(ByRef inds() As Individuum, Optional ByVal storeInDB As Boolean = True) As Boolean() Dim isOK() As Boolean - Dim tmpind As BlueM.Opt.Common.Individuum + Dim tmpind As Individuum Dim n_individuals As Integer Dim ThreadID_Free As Integer = 0 Dim ThreadID_Ready As Integer = 0 @@ -329,7 +324,7 @@ Public MustInherit Class Sim 'Mit Multithreading '================== - System.Threading.Thread.CurrentThread.Priority = Threading.ThreadPriority.Normal + Threading.Thread.CurrentThread.Priority = Threading.ThreadPriority.Normal OptTimePara.Start() Do @@ -349,7 +344,7 @@ Public MustInherit Class Sim '---------------------- Call Me.PREPARE_Evaluation_PES(inds(n_ind_Run).OptParameter) - 'Simulation ausführen + 'Simulation ausführen '-------------------- SIM_Eval_is_OK = Me.launchSim(ThreadID_Free, n_ind_Run) @@ -362,28 +357,28 @@ Public MustInherit Class Sim Me.WorkDir_Current = Me.getThreadWorkDir(ThreadID_Ready) - 'HACK: Individuum für Auswertung temporär kopieren um ArrayMismatchException zu umgehen + 'HACK: Individuum für Auswertung temporär kopieren um ArrayMismatchException zu umgehen tmpind = inds(n_ind_Ready) 'Individuum auswerten Try Call Me.SIM_Ergebnis_auswerten(tmpind, storeInDB) - 'Individuum per Event zurückgeben + 'Individuum per Event zurückgeben RaiseEvent IndividuumEvaluated(tmpind, n_ind_Ready) isOK(n_ind_Ready) = True Catch e As Exception - Common.Log.AddMessage(Common.Log.levels.error, "Failed to evaluate simulation: " & eol & e.Message) + Log.AddMessage(Log.levels.error, "Failed to evaluate simulation: " & Constants.eol & e.Message) isOK(n_ind_Ready) = False SIM_Eval_is_OK = False End Try - 'HACK: zurückkopieren (nötig?) + 'HACK: zurückkopieren (nötig?) inds(n_ind_Ready) = tmpind - 'Prüfen, ob alle Individuen fertig + 'Prüfen, ob alle Individuen fertig If (n_ind_Ready = n_individuals - 1) Then Ready = True End If @@ -409,15 +404,15 @@ Public MustInherit Class Sim '------------------------------------------------- Do While (Me.isPause) - System.Threading.Thread.Sleep(20) - Application.DoEvents() + Threading.Thread.Sleep(20) + Windows.Forms.Application.DoEvents() Loop Else 'Falls total im Stress '--------------------- - System.Threading.Thread.Sleep(400) - Application.DoEvents() + Threading.Thread.Sleep(400) + Windows.Forms.Application.DoEvents() End If @@ -430,7 +425,7 @@ Public MustInherit Class Sim 'Evaluieren isOK(i) = Me.Evaluate(inds(i), storeInDB) If (isOK(i)) Then - 'erfolgreich evaluiertes Individuum per Event zurückgeben + 'erfolgreich evaluiertes Individuum per Event zurückgeben RaiseEvent IndividuumEvaluated(inds(i), i) End If Next @@ -438,15 +433,15 @@ Public MustInherit Class Sim End If OptTimePara.Stop() - 'BlueM.Opt.Common.Log.AddMessage($"Die Evaluierung der Generation dauerte: {OptTimePara.Elapsed.Hours}h {OptTimePara.Elapsed.Minutes}m {OptTimePara.Elapsed.Seconds}s {OptTimePara.Elapsed}ms") + 'BlueM.Opt.Log.AddMessage($"Die Evaluierung der Generation dauerte: {OptTimePara.Elapsed.Hours}h {OptTimePara.Elapsed.Minutes}m {OptTimePara.Elapsed.Seconds}s {OptTimePara.Elapsed}ms") Return isOK End Function - 'Evaluierung des SimModells für ParameterOptimierung - Steuerungseinheit + 'Evaluierung des SimModells für ParameterOptimierung - Steuerungseinheit '*********************************************************************** - Private Sub PREPARE_Evaluation_PES(ByVal OptParams() As BlueM.Opt.Common.OptParameter) + Private Sub PREPARE_Evaluation_PES(ByVal OptParams() As OptParameter) 'Wenn Fehler: guckst du ob der Elementname richtig angegeben ist!! @@ -468,10 +463,10 @@ Public MustInherit Class Sim ''' das zu evaluierende Individuum ''' Ob das Individuum in OptResult-DB gespeichert werden soll ''' Die Simulation muss bereits erfolgt sein - Private Sub SIM_Ergebnis_auswerten(ByRef ind As Common.Individuum, Optional ByVal storeInDB As Boolean = True) + Private Sub SIM_Ergebnis_auswerten(ByRef ind As Individuum, Optional ByVal storeInDB As Boolean = True) Dim i, j, k As Short - Dim aggroziel As BlueM.Opt.Common.ObjectiveFunction_Aggregate + Dim aggroziel As ObjectiveFunction_Aggregate Dim aggregateIndices As New Collections.Generic.List(Of Integer) 'Simulationsergebnis einlesen @@ -483,7 +478,7 @@ Public MustInherit Class Sim With Me.mProblem.List_ObjectiveFunctions(i) If (.isGroupLeader) Then - 'Aggregierte Ziele für später aufheben + 'Aggregierte Ziele für später aufheben aggregateIndices.Add(i) Else 'andere Ziele auswerten @@ -498,7 +493,7 @@ Public MustInherit Class Sim aggroziel = Me.mProblem.List_ObjectiveFunctions(j) - 'Zunächst zu Null setzen + 'Zunächst zu Null setzen ind.Objectives(j) = 0 'Alle Gruppenmitglieder suchen @@ -516,7 +511,7 @@ Public MustInherit Class Sim End With Next - 'Zielrichtung berücksichtigen + 'Zielrichtung berücksichtigen ind.Objectives(j) *= aggroziel.Direction Next @@ -525,7 +520,7 @@ Public MustInherit Class Sim ind.Constraints(i) = CalculateConstraint(Me.mProblem.List_Constraintfunctions(i)) Next - 'Lösung im OptResult abspeichern (und zu DB hinzufügen) + 'Lösung im OptResult abspeichern (und zu DB hinzufügen) If (Me.StoreIndividuals And storeInDB) Then Call Me.OptResult.addSolution(ind) End If @@ -538,7 +533,7 @@ Public MustInherit Class Sim Dim i As Integer Dim j As Integer - 'VG ---------- Zusatzroutine für kalibrierung des Tagesgangs + 'VG ---------- Zusatzroutine für kalibrierung des Tagesgangs 'VG Call VG_Kalibrierung_Tagesganglinie() 'VG ---------- Ende @@ -567,11 +562,11 @@ Public MustInherit Class Sim Dim StrRight As String Dim DateiPfad As String Dim WriteCheck As Boolean = False - Dim FiStr As FileStream - Dim StrRead As StreamReader - Dim StrReadSync As TextReader - Dim StrWrite As StreamWriter - Dim StrWriteSync As TextWriter + Dim FiStr As IO.FileStream + Dim StrRead As IO.StreamReader + Dim StrReadSync As IO.TextReader + Dim StrWrite As IO.StreamWriter + Dim StrWriteSync As IO.TextWriter 'ModellParameter aus OptParametern kalkulieren() Call Me.OptParameter_to_ModellParameter() @@ -581,10 +576,10 @@ Public MustInherit Class Sim WriteCheck = True DateiPfad = IO.Path.Combine(Me.WorkDir_Current, Me.Datensatz & "." & Me.mProblem.List_ModellParameter(i).Datei) - 'Datei öffnen - FiStr = New FileStream(DateiPfad, FileMode.Open, IO.FileAccess.Read) - StrRead = New StreamReader(FiStr, System.Text.Encoding.GetEncoding("iso8859-1")) - StrReadSync = TextReader.Synchronized(StrRead) + 'Datei öffnen + FiStr = New IO.FileStream(DateiPfad, IO.FileMode.Open, IO.FileAccess.Read) + StrRead = New IO.StreamReader(FiStr, Text.Encoding.GetEncoding("iso8859-1")) + StrReadSync = IO.TextReader.Synchronized(StrRead) Zeilen = New Collections.Generic.Dictionary(Of Integer, String) @@ -600,7 +595,7 @@ Public MustInherit Class Sim StrRead.Close() FiStr.Close() - 'Anzahl verfügbarer Zeichen + 'Anzahl verfügbarer Zeichen AnzZeichen = Me.mProblem.List_ModellParameter(i).SpBis - Me.mProblem.List_ModellParameter(i).SpVon + 1 'Zeile einlesen und splitten @@ -615,30 +610,30 @@ Public MustInherit Class Sim StrRight = "" End If - 'Wert auf verfügbare Stellen kürzen + 'Wert auf verfügbare Stellen kürzen '---------------------------------- 'Auf ganze Zahl runden und zu String konvertieren - WertStr = Convert.ToString(Convert.ToInt32(Me.Akt.ModPara(i), Common.Provider.FortranProvider)) + WertStr = Convert.ToString(Convert.ToInt32(Me.Akt.ModPara(i), Provider.FortranProvider)) If (WertStr.Length > AnzZeichen) Then 'Wert zu lang Throw New Exception($"The whole number part of the model parameter '{Me.mProblem.List_ModellParameter(i).Bezeichnung}' ({WertStr}) is longer than the number of available spaces!") End If - 'Anzahl verfügbarer Nachkommastellen = (Anzahl Zeichen) - (Anzahl Vorkommastellen) - (Punkt) + 'Anzahl verfügbarer Nachkommastellen = (Anzahl Zeichen) - (Anzahl Vorkommastellen) - (Punkt) 'Math.Round() akzeptiert max 15 Nachkommastellen AnzNachkomma = Math.Min(AnzZeichen - WertStr.Length - 1, 15) - 'Bei negativen Werten noch ein Zeichen für das Minuszeichen abziehen + 'Bei negativen Werten noch ein Zeichen für das Minuszeichen abziehen If Me.Akt.ModPara(i) < 0 Then AnzNachkomma -= 1 End If If AnzNachkomma > 0 Then - 'Runden auf verfügbare Stellen: - WertStr = Convert.ToString(Math.Round(Me.Akt.ModPara(i), AnzNachkomma), Common.Provider.FortranProvider) + 'Runden auf verfügbare Stellen: + WertStr = Convert.ToString(Math.Round(Me.Akt.ModPara(i), AnzNachkomma), Provider.FortranProvider) Else 'Ganzzahligen Wert benutzen End If - 'Falls erforderlich, Wert mit Leerzeichen füllen + 'Falls erforderlich, Wert mit Leerzeichen füllen WertStr = WertStr.PadRight(AnzZeichen) 'Zeile wieder zusammensetzen @@ -647,8 +642,8 @@ Public MustInherit Class Sim Zeilen(Me.mProblem.List_ModellParameter(i).ZeileNr) = Zeile 'Alle Zeilen wieder in Datei schreiben - StrWrite = New StreamWriter(DateiPfad, False, System.Text.Encoding.GetEncoding("iso8859-1")) - StrWriteSync = TextWriter.Synchronized(StrWrite) + StrWrite = New IO.StreamWriter(DateiPfad, False, Text.Encoding.GetEncoding("iso8859-1")) + StrWriteSync = IO.TextWriter.Synchronized(StrWrite) For Each Zeile In Zeilen.Values StrWrite.WriteLine(Zeile) @@ -664,7 +659,7 @@ Public MustInherit Class Sim End Sub - 'SimModell ausführen (simulieren) + 'SimModell ausführen (simulieren) '******************************** Protected MustOverride Overloads Function launchSim() As Boolean 'mit Threads: @@ -682,7 +677,7 @@ Public MustInherit Class Sim 'Constraint berechnen (Constraint < 0 ist Grenzverletzung) '********************************************************* - Private Function CalculateConstraint(ByVal constr As Common.Constraintfunction) As Double + Private Function CalculateConstraint(ByVal constr As Constraintfunction) As Double Dim i As Integer @@ -798,7 +793,7 @@ Public MustInherit Class Sim End Sub ''' - ''' Datensätze für Multithreading kopieren + ''' Datensätze für Multithreading kopieren ''' ''' True wenn fertig ''' Erstellt im bin-Ordner Verzeichnisse Thread_0 bis Thread_n mit Kopien des Original-Datensatzes @@ -807,9 +802,9 @@ Public MustInherit Class Sim Dim i As Integer Dim isOK As Boolean Dim threadDir As String - Dim binPath As String = System.Windows.Forms.Application.StartupPath() + Dim binPath As String = Windows.Forms.Application.StartupPath() - 'Alte Thread-Ordner löschen + 'Alte Thread-Ordner löschen isOK = Me.deleteThreadWorkDirs() 'Datensatz in alle Thread-Ordner kopieren @@ -823,13 +818,13 @@ Public MustInherit Class Sim End Function ''' - ''' Gibt die relativen Pfade aller Datensatz-Dateien zurück + ''' Gibt die relativen Pfade aller Datensatz-Dateien zurück ''' ''' Das zu durchsuchende Verzeichnis ''' Private Function getDatensatzFiles(ByVal rootdirectory As String) As String() - Dim Files() As IO.FileInfo + Dim files() As IO.FileInfo Dim DirInfo, Dirs() As IO.DirectoryInfo Dim paths(), subpaths(), ext As String @@ -842,16 +837,16 @@ Public MustInherit Class Sim DirInfo = New IO.DirectoryInfo(rootdirectory) 'zu kopierende Dateien anhand der Dateiendung bestimmen - Files = DirInfo.GetFiles("*.*") - For Each File As IO.FileInfo In Files + files = DirInfo.GetFiles("*.*") + For Each file As IO.FileInfo In files 'Dateiendung bestimmen - If (File.Extension.Length > 0) Then - ext = File.Extension.Substring(1).ToUpper() - 'Prüfen, ob es sich ume eine zu kopierende Datei handelt + If (file.Extension.Length > 0) Then + ext = file.Extension.Substring(1).ToUpper() + 'Prüfen, ob es sich ume eine zu kopierende Datei handelt If (Me.DatensatzDateiendungen.Contains(ext)) Then - 'Relativen Pfad der Datei zu Array hinzufügen + 'Relativen Pfad der Datei zu Array hinzufügen ReDim Preserve paths(paths.Length) - paths(paths.Length - 1) = File.Name + paths(paths.Length - 1) = file.Name End If End If Next @@ -859,11 +854,11 @@ Public MustInherit Class Sim 'Unterverzeichnisse rekursiv durchsuchen Dirs = DirInfo.GetDirectories("*.*") For Each dir As IO.DirectoryInfo In Dirs - 'versteckte und solution- sowie sensiplot-Verzeichnisse überspringen + 'versteckte und solution- sowie sensiplot-Verzeichnisse überspringen If Not (dir.Name.StartsWith(".") Or dir.Name.StartsWith("solution_") Or dir.Name.StartsWith("sensiplot_")) Then 'Pfade aus Unterverzeichnis holen subpaths = Me.getDatensatzFiles(dir.FullName) - 'Pfade zu Array hinzufügen + 'Pfade zu Array hinzufügen For Each subpath As String In subpaths subpath = dir.Name & "\" & subpath ReDim Preserve paths(paths.Length) @@ -877,10 +872,10 @@ Public MustInherit Class Sim End Function ''' - ''' Datensätze für Multithreading löschen + ''' Datensätze für Multithreading löschen ''' ''' True wenn fertig - ''' löscht die Ordner Thread_0 bis Thread_9 im bin-Verzeichnis + ''' löscht die Ordner Thread_0 bis Thread_9 im bin-Verzeichnis Private Function deleteThreadWorkDirs() As Boolean Dim i As Integer @@ -888,11 +883,11 @@ Public MustInherit Class Sim For i = 0 To 9 - dir = IO.Path.Combine(System.Windows.Forms.Application.StartupPath(), "Thread_" & i.ToString()) + dir = IO.Path.Combine(Windows.Forms.Application.StartupPath(), "Thread_" & i.ToString()) - If Directory.Exists(dir) Then - Call BlueM.Opt.Common.FileHelper.purgeReadOnly(dir) - Directory.Delete(dir, True) + If IO.Directory.Exists(dir) Then + Call FileHelper.purgeReadOnly(dir) + IO.Directory.Delete(dir, True) End If Next @@ -901,14 +896,14 @@ Public MustInherit Class Sim End Function ''' - ''' Gibt den Datensatz Ordner eines Threads zurück + ''' Gibt den Datensatz Ordner eines Threads zurück ''' ''' Die ID des Threads Protected Function getThreadWorkDir(ByVal Thread_ID As Integer) As String Dim dir As String - dir = IO.Path.Combine(System.Windows.Forms.Application.StartupPath(), "Thread_" & Thread_ID.ToString()) + dir = IO.Path.Combine(Windows.Forms.Application.StartupPath(), "Thread_" & Thread_ID.ToString()) Return dir @@ -919,7 +914,7 @@ Public MustInherit Class Sim #Region "Misc" ''' - ''' Setzt den Datensatz zurück, + ''' Setzt den Datensatz zurück, ''' indem die Startwerte der OptParameter ''' in die Eingabedateien des Original-Datensatzordners ''' geschrieben werden @@ -946,7 +941,7 @@ Public MustInherit Class Sim 'Modellparameter schreiben Call Me.Write_ModellParameter() - 'Arbeitsverzeichnis zurücksetzen + 'Arbeitsverzeichnis zurücksetzen Me.WorkDir_Current = tmp End Sub diff --git a/BlueM.Opt/Apps/TALSIM/TALSIM.vb b/BlueM.Opt/Apps/TALSIM/TALSIM.vb index 21524a63..58637b16 100644 --- a/BlueM.Opt/Apps/TALSIM/TALSIM.vb +++ b/BlueM.Opt/Apps/TALSIM/TALSIM.vb @@ -15,10 +15,7 @@ 'You should have received a copy of the GNU General Public License 'along with this program. If not, see . ' -Imports System.IO Imports System.Threading -Imports System.Globalization -Imports BlueM Imports BlueM.Opt.Common ''' @@ -46,9 +43,9 @@ Public Class Talsim #Region "Properties" ''' - ''' Alle Dateiendungen (ohne Punkt), die in einem Datensatz vorkommen können + ''' Alle Dateiendungen (ohne Punkt), die in einem Datensatz vorkommen können ''' - ''' Die erste Dateiendung in dieser Collection repräsentiert den Datensatz (wird z.B. als Filter für OpenFile-Dialoge verwendet) + ''' Die erste Dateiendung in dieser Collection repräsentiert den Datensatz (wird z.B. als Filter für OpenFile-Dialoge verwendet) Public Overrides ReadOnly Property DatensatzDateiendungen() As Collections.Specialized.StringCollection Get Dim exts As New Collections.Specialized.StringCollection() @@ -66,7 +63,7 @@ Public Class Talsim End Property ''' - ''' Ob die Anwendung Multithreading unterstützt + ''' Ob die Anwendung Multithreading unterstützt ''' ''' True Public Overrides ReadOnly Property MultithreadingSupported() As Boolean @@ -97,15 +94,15 @@ Public Class Talsim 'attempt to get exe_path from UserSettings exe_path = My.Settings.TALSIM_path - If (Not File.Exists(exe_path)) Then + If (Not IO.File.Exists(exe_path)) Then 'use default location instead - exe_path = IO.Path.Combine(System.Windows.Forms.Application.StartupPath(), "TALSIM\talsimw64.exe") + exe_path = IO.Path.Combine(Windows.Forms.Application.StartupPath(), "TALSIM\talsimw64.exe") If My.Settings.TALSIM_path.Trim() <> "" Then - MsgBox($"UserSetting for TALSIM_path {My.Settings.TALSIM_path} was not found.{eol}Using default {exe_path} instead.", MsgBoxStyle.Information) + MsgBox($"UserSetting for TALSIM_path {My.Settings.TALSIM_path} was not found.{Constants.eol}Using default {exe_path} instead.", MsgBoxStyle.Information) End If End If - If (Not File.Exists(exe_path)) Then + If (Not IO.File.Exists(exe_path)) Then Throw New Exception(exe_path & " not found!") End If @@ -129,12 +126,12 @@ Public Class Talsim End Sub - Public Overrides Sub setProblem(ByRef prob As BlueM.Opt.Common.Problem) + Public Overrides Sub setProblem(ByRef prob As Problem) Call MyBase.setProblem(prob) 'TALSIM-spezifische Weiterverarbeitung von ZielReihen: - Dim objective As Common.ObjectiveFunction + Dim objective As ObjectiveFunction 'Feststellen, welche WEL/WBL-Dateien in Zielfunktionen genutzt werden For Each objective In Me.mProblem.List_ObjectiveFunctions @@ -172,8 +169,8 @@ Public Class Talsim 'read all settings Try - Using FiStr As New FileStream(Datei, FileMode.Open, IO.FileAccess.Read) - Using StrRead As New StreamReader(FiStr, System.Text.Encoding.GetEncoding("iso8859-1")) + Using FiStr As New IO.FileStream(Datei, IO.FileMode.Open, IO.FileAccess.Read) + Using StrRead As New IO.StreamReader(FiStr, Text.Encoding.GetEncoding("iso8859-1")) Do line = StrRead.ReadLine.ToString().Trim() @@ -232,7 +229,7 @@ Public Class Talsim #Region "Evaluierung" ''' - ''' Gibt zurück ob ein beliebiger Thread beendet ist und gibt die ID diesen freien Threads zurück + ''' Gibt zurück ob ein beliebiger Thread beendet ist und gibt die ID diesen freien Threads zurück ''' ''' ''' @@ -291,13 +288,13 @@ Public Class Talsim 'write the path to the dataset and the dataset name into a new run file 'this is done for every simulation because the workdir may change Dim runfile As String = IO.Path.Combine(IO.Path.GetDirectoryName(exe_path), "talsim.run") - If (Not File.Exists(runfile)) Then + If (Not IO.File.Exists(runfile)) Then Throw New Exception(runfile & " not found!") End If Dim line As String 'read the template run file - filestr = New FileStream(runfile, FileMode.Open, IO.FileAccess.Read) - strread = New StreamReader(filestr, System.Text.Encoding.GetEncoding("iso8859-1")) + filestr = New IO.FileStream(runfile, IO.FileMode.Open, IO.FileAccess.Read) + strread = New IO.StreamReader(filestr, Text.Encoding.GetEncoding("iso8859-1")) Dim lines As New Collections.Generic.List(Of String) Do line = strread.ReadLine() @@ -309,7 +306,7 @@ Public Class Talsim 'write a new run file Dim runfilename As String = MyBase.Datensatz & ".run" runfile = IO.Path.Combine(IO.Path.GetDirectoryName(Me.exe_path), runfilename) - Dim strwrite As New StreamWriter(runfile, False, System.Text.Encoding.GetEncoding("iso8859-1")) + Dim strwrite As New IO.StreamWriter(runfile, False, Text.Encoding.GetEncoding("iso8859-1")) For Each line In lines If line.StartsWith("Path=") Then 'update the sim path @@ -336,11 +333,11 @@ Public Class Talsim 'start proc = Process.Start(startInfo) 'DEBUG: write to log - 'BlueM.Opt.Common.Log.AddMessage(startInfo.FileName & " " & startInfo.Arguments) + 'BlueM.Opt.Log.AddMessage(startInfo.FileName & " " & startInfo.Arguments) 'wait until finished Do isFinished = proc.WaitForExit(100) - System.Windows.Forms.Application.DoEvents() + Windows.Forms.Application.DoEvents() Loop Until isFinished 'close the process proc.Close() @@ -350,10 +347,10 @@ Public Class Talsim 'read err-file Dim errmsg As String = "TALSIM simulation ended with errors:" filestr = New IO.FileStream(errfile, IO.FileMode.Open, IO.FileAccess.Read) - strread = New IO.StreamReader(filestr, System.Text.Encoding.GetEncoding("iso8859-1")) + strread = New IO.StreamReader(filestr, Text.Encoding.GetEncoding("iso8859-1")) Do line = strread.ReadLine() - errmsg &= BlueM.Opt.Common.eol & line + errmsg &= Constants.eol & line Loop Until strread.Peek = -1 strread.Close() filestr.Close() @@ -372,7 +369,7 @@ Public Class Talsim Catch ex As Exception 'Simulationsfehler aufgetreten - Common.Log.AddMessage(Common.Log.levels.error, ex.Message) + Log.AddMessage(Log.levels.error, ex.Message) 'Simulation nicht erfolgreich simOK = False @@ -388,8 +385,8 @@ Public Class Talsim End Function ''' - ''' Prüft ob das aktuelle Child mit der ID die oben übergeben wurde fertig ist - ''' Gibt die Thread ID zurück um zum auswerten in das Arbeitsverzeichnis zu wechseln + ''' Prüft ob das aktuelle Child mit der ID die oben übergeben wurde fertig ist + ''' Gibt die Thread ID zurück um zum auswerten in das Arbeitsverzeichnis zu wechseln ''' ''' ''' @@ -418,7 +415,7 @@ Public Class Talsim ''' Protected Overrides Sub SIM_Ergebnis_Lesen() - 'Altes Simulationsergebnis löschen + 'Altes Simulationsergebnis löschen Me.SimResult.Clear() 'Collect required result files and series diff --git a/BlueM.Opt/Apps/TALSIM/TALSIM5.vb b/BlueM.Opt/Apps/TALSIM/TALSIM5.vb index 6acbb0fe..4ef9ddc9 100644 --- a/BlueM.Opt/Apps/TALSIM/TALSIM5.vb +++ b/BlueM.Opt/Apps/TALSIM/TALSIM5.vb @@ -16,9 +16,8 @@ 'along with this program. If not, see . ' Imports System.Threading -Imports System.Windows.Forms -Imports BlueM.Opt.Common Imports Microsoft.Data.Sqlite +Imports BlueM.Opt.Common ''' ''' Class TALSIM5 for carrying out simulations using TALSIM5 (same simulation executable but different dataset format than TALSIM4) @@ -64,9 +63,9 @@ Public Class Talsim5 End Class ''' - ''' Alle Dateiendungen (ohne Punkt), die in einem Datensatz vorkommen können + ''' Alle Dateiendungen (ohne Punkt), die in einem Datensatz vorkommen können ''' - ''' Die erste Dateiendung in dieser Collection repräsentiert den Datensatz (wird z.B. als Filter für OpenFile-Dialoge verwendet) + ''' Die erste Dateiendung in dieser Collection repräsentiert den Datensatz (wird z.B. als Filter für OpenFile-Dialoge verwendet) Public Overrides ReadOnly Property DatensatzDateiendungen() As Collections.Specialized.StringCollection Get Dim exts As New Collections.Specialized.StringCollection() @@ -79,7 +78,7 @@ Public Class Talsim5 End Property ''' - ''' Ob die Anwendung Multithreading unterstützt + ''' Ob die Anwendung Multithreading unterstützt ''' ''' True Public Overrides ReadOnly Property MultithreadingSupported As Boolean = True @@ -111,9 +110,9 @@ Public Class Talsim5 If (Not IO.File.Exists(exe_path)) Then 'use default location instead - exe_path = IO.Path.Combine(System.Windows.Forms.Application.StartupPath(), "TALSIM\talsimw64.exe") + exe_path = IO.Path.Combine(Windows.Forms.Application.StartupPath(), "TALSIM\talsimw64.exe") If My.Settings.TALSIM_path.Trim() <> "" Then - MsgBox($"UserSetting for TALSIM_path {My.Settings.TALSIM_path} was not found.{eol}Using default {exe_path} instead.", MsgBoxStyle.Information) + MsgBox($"UserSetting for TALSIM_path {My.Settings.TALSIM_path} was not found.{Constants.eol}Using default {exe_path} instead.", MsgBoxStyle.Information) End If End If @@ -141,12 +140,12 @@ Public Class Talsim5 End Sub - Public Overrides Sub setProblem(ByRef prob As BlueM.Opt.Common.Problem) + Public Overrides Sub setProblem(ByRef prob As Problem) Call MyBase.setProblem(prob) 'TALSIM-spezifische Weiterverarbeitung von ZielReihen: - Dim objective As Common.ObjectiveFunction + Dim objective As ObjectiveFunction 'Feststellen, welche WEL/WBL-Dateien in Zielfunktionen genutzt werden For Each objective In Me.mProblem.List_ObjectiveFunctions @@ -175,7 +174,7 @@ Public Class Talsim5 'Show Talsim5 settings dialog Dim dlg As New TALSIM5_Dialog(Me.DBFile) - If dlg.ShowDialog() <> DialogResult.OK Then + If dlg.ShowDialog() <> Windows.Forms.DialogResult.OK Then Throw New Exception("Talsim5 settings not set!") End If 'save settings from dialog @@ -208,7 +207,7 @@ Public Class Talsim5 End Sub ''' - ''' Gibt zurück ob ein beliebiger Thread beendet ist und gibt die ID diesen freien Threads zurück + ''' Gibt zurück ob ein beliebiger Thread beendet ist und gibt die ID diesen freien Threads zurück ''' ''' ''' @@ -273,7 +272,7 @@ Public Class Talsim5 Dim line As String 'read the template run file filestr = New IO.FileStream(runfile, IO.FileMode.Open, IO.FileAccess.Read) - strread = New IO.StreamReader(filestr, System.Text.Encoding.GetEncoding("iso8859-1")) + strread = New IO.StreamReader(filestr, Text.Encoding.GetEncoding("iso8859-1")) Dim lines As New Collections.Generic.List(Of String) Do line = strread.ReadLine() @@ -285,7 +284,7 @@ Public Class Talsim5 'write a new run file Dim runfilename As String = MyBase.Datensatz & ".run" runfile = IO.Path.Combine(IO.Path.GetDirectoryName(Me.exe_path), runfilename) - Dim strwrite As New IO.StreamWriter(runfile, False, System.Text.Encoding.GetEncoding("iso8859-1")) + Dim strwrite As New IO.StreamWriter(runfile, False, Text.Encoding.GetEncoding("iso8859-1")) For Each line In lines If line.StartsWith("Path=") Then line = "Path=" & MyBase.WorkDir_Current @@ -318,11 +317,11 @@ Public Class Talsim5 'start proc = Process.Start(startInfo) 'DEBUG: write to log - 'BlueM.Opt.Common.Log.AddMessage(startInfo.FileName & " " & startInfo.Arguments) + 'BlueM.Opt.Log.AddMessage(startInfo.FileName & " " & startInfo.Arguments) 'wait until finished Do isFinished = proc.WaitForExit(100) - System.Windows.Forms.Application.DoEvents() + Windows.Forms.Application.DoEvents() Loop Until isFinished 'close the process proc.Close() @@ -332,10 +331,10 @@ Public Class Talsim5 'read err-file Dim errmsg As String = "TALSIM simulation ended with errors:" filestr = New IO.FileStream(errfile, IO.FileMode.Open, IO.FileAccess.Read) - strread = New IO.StreamReader(filestr, System.Text.Encoding.GetEncoding("iso8859-1")) + strread = New IO.StreamReader(filestr, Text.Encoding.GetEncoding("iso8859-1")) Do line = strread.ReadLine() - errmsg &= BlueM.Opt.Common.eol & line + errmsg &= Constants.eol & line Loop Until strread.Peek = -1 strread.Close() filestr.Close() @@ -354,7 +353,7 @@ Public Class Talsim5 Catch ex As Exception 'Simulationsfehler aufgetreten - Common.Log.AddMessage(Common.Log.levels.error, ex.Message) + Log.AddMessage(Log.levels.error, ex.Message) 'Simulation nicht erfolgreich simOK = False @@ -370,8 +369,8 @@ Public Class Talsim5 End Function ''' - ''' Prüft ob das aktuelle Child mit der ID die oben übergeben wurde fertig ist - ''' Gibt die Thread ID zurück um zum auswerten in das Arbeitsverzeichnis zu wechseln + ''' Prüft ob das aktuelle Child mit der ID die oben übergeben wurde fertig ist + ''' Gibt die Thread ID zurück um zum auswerten in das Arbeitsverzeichnis zu wechseln ''' ''' ''' @@ -443,7 +442,7 @@ Public Class Talsim5 ''' Protected Overrides Sub SIM_Ergebnis_Lesen() - 'Altes Simulationsergebnis löschen + 'Altes Simulationsergebnis löschen Me.SimResult.Clear() 'Collect required result files and series diff --git a/BlueM.Opt/Apps/TALSIM/TALSIM5Thread.vb b/BlueM.Opt/Apps/TALSIM/TALSIM5Thread.vb index e93a9f89..851712c3 100644 --- a/BlueM.Opt/Apps/TALSIM/TALSIM5Thread.vb +++ b/BlueM.Opt/Apps/TALSIM/TALSIM5Thread.vb @@ -15,6 +15,8 @@ 'You should have received a copy of the GNU General Public License 'along with this program. If not, see . ' +Imports BlueM.Opt.Common + ''' ''' Klasse beinhaltet alle Infomationen für einen Simulationslauf im Thread ''' @@ -66,7 +68,7 @@ Public Class Talsim5Thread Me.launchReady = False 'Priority - System.Threading.Thread.CurrentThread.Priority = Threading.ThreadPriority.Normal + Threading.Thread.CurrentThread.Priority = Threading.ThreadPriority.Normal Try 'write the required settings into a new run file @@ -78,7 +80,7 @@ Public Class Talsim5Thread Dim line As String 'read the template run file filestr = New IO.FileStream(runfile, IO.FileMode.Open, IO.FileAccess.Read) - strread = New IO.StreamReader(filestr, System.Text.Encoding.GetEncoding("iso8859-1")) + strread = New IO.StreamReader(filestr, Text.Encoding.GetEncoding("iso8859-1")) Dim lines As New Collections.Generic.List(Of String) Do line = strread.ReadLine() @@ -90,20 +92,20 @@ Public Class Talsim5Thread 'write a new run file Dim runfilename As String = $"{Me.DS_Name}_{Me.Thread_ID}.run" runfile = IO.Path.Combine(IO.Path.GetDirectoryName(Talsim5Thread.exe_path), runfilename) - Dim strwrite As New IO.StreamWriter(runfile, False, System.Text.Encoding.GetEncoding("iso8859-1")) + Dim strwrite As New IO.StreamWriter(runfile, False, Text.Encoding.GetEncoding("iso8859-1")) For Each line In lines If line.StartsWith("Path=") Then line = "Path=" & Me.WorkFolder ElseIf line.StartsWith("System=") Then line = "System=" & Me.DS_Name ElseIf line.StartsWith("DBFile=") Then - line = "DBFile=" & Me.dbfile + line = "DBFile=" & Me.DBFile ElseIf line.StartsWith("ZrePath=") Then line = "ZrePath=" & Me.TimeseriesPath & "\" ElseIf line.StartsWith("ScenarioId=") Then - line = "ScenarioId=" & Me.scenarioId.ToString() + line = "ScenarioId=" & Me.ScenarioId.ToString() ElseIf line.StartsWith("SimulationId=") Then - line = "SimulationId=" & Me.simulationId.ToString() + line = "SimulationId=" & Me.SimulationId.ToString() End If strwrite.WriteLine(line) Next @@ -132,11 +134,11 @@ Public Class Talsim5Thread 'start proc = Process.Start(startInfo) 'DEBUG: write to log - 'BlueM.Opt.Common.Log.AddMessage($"Thread {Me.Thread_ID}: {startInfo.FileName} {startInfo.Arguments}") + 'BlueM.Opt.Log.AddMessage($"Thread {Me.Thread_ID}: {startInfo.FileName} {startInfo.Arguments}") 'wait until finished Do isFinished = proc.WaitForExit(100) - System.Windows.Forms.Application.DoEvents() + Windows.Forms.Application.DoEvents() Loop Until isFinished 'close the process proc.Close() @@ -152,10 +154,10 @@ Public Class Talsim5Thread 'read err-file errmsg = $"Thread {Me.Thread_ID}: TALSIM simulation ended with errors:" filestr = New IO.FileStream(errfile, IO.FileMode.Open, IO.FileAccess.Read) - strread = New IO.StreamReader(filestr, System.Text.Encoding.GetEncoding("iso8859-1")) + strread = New IO.StreamReader(filestr, Text.Encoding.GetEncoding("iso8859-1")) Do line = strread.ReadLine() - errmsg &= BlueM.Opt.Common.eol & line + errmsg &= Constants.eol & line Loop Until strread.Peek = -1 strread.Close() filestr.Close() @@ -167,13 +169,13 @@ Public Class Talsim5Thread End If 'Log error message - Common.Log.AddMessage(Common.Log.levels.error, errmsg) + Log.AddMessage(Log.levels.error, errmsg) If i_attempt < n_attempts Then - Common.Log.AddMessage(Common.Log.levels.error, $"Thread {Me.Thread_ID}: TALSIM simulation attempt {i_attempt} was unsuccessful, trying again...") - System.Threading.Thread.Sleep(100) + Log.AddMessage(Log.levels.error, $"Thread {Me.Thread_ID}: TALSIM simulation attempt {i_attempt} was unsuccessful, trying again...") + Threading.Thread.Sleep(100) Else - Common.Log.AddMessage(Common.Log.levels.error, $"Thread {Me.Thread_ID}: TALSIM simulation attempt {i_attempt} was unsuccessful, parameter set will be discarded!") + Log.AddMessage(Log.levels.error, $"Thread {Me.Thread_ID}: TALSIM simulation attempt {i_attempt} was unsuccessful, parameter set will be discarded!") End If Next @@ -181,7 +183,7 @@ Public Class Talsim5Thread Catch ex As Exception 'Simulationsfehler aufgetreten - Common.Log.AddMessage(Common.Log.levels.error, ex.Message) + Log.AddMessage(Log.levels.error, ex.Message) 'Simulation nicht erfolgreich Me.SimIsOK = False diff --git a/BlueM.Opt/Apps/TALSIM/TALSIM5_Dialog.vb b/BlueM.Opt/Apps/TALSIM/TALSIM5_Dialog.vb index c85a228f..b7c496b6 100644 --- a/BlueM.Opt/Apps/TALSIM/TALSIM5_Dialog.vb +++ b/BlueM.Opt/Apps/TALSIM/TALSIM5_Dialog.vb @@ -1,4 +1,4 @@ -'BlueM.Opt +'BlueM.Opt 'Copyright (C) BlueM Dev Group 'Website: ' @@ -15,8 +15,8 @@ 'You should have received a copy of the GNU General Public License 'along with this program. If not, see . ' -Imports Microsoft.Data.Sqlite Imports System.Windows.Forms +Imports Microsoft.Data.Sqlite Friend Class TALSIM5_Dialog @@ -61,7 +61,7 @@ Friend Class TALSIM5_Dialog End Property ''' - ''' Create a new instance of the dialog with the given database path. + ''' Create a new instance of the dialog with the given database IO.Path. ''' The dialog will read the scenarios and simulations from the database and show them in the corresponding combo boxes. ''' ''' Path to the database @@ -168,12 +168,12 @@ Friend Class TALSIM5_Dialog MessageBox.Show("The selected timeseries path does not exist!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) Return End If - Me.DialogResult = System.Windows.Forms.DialogResult.OK + Me.DialogResult = DialogResult.OK Me.Close() End Sub Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click - Me.DialogResult = System.Windows.Forms.DialogResult.Cancel + Me.DialogResult = DialogResult.Cancel Me.Close() End Sub diff --git a/BlueM.Opt/Apps/TALSIM/TALSIMThread.vb b/BlueM.Opt/Apps/TALSIM/TALSIMThread.vb index ea2c1441..fc933963 100644 --- a/BlueM.Opt/Apps/TALSIM/TALSIMThread.vb +++ b/BlueM.Opt/Apps/TALSIM/TALSIMThread.vb @@ -15,6 +15,8 @@ 'You should have received a copy of the GNU General Public License 'along with this program. If not, see . ' +Imports BlueM.Opt.Common + ''' ''' Klasse beinhaltet alle Infomationen für einen Simulationslauf im Thread ''' @@ -50,7 +52,7 @@ Public Class TalsimThread Me.launchReady = False 'Priority - System.Threading.Thread.CurrentThread.Priority = Threading.ThreadPriority.Normal + Threading.Thread.CurrentThread.Priority = Threading.ThreadPriority.Normal Try 'write the path to the dataset and the dataset name into a new run file @@ -62,7 +64,7 @@ Public Class TalsimThread Dim line As String 'read the template run file filestr = New IO.FileStream(runfile, IO.FileMode.Open, IO.FileAccess.Read) - strread = New IO.StreamReader(filestr, System.Text.Encoding.GetEncoding("iso8859-1")) + strread = New IO.StreamReader(filestr, Text.Encoding.GetEncoding("iso8859-1")) Dim lines As New Collections.Generic.List(Of String) Do line = strread.ReadLine() @@ -74,7 +76,7 @@ Public Class TalsimThread 'write a new run file Dim runfilename As String = $"{Me.DS_Name}_{Me.Thread_ID}.run" runfile = IO.Path.Combine(IO.Path.GetDirectoryName(TalsimThread.exe_path), runfilename) - Dim strwrite As New IO.StreamWriter(runfile, False, System.Text.Encoding.GetEncoding("iso8859-1")) + Dim strwrite As New IO.StreamWriter(runfile, False, Text.Encoding.GetEncoding("iso8859-1")) For Each line In lines If line.StartsWith("Path=") Then 'update the sim path @@ -110,11 +112,11 @@ Public Class TalsimThread 'start proc = Process.Start(startInfo) 'DEBUG: write to log - 'BlueM.Opt.Common.Log.AddMessage($"Thread {Me.Thread_ID}: {startInfo.FileName} {startInfo.Arguments}") + 'BlueM.Opt.Log.AddMessage($"Thread {Me.Thread_ID}: {startInfo.FileName} {startInfo.Arguments}") 'wait until finished Do isFinished = proc.WaitForExit(100) - System.Windows.Forms.Application.DoEvents() + Windows.Forms.Application.DoEvents() Loop Until isFinished 'close the process proc.Close() @@ -130,10 +132,10 @@ Public Class TalsimThread 'read err-file errmsg = $"Thread {Me.Thread_ID}: TALSIM simulation ended with errors:" filestr = New IO.FileStream(errfile, IO.FileMode.Open, IO.FileAccess.Read) - strread = New IO.StreamReader(filestr, System.Text.Encoding.GetEncoding("iso8859-1")) + strread = New IO.StreamReader(filestr, Text.Encoding.GetEncoding("iso8859-1")) Do line = strread.ReadLine() - errmsg &= BlueM.Opt.Common.eol & line + errmsg &= Constants.eol & line Loop Until strread.Peek = -1 strread.Close() filestr.Close() @@ -145,13 +147,13 @@ Public Class TalsimThread End If 'Log error message - Common.Log.AddMessage(Common.Log.levels.error, errmsg) + Log.AddMessage(Log.levels.error, errmsg) If i_attempt < n_attempts Then - Common.Log.AddMessage(Common.Log.levels.error, $"Thread {Me.Thread_ID}: TALSIM simulation attempt {i_attempt} was unsuccessful, trying again...") - System.Threading.Thread.Sleep(100) + Log.AddMessage(Log.levels.error, $"Thread {Me.Thread_ID}: TALSIM simulation attempt {i_attempt} was unsuccessful, trying again...") + Threading.Thread.Sleep(100) Else - Common.Log.AddMessage(Common.Log.levels.error, $"Thread {Me.Thread_ID}: TALSIM simulation attempt {i_attempt} was unsuccessful, parameter set will be discarded!") + Log.AddMessage(Log.levels.error, $"Thread {Me.Thread_ID}: TALSIM simulation attempt {i_attempt} was unsuccessful, parameter set will be discarded!") End If Next @@ -159,7 +161,7 @@ Public Class TalsimThread Catch ex As Exception 'Simulationsfehler aufgetreten - Common.Log.AddMessage(Common.Log.levels.error, ex.Message) + Log.AddMessage(Log.levels.error, ex.Message) 'Simulation nicht erfolgreich Me.SimIsOK = False diff --git a/BlueM.Opt/Apps/Testprobleme/Testprobleme.vb b/BlueM.Opt/Apps/Testprobleme/Testprobleme.vb index 102fc0d4..23119cf2 100644 --- a/BlueM.Opt/Apps/Testprobleme/Testprobleme.vb +++ b/BlueM.Opt/Apps/Testprobleme/Testprobleme.vb @@ -15,7 +15,8 @@ 'You should have received a copy of the GNU General Public License 'along with this program. If not, see . ' -Imports BlueM.Opt.Common.Constants +Imports System.Drawing +Imports BlueM.Opt.Common Public Class Testprobleme @@ -40,12 +41,12 @@ Public Class Testprobleme Private mSelectedTestproblem As String Private mTestProblemDescription As String - Private mProblem As BlueM.Opt.Common.Problem + Private mProblem As Problem Private mAnzParameter As Integer Private mAnzZiele As Integer Private mAnzConstraints As Integer - Private mOptPara() As Common.OptParameter + Private mOptPara() As OptParameter 'Properties '########## @@ -74,7 +75,7 @@ Public Class Testprobleme End Get End Property - 'gewähltes Testproblem holen + 'gewähltes Testproblem holen '*************************** Public ReadOnly Property selectedTestproblem() As String Get @@ -97,16 +98,16 @@ Public Class Testprobleme End Sub - 'Parameterübergabe + 'Parameterübergabe '***************** - Public Sub getProblem(ByRef prob As BlueM.Opt.Common.Problem) + Public Sub getProblem(ByRef prob As Problem) Dim i As Integer 'Das Problem setzen Me.mProblem = prob - 'Je nach Datensatz/Testproblem initialisierungen durchführen + 'Je nach Datensatz/Testproblem initialisierungen durchführen Select Case Me.mSelectedTestproblem Case TP_SinusFunktion @@ -116,8 +117,9 @@ Public Class Testprobleme Me.mAnzConstraints = 0 ReDim Me.mOptPara(Me.mAnzParameter - 1) For i = 0 To Me.mAnzParameter - 1 - Me.mOptPara(i) = New BlueM.Opt.Common.OptParameter() - Me.mOptPara(i).Xn = 0 + Me.mOptPara(i) = New OptParameter With { + .Xn = 0 + } Next Case TP_BealeProblem @@ -127,8 +129,9 @@ Public Class Testprobleme Me.mAnzConstraints = 0 ReDim Me.mOptPara(Me.mAnzParameter - 1) For i = 0 To Me.mAnzParameter - 1 - Me.mOptPara(i) = New BlueM.Opt.Common.OptParameter() - Me.mOptPara(i).Xn = 0.5 + Me.mOptPara(i) = New OptParameter With { + .Xn = 0.5 + } Next Case TP_Schwefel24Problem @@ -138,8 +141,9 @@ Public Class Testprobleme Me.mAnzConstraints = 0 ReDim Me.mOptPara(Me.mAnzParameter - 1) For i = 0 To Me.mAnzParameter - 1 - Me.mOptPara(i) = New BlueM.Opt.Common.OptParameter() - Me.mOptPara(i).Xn = 1 + Me.mOptPara(i) = New OptParameter With { + .Xn = 1 + } Next Case TP_Deb1 @@ -150,8 +154,9 @@ Public Class Testprobleme ReDim Me.mOptPara(Me.mAnzParameter - 1) Randomize() For i = 0 To Me.mAnzParameter - 1 - Me.mOptPara(i) = New BlueM.Opt.Common.OptParameter() - Me.mOptPara(i).Xn = Rnd() + Me.mOptPara(i) = New OptParameter With { + .Xn = Rnd() + } Next Case TP_ZitzlerDebT1 @@ -162,8 +167,9 @@ Public Class Testprobleme ReDim Me.mOptPara(Me.mAnzParameter - 1) Randomize() For i = 0 To Me.mAnzParameter - 1 - Me.mOptPara(i) = New BlueM.Opt.Common.OptParameter() - Me.mOptPara(i).Xn = Rnd() + Me.mOptPara(i) = New OptParameter With { + .Xn = Rnd() + } Next Case TP_ZitzlerDebT2 @@ -174,8 +180,9 @@ Public Class Testprobleme ReDim Me.mOptPara(Me.mAnzParameter - 1) Randomize() For i = 0 To Me.mAnzParameter - 1 - Me.mOptPara(i) = New BlueM.Opt.Common.OptParameter() - Me.mOptPara(i).Xn = Rnd() + Me.mOptPara(i) = New OptParameter With { + .Xn = Rnd() + } Next Case TP_ZitzlerDebT3 @@ -186,8 +193,9 @@ Public Class Testprobleme ReDim Me.mOptPara(Me.mAnzParameter - 1) Randomize() For i = 0 To Me.mAnzParameter - 1 - Me.mOptPara(i) = New BlueM.Opt.Common.OptParameter() - Me.mOptPara(i).Xn = Rnd() + Me.mOptPara(i) = New OptParameter With { + .Xn = Rnd() + } Next Case TP_ZitzlerDebT4 @@ -198,8 +206,9 @@ Public Class Testprobleme ReDim Me.mOptPara(Me.mAnzParameter - 1) Randomize() For i = 0 To Me.mAnzParameter - 1 - Me.mOptPara(i) = New BlueM.Opt.Common.OptParameter() - Me.mOptPara(i).Xn = Rnd() + Me.mOptPara(i) = New OptParameter With { + .Xn = Rnd() + } Next Case TP_CONSTR @@ -210,8 +219,9 @@ Public Class Testprobleme ReDim Me.mOptPara(Me.mAnzParameter - 1) Randomize() For i = 0 To Me.mAnzParameter - 1 - Me.mOptPara(i) = New BlueM.Opt.Common.OptParameter() - Me.mOptPara(i).Xn = Rnd() + Me.mOptPara(i) = New OptParameter With { + .Xn = Rnd() + } Next Case TP_Box @@ -222,8 +232,9 @@ Public Class Testprobleme ReDim Me.mOptPara(Me.mAnzParameter - 1) Randomize() For i = 0 To Me.mAnzParameter - 1 - Me.mOptPara(i) = New BlueM.Opt.Common.OptParameter() - Me.mOptPara(i).Xn = Rnd() + Me.mOptPara(i) = New OptParameter With { + .Xn = Rnd() + } Next Case TP_DependentParameters @@ -233,12 +244,13 @@ Public Class Testprobleme Me.mAnzConstraints = 0 ReDim Me.mOptPara(Me.mAnzParameter - 1) For i = 0 To Me.mAnzParameter - 1 - Me.mOptPara(i) = New BlueM.Opt.Common.OptParameter() - Me.mOptPara(i).Xn = 1 + Me.mOptPara(i) = New OptParameter With { + .Xn = 1 + } Next 'Beziehungen - Me.mOptPara(0).Beziehung = Common.Constants.Relationship.none - Me.mOptPara(1).Beziehung = Common.Constants.Relationship.larger_than + Me.mOptPara(0).Beziehung = Constants.Relationship.none + Me.mOptPara(1).Beziehung = Constants.Relationship.larger_than Case TP_FloodMitigation 'Ajay Me.mTestProblemDescription = "Multicriteria Problem Flood Mitigation and Hydropower Generation" @@ -248,8 +260,9 @@ Public Class Testprobleme ReDim Me.mOptPara(Me.mAnzParameter - 1) Randomize() For i = 0 To Me.mAnzParameter - 1 - Me.mOptPara(i) = New BlueM.Opt.Common.OptParameter() - Me.mOptPara(i).Xn = Rnd() + Me.mOptPara(i) = New OptParameter With { + .Xn = Rnd() + } Next For i = 0 To 3 @@ -268,7 +281,7 @@ Public Class Testprobleme Me.mAnzConstraints = 0 ReDim Me.mOptPara(Me.mAnzParameter - 1) For i = 0 To Me.mAnzParameter - 1 - Me.mOptPara(i) = New BlueM.Opt.Common.OptParameter() + Me.mOptPara(i) = New OptParameter() Next Randomize() With Me.mOptPara(0) @@ -288,17 +301,18 @@ Public Class Testprobleme End Select - 'Das Problem mit Pseudo-Werten füllen + 'Das Problem mit Pseudo-Werten füllen ReDim Me.mProblem.List_ObjectiveFunctions(Me.mAnzZiele - 1) For i = 0 To Me.mProblem.NumObjectives - 1 'Check_SH: - Me.mProblem.List_ObjectiveFunctions(i) = New Common.Objectivefunction_Value() - Me.mProblem.List_ObjectiveFunctions(i).isPrimObjective = True - Me.mProblem.List_ObjectiveFunctions(i).Direction = EVO_DIRECTION.Minimization + Me.mProblem.List_ObjectiveFunctions(i) = New ObjectiveFunction_Series With { + .isPrimObjective = True, + .Direction = EVO_DIRECTION.Minimization + } Next ReDim Me.mProblem.List_Constraintfunctions(Me.mAnzConstraints - 1) For i = 0 To Me.mProblem.NumConstraints - 1 - Me.mProblem.List_Constraintfunctions(i) = New Common.Constraintfunction() + Me.mProblem.List_Constraintfunctions(i) = New Constraintfunction() Next ReDim Me.mProblem.List_OptParameter(Me.mAnzParameter - 1) For i = 0 To Me.mProblem.NumOptParams - 1 @@ -340,7 +354,7 @@ Public Class Testprobleme End Sub - 'Diagramm für Sinus-Funktion initialisieren + 'Diagramm für Sinus-Funktion initialisieren '******************************************* Private Sub DiagInitialise_SinusFunktion(ByRef Diag As BlueM.Opt.Diagramm.Hauptdiagramm) @@ -393,7 +407,7 @@ Public Class Testprobleme End Sub - 'Diagramm für Beale-Problem initialisieren + 'Diagramm für Beale-Problem initialisieren '***************************************** Private Sub DiagInitialise_BealeProblem(ByRef Diag As BlueM.Opt.Diagramm.Hauptdiagramm) @@ -424,16 +438,17 @@ Public Class Testprobleme Call Diag.DiagInitialise("Beale problem", achsen, Me.mProblem) - 'Linie für den Ausgangswert anzeigen - colorline1 = New Steema.TeeChart.Tools.ColorLine(Diag.Chart) - colorline1.AllowDrag = False - colorline1.Axis = Diag.Axes.Left - colorline1.Value = Ausgangswert + 'Linie für den Ausgangswert anzeigen + colorline1 = New Steema.TeeChart.Tools.ColorLine(Diag.Chart) With { + .AllowDrag = False, + .Axis = Diag.Axes.Left, + .Value = Ausgangswert + } colorline1.Pen.Color = Drawing.Color.Green End Sub - 'Diagramm für Schwefel-Problem initialisieren + 'Diagramm für Schwefel-Problem initialisieren '******************************************** Private Sub DiagInitialise_SchwefelProblem(ByRef Diag As BlueM.Opt.Diagramm.Hauptdiagramm) @@ -473,16 +488,17 @@ Public Class Testprobleme Call Diag.DiagInitialise("Schwefel 2.4 problem", achsen, Me.mProblem) - 'Linie für den Ausgangswert anzeigen - colorline1 = New Steema.TeeChart.Tools.ColorLine(Diag.Chart) - colorline1.AllowDrag = False - colorline1.Axis = Diag.Axes.Left - colorline1.Value = Ausgangswert + 'Linie für den Ausgangswert anzeigen + colorline1 = New Steema.TeeChart.Tools.ColorLine(Diag.Chart) With { + .AllowDrag = False, + .Axis = Diag.Axes.Left, + .Value = Ausgangswert + } colorline1.Pen.Color = Drawing.Color.Red End Sub - 'Diagramm für MultiObjective-Probleme initialisieren + 'Diagramm für MultiObjective-Probleme initialisieren '*************************************************** Private Sub DiagInitialise_MultiTestProb(ByRef Diag As BlueM.Opt.Diagramm.Hauptdiagramm) @@ -626,7 +642,7 @@ Public Class Testprobleme Case TP_ZitzlerDebT3 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - 'TODO: Titel der Serien (für Export) + 'TODO: Titel der Serien (für Export) Dim ArrayX(100) As Double Dim ArrayY(100) As Double @@ -710,7 +726,7 @@ Public Class Testprobleme End Sub - 'Diagramm für Box-Problem (3D) initialisieren + 'Diagramm für Box-Problem (3D) initialisieren '******************************************** Private Sub DiagInitialise_3D_Box(ByRef Diag As BlueM.Opt.Diagramm.Hauptdiagramm) @@ -774,21 +790,22 @@ Public Class Testprobleme Next Next - surface = New Steema.TeeChart.Styles.Surface(Diag.Chart) - surface.Title = "Constraint 1" - surface.IrregularGrid = True - surface.NumXValues = surfaceRes - surface.NumZValues = surfaceRes - surface.Add(ArrayX, ArrayY, ArrayZ) - surface.UseColorRange = False - surface.UsePalette = False + surface = New Steema.TeeChart.Styles.Surface(Diag.Chart) With { + .Title = "Constraint 1", + .IrregularGrid = True, + .NumXValues = surfaceRes, + .NumZValues = surfaceRes, + .UseColorRange = False, + .UsePalette = False + } surface.Brush.Solid = True - surface.Brush.Color = System.Drawing.Color.Green + surface.Brush.Color = Color.Green surface.Brush.Transparency = 70 - surface.Pen.Color = System.Drawing.Color.Green + surface.Pen.Color = Color.Green surface.SideBrush.Visible = True - surface.SideBrush.Color = System.Drawing.Color.Red + surface.SideBrush.Color = Color.Red surface.SideBrush.Transparency = 70 + surface.Add(ArrayX, ArrayY, ArrayZ) 'Constraint 2 'x + y <= 0.5 @@ -806,35 +823,37 @@ Public Class Testprobleme Next Next - surface = New Steema.TeeChart.Styles.Surface(Diag.Chart) - surface.Title = "Constraint 2" - surface.IrregularGrid = True - surface.NumXValues = 10 - surface.NumZValues = 10 - surface.Add(ArrayX, ArrayY, ArrayZ) - surface.UseColorRange = False - surface.UsePalette = False + surface = New Steema.TeeChart.Styles.Surface(Diag.Chart) With { + .Title = "Constraint 2", + .IrregularGrid = True, + .NumXValues = 10, + .NumZValues = 10, + .UseColorRange = False, + .UsePalette = False + } surface.Brush.Solid = True - surface.Brush.Color = System.Drawing.Color.Blue + surface.Brush.Color = Color.Blue surface.Brush.Transparency = 70 - surface.Pen.Color = System.Drawing.Color.Blue + surface.Pen.Color = Color.Blue surface.SideBrush.Visible = True - surface.SideBrush.Color = System.Drawing.Color.Red + surface.SideBrush.Color = Color.Red surface.SideBrush.Transparency = 70 + surface.Add(ArrayX, ArrayY, ArrayZ) 'Schnittgerade zwischen den Constraints - series3D = New Steema.TeeChart.Styles.Points3D(Diag.Chart) - series3D.Title = "Intersection" + series3D = New Steema.TeeChart.Styles.Points3D(Diag.Chart) With { + .Title = "Intersection" + } series3D.Pointer.Style = Steema.TeeChart.Styles.PointerStyles.Nothing series3D.LinePen.Visible = True series3D.LinePen.Width = 1 - series3D.LinePen.Color = System.Drawing.Color.Red + series3D.LinePen.Color = Color.Red series3D.Add(0.5, 0, 0.3) series3D.Add(0, 0.5, 0.3) End Sub - 'Diagramm für Ackley function initialisieren (3D) + 'Diagramm für Ackley function initialisieren (3D) '************************************************ Private Sub DiagInitialise_Ackley(ByRef Diag As BlueM.Opt.Diagramm.Hauptdiagramm) @@ -904,23 +923,24 @@ Public Class Testprobleme Next Next - surface = New Steema.TeeChart.Styles.Surface(Diag.Chart) - surface.Title = "Ackley function" - surface.IrregularGrid = True - surface.NumXValues = length - surface.NumZValues = length - surface.Add(ArrayX, ArrayZ, ArrayY) - surface.UseColorRange = False - surface.UsePalette = True - surface.PaletteStyle = Steema.TeeChart.Styles.PaletteStyles.Rainbow + surface = New Steema.TeeChart.Styles.Surface(Diag.Chart) With { + .Title = "Ackley function", + .IrregularGrid = True, + .NumXValues = length, + .NumZValues = length, + .UseColorRange = False, + .UsePalette = True, + .PaletteStyle = Steema.TeeChart.Styles.PaletteStyles.Rainbow + } surface.Brush.Solid = True surface.Brush.Transparency = 70 surface.Pen.Visible = False + surface.Add(ArrayX, ArrayZ, ArrayY) End Sub - 'Diagramm für Abhängige Parameter initialisieren + 'Diagramm für Abhängige Parameter initialisieren '*********************************************** Private Sub DiagInitialise_AbhParameter(ByRef Diag As BlueM.Opt.Diagramm.Hauptdiagramm) @@ -982,21 +1002,22 @@ Public Class Testprobleme Next Next - surface = New Steema.TeeChart.Styles.Surface(Diag.Chart) - surface.Title = "X = Y" - surface.IrregularGrid = True - surface.NumXValues = surfaceRes - surface.NumZValues = surfaceRes - surface.Add(ArrayX, ArrayY, ArrayZ) - surface.UseColorRange = False - surface.UsePalette = False + surface = New Steema.TeeChart.Styles.Surface(Diag.Chart) With { + .Title = "X = Y", + .IrregularGrid = True, + .NumXValues = surfaceRes, + .NumZValues = surfaceRes, + .UseColorRange = False, + .UsePalette = False + } surface.Brush.Solid = True - surface.Brush.Color = System.Drawing.Color.Green + surface.Brush.Color = Color.Green surface.Brush.Transparency = 70 - surface.Pen.Color = System.Drawing.Color.Green + surface.Pen.Color = Color.Green surface.SideBrush.Visible = True - surface.SideBrush.Color = System.Drawing.Color.Red + surface.SideBrush.Color = Color.Red surface.SideBrush.Transparency = 70 + surface.Add(ArrayX, ArrayY, ArrayZ) End Sub @@ -1011,7 +1032,7 @@ Public Class Testprobleme ''' Populationsnummer (0-basiert) ''' Referenz auf das Hauptdiagramm ''' - Public Sub Evaluate(ByRef ind As Common.Individuum, ByVal ipop As Short, ByRef Diag As BlueM.Opt.Diagramm.Hauptdiagramm) + Public Sub Evaluate(ByRef ind As Individuum, ByVal ipop As Short, ByRef Diag As BlueM.Opt.Diagramm.Hauptdiagramm) Dim i As Integer Dim Unterteilung_X As Double @@ -1059,7 +1080,7 @@ Public Class Testprobleme Case TP_BealeProblem 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - 'Qualitätswert berechnen + 'Qualitätswert berechnen '----------------------- x1 = -5 + (ind.OptParameter(0).Xn * 10) x2 = -2 + (ind.OptParameter(1).Xn * 4) @@ -1074,7 +1095,7 @@ Public Class Testprobleme Case TP_Schwefel24Problem 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - 'Qualitätswert berechnen + 'Qualitätswert berechnen '----------------------- ReDim x_arr(globalAnzPar - 1) For i = 0 To globalAnzPar - 1 @@ -1097,7 +1118,7 @@ Public Class Testprobleme Case TP_Deb1 'Deb 2000, D1 (Konvexe Pareto-Front) 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - 'Qualitätswert berechnen + 'Qualitätswert berechnen '----------------------- ind.Objectives(0) = ind.OptParameter(0).Xn * (9 / 10) + 0.1 ind.Objectives(1) = (1 + 5 * ind.OptParameter(1).Xn) / (ind.OptParameter(0).Xn * (9 / 10) + 0.1) @@ -1110,7 +1131,7 @@ Public Class Testprobleme Case TP_ZitzlerDebT1 'Zitzler/Deb/Thiele 2000, T1 (Konvexe Pareto-Front) 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - 'Qualitätswert berechnen + 'Qualitätswert berechnen '----------------------- f1 = ind.OptParameter(0).Xn f2 = 0 @@ -1118,7 +1139,7 @@ Public Class Testprobleme f2 = f2 + ind.OptParameter(i).Xn Next i f2 = 1 + 9 / (globalAnzPar - 1) * f2 - f2 = f2 * (1 - System.Math.Sqrt(f1 / f2)) + f2 = f2 * (1 - Math.Sqrt(f1 / f2)) ind.Objectives(0) = f1 ind.Objectives(1) = f2 @@ -1130,7 +1151,7 @@ Public Class Testprobleme Case TP_ZitzlerDebT2 'Zitzler/Deb/Thiele 2000, T2 (Non-Konvexe Pareto-Front) 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - 'Qualitätswerte berechnen + 'Qualitätswerte berechnen '------------------------ f1 = ind.OptParameter(0).Xn f2 = 0 @@ -1150,7 +1171,7 @@ Public Class Testprobleme Case TP_ZitzlerDebT3 'Zitzler/Deb/Thiele 2000, T3 (disconected Pareto-Front) 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - 'Qualitätswerte berechnen + 'Qualitätswerte berechnen '------------------------ f1 = ind.OptParameter(0).Xn f2 = 0 @@ -1170,7 +1191,7 @@ Public Class Testprobleme Case TP_ZitzlerDebT4 'Zitzler/Deb/Thiele 2000, T4 (local/global Pareto-Fronts) 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - 'Qualitätswerte berechnen + 'Qualitätswerte berechnen '------------------------ f1 = ind.OptParameter(0).Xn f2 = 0 @@ -1179,7 +1200,7 @@ Public Class Testprobleme f2 = f2 + (x2 * x2 - 10 * Math.Cos(4 * Math.PI * x2)) Next i f2 = 1 + 10 * (globalAnzPar - 1) + f2 - f2 = f2 * (1 - System.Math.Sqrt(f1 / f2)) + f2 = f2 * (1 - Math.Sqrt(f1 / f2)) ind.Objectives(0) = f1 ind.Objectives(1) = f2 @@ -1191,7 +1212,7 @@ Public Class Testprobleme Case TP_CONSTR 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - 'Qualitätswerte berechnen + 'Qualitätswerte berechnen '------------------------ f1 = ind.OptParameter(0).Xn * (9 / 10) + 0.1 f2 = (1 + 5 * ind.OptParameter(1).Xn) / (ind.OptParameter(0).Xn * (9 / 10) + 0.1) @@ -1210,10 +1231,10 @@ Public Class Testprobleme 'Zeichnen '-------- If (Not ind.Is_Feasible) Then - 'Ungültige Lösung + 'Ungültige Lösung serie = Diag.getSeriesPoint("Population (invalid)", "Gray", Steema.TeeChart.Styles.PointerStyles.Circle, 2) Else - 'Gültige Lösung + 'Gültige Lösung serie = Diag.getSeriesPoint("Population", "Orange", Steema.TeeChart.Styles.PointerStyles.Circle, 2) End If serie.Add(ind.Objectives(0), ind.Objectives(1)) @@ -1221,7 +1242,7 @@ Public Class Testprobleme Case TP_Box 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - 'Qualitätswerte berechnen + 'Qualitätswerte berechnen '------------------------ ind.Objectives(0) = ind.OptParameter(0).Xn ind.Objectives(1) = ind.OptParameter(1).Xn @@ -1236,10 +1257,10 @@ Public Class Testprobleme '-------- Dim serie3D As Steema.TeeChart.Styles.Points3D If (Not ind.Is_Feasible) Then - 'Ungültige Lösung + 'Ungültige Lösung serie3D = Diag.getSeries3DPoint("Population (invalid)", "Gray") Else - 'Gültige Lösung + 'Gültige Lösung serie3D = Diag.getSeries3DPoint("Population", "Orange") End If serie3D.Add(ind.Objectives(0), ind.Objectives(1), ind.Objectives(2)) @@ -1247,7 +1268,7 @@ Public Class Testprobleme Case TP_DependentParameters 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - 'Qualitätswerte berechnen + 'Qualitätswerte berechnen '------------------------ ind.Objectives(0) = ind.OptParameter(0).Xn ^ 2 + ind.OptParameter(1).Xn ^ 2 @@ -1317,7 +1338,7 @@ Public Class Testprobleme serie.Add(ind.Objectives(0), ind.Objectives(1)) Case TP_Ackley - 'Qualitätswert berechnen + 'Qualitätswert berechnen '----------------------- x = ind.OptParameter(0).RWert y = ind.OptParameter(1).RWert diff --git a/BlueM.Opt/Common/BlueM.Opt.Common.vbproj b/BlueM.Opt/Common/BlueM.Opt.Common.vbproj index c8d0fabe..1e823c18 100644 --- a/BlueM.Opt/Common/BlueM.Opt.Common.vbproj +++ b/BlueM.Opt/Common/BlueM.Opt.Common.vbproj @@ -92,7 +92,6 @@ - diff --git a/BlueM.Opt/Common/Constants.vb b/BlueM.Opt/Common/Constants.vb index f4af5ad1..1102933f 100644 --- a/BlueM.Opt/Common/Constants.vb +++ b/BlueM.Opt/Common/Constants.vb @@ -35,8 +35,6 @@ Public Module Constants 'Anwendungen Public Const ANW_BLUEM As String = "BlueM.Sim" - Public Const ANW_SMUSI As String = "SMUSI" - Public Const ANW_SWMM As String = "SWMM" Public Const ANW_TALSIM As String = "TALSIM" Public Const ANW_TALSIM5 As String = "TALSIM5" Public Const ANW_TESTPROBLEMS As String = "Testproblems" @@ -50,13 +48,13 @@ Public Module Constants Public Const METH_DDS As String = "DDS" Public Const METH_TSP As String = "TSP" - 'Lösungs- / Entscheidungsraum + 'Lösungs- / Entscheidungsraum Public Enum SPACE As Integer DecisionSpace = 0 SolutionSpace = 1 End Enum - 'Option für Startvorgabe für Optimierung + 'Option für Startvorgabe für Optimierung Public Enum EVO_STARTPARAMETERS As Integer Random = 1 Original = 2 @@ -76,17 +74,17 @@ Public Module Constants 'Option zur Erzeugung der Eltern Public Enum PES_REPRODOP As Integer - Selection = 1 'zufällige Selektion as Bestwertspeicher + Selection = 1 'zufällige Selektion as Bestwertspeicher XX_Discrete = 2 'Rekombination nach x/x-Schema, diskretes vertauschen der Gene - XX_Average = 3 'Rekombination nach x/x-Schema, mittelwertbildung der Gene über y-Eltern + XX_Average = 3 'Rekombination nach x/x-Schema, mittelwertbildung der Gene über y-Eltern XY_Discrete = 4 'Rekombination nach x/y-Schema, diskretes vertauschen der Gene - XY_Average = 5 'Rekombination nach x/y-Schema, mittelwertbildung der Gene über y-Eltern + XY_Average = 5 'Rekombination nach x/y-Schema, mittelwertbildung der Gene über y-Eltern Neighborhood = 6 'Neighborhood-Rekombination XX_Average_Discrete = 7 'Rekombination nach x/x-Schema, diskretes vertauschen der Gene, miteln der Strategieparameter XY_Average_Discrete = 8 'Rekombination nach x/y-Schema, diskretes vertauschen der Gene, miteln der Strategieparameter End Enum - 'Option für die Mutation + 'Option für die Mutation Public Enum PES_MUTATIONSOP As Integer Rechenberg = 1 Schwefel = 2 @@ -97,10 +95,10 @@ Public Module Constants Public Enum EVO_POP_ELTERN As Integer Recombination = 1 'Rekombination aus den PopEltern Average = 2 'Mittelwertbildung aus den PopEltern - Selection = 3 'zufällige Selektion aus Bestwertspeicher + Selection = 3 'zufällige Selektion aus Bestwertspeicher End Enum - 'Option zur Ermittlung der Populationsqualität + 'Option zur Ermittlung der Populationsqualität Public Enum EVO_POP_PENALTY As Integer Average = 1 'SingleObjective Worst = 2 'SingleObjective diff --git a/BlueM.Opt/Common/FileHelper.vb b/BlueM.Opt/Common/FileHelper.vb index 8bf4a2b0..9ee696a1 100644 --- a/BlueM.Opt/Common/FileHelper.vb +++ b/BlueM.Opt/Common/FileHelper.vb @@ -15,7 +15,6 @@ 'You should have received a copy of the GNU General Public License 'along with this program. If not, see . ' -Imports System.IO Public Module FileHelper @@ -23,25 +22,25 @@ Public Module FileHelper '***************************************************************************************** Public Sub purgeReadOnly(ByVal path As String) - Dim mainDir As New DirectoryInfo(path) + Dim mainDir As New IO.DirectoryInfo(path) Dim fInfo As IO.FileInfo() = mainDir.GetFiles("*.*") 'now loop through all the files and change the file attributes to normal Dim file As IO.FileInfo For Each file In fInfo - If (file.Attributes And FileAttributes.ReadOnly) Then - file.Attributes = FileAttributes.Normal + If (file.Attributes And IO.FileAttributes.ReadOnly) Then + file.Attributes = IO.FileAttributes.Normal End If Next 'do the same for the directories - Dim dInfo As DirectoryInfo() = mainDir.GetDirectories("*.*") - Dim dir As DirectoryInfo + Dim dInfo As IO.DirectoryInfo() = mainDir.GetDirectories("*.*") + Dim dir As IO.DirectoryInfo For Each dir In dInfo - If (dir.Attributes And FileAttributes.ReadOnly) Then - dir.Attributes = FileAttributes.Normal + If (dir.Attributes And IO.FileAttributes.ReadOnly) Then + dir.Attributes = IO.FileAttributes.Normal End If 'Call method recursively diff --git a/BlueM.Opt/Common/Individuum/Individuum.vb b/BlueM.Opt/Common/Individuum/Individuum.vb index ece206b8..0550818c 100644 --- a/BlueM.Opt/Common/Individuum/Individuum.vb +++ b/BlueM.Opt/Common/Individuum/Individuum.vb @@ -16,7 +16,7 @@ 'along with this program. If not, see . ' ''' -''' Basisklasse Individuum für das Speichern eines Evaluierungssatzes +''' Basisklasse Individuum für das Speichern eines Evaluierungssatzes ''' Public MustInherit Class Individuum @@ -40,12 +40,12 @@ Public MustInherit Class Individuum Protected mID As Integer 'ID des Individuums Protected mAllObjectives() As Double 'Array aller Objectivefunktionswerte (inkl. PrimaryObjectives) - Protected mConstraints() As Double 'Werte der Randbedingungen (Wenn negativ dann ungültig) + Protected mConstraints() As Double 'Werte der Randbedingungen (Wenn negativ dann ungültig) - 'Für ND Sorting ------------------------------------------------- + 'Für ND Sorting ------------------------------------------------- Protected mDominated As Boolean 'Kennzeichnung ob Dominiert Protected mFront As Integer 'Nummer der Pareto Front - Protected mDistance As Double 'Für crowding distance + Protected mDistance As Double 'Für crowding distance #End Region 'Eigenschaften @@ -66,7 +66,7 @@ Public MustInherit Class Individuum ''' ''' Die OptParameter als Objekte ''' - Public MustOverride Property OptParameter() As BlueM.Opt.Common.OptParameter() + Public MustOverride Property OptParameter() As OptParameter() ''' ''' Die OptParameter als skalierte Werte @@ -87,12 +87,12 @@ Public MustInherit Class Individuum End Get Set(ByVal values As Double()) - 'Prüfung: Anzahl Parameter + 'Prüfung: Anzahl Parameter If (values.Length <> Individuum.mProblem.NumOptParams) Then - Throw New Exception("Falsche Anzahl Parameter übergeben!") + Throw New Exception("Falsche Anzahl Parameter übergeben!") End If - 'Prüfung: zwischen 0 und 1 + 'Prüfung: zwischen 0 und 1 For Each param As Double In values If (param < 0 Or param > 1) Then Throw New Exception("Skalierter Parameterwert muss zwischen 0 und 1 liegen!") @@ -127,9 +127,9 @@ Public MustInherit Class Individuum End Get Set(ByVal values As Double()) - 'Prüfung: Anzahl Parameter + 'Prüfung: Anzahl Parameter If (values.Length <> Individuum.mProblem.NumOptParams) Then - Throw New Exception("Falsche Anzahl Parameter übergeben!") + Throw New Exception("Falsche Anzahl Parameter übergeben!") End If Dim i As Integer @@ -166,7 +166,7 @@ Public MustInherit Class Individuum j = 0 For i = 0 To Individuum.mProblem.NumObjectives - 1 - 'Nur die Objective-Werte von PrimaryObjective-Funktionen zurückgeben! + 'Nur die Objective-Werte von PrimaryObjective-Funktionen zurückgeben! If (Individuum.mProblem.List_ObjectiveFunctions(i).isPrimObjective) Then Array(j) = Me.Objectives(i) j += 1 @@ -202,7 +202,7 @@ Public MustInherit Class Individuum End Property ''' - ''' Nummer der Pareto-Front, zu dem das Individuum gehört + ''' Nummer der Pareto-Front, zu dem das Individuum gehört ''' Public Property Front() As Integer Get @@ -226,9 +226,9 @@ Public MustInherit Class Individuum End Property ''' - ''' Zeigt an, ob das Individuum gültig ist + ''' Zeigt an, ob das Individuum gültig ist ''' - ''' wenn einer der Werte der Constraint-Funktionen negativ ist, ist das Individuum ungültig (Is_Feasible = False) + ''' wenn einer der Werte der Constraint-Funktionen negativ ist, ist das Individuum ungültig (Is_Feasible = False) Public ReadOnly Property Is_Feasible() As Boolean Get For i As Integer = 0 To Me.Constraints.GetUpperBound(0) @@ -294,7 +294,7 @@ Public MustInherit Class Individuum 'Nummer der Pareto Front Me.Front = 0 - 'Für crowding distance + 'Für crowding distance Me.Distance = 0 End Sub @@ -309,7 +309,7 @@ Public MustInherit Class Individuum ''' Erzeugt ein Array von neuen Individuen ''' ''' Individuumsklasse - ''' Länge des Arrays + ''' Länge des Arrays ''' beliebiger String ''' Array von Individuen ''' diff --git a/BlueM.Opt/Common/Individuum/Individuum_MetaEvo.vb b/BlueM.Opt/Common/Individuum/Individuum_MetaEvo.vb index 018e955d..9d69c5e5 100644 --- a/BlueM.Opt/Common/Individuum/Individuum_MetaEvo.vb +++ b/BlueM.Opt/Common/Individuum/Individuum_MetaEvo.vb @@ -49,10 +49,11 @@ Public Class Individuum_MetaEvo 'Initialisieren der Optparameter For i = 0 To numberOptparas - 1 - Me.mOptparameter(i) = New OptParameter() - Me.mOptparameter(i).Min = Individuum.mProblem.List_OptParameter(i).Min - Me.mOptparameter(i).Max = Individuum.mProblem.List_OptParameter(i).Max - Me.mOptparameter(i).Bezeichnung = Individuum.mProblem.List_OptParameter(i).Bezeichnung + Me.mOptparameter(i) = New OptParameter With { + .Min = Individuum.mProblem.List_OptParameter(i).Min, + .Max = Individuum.mProblem.List_OptParameter(i).Max, + .Bezeichnung = Individuum.mProblem.List_OptParameter(i).Bezeichnung + } Next 'Constraints auf 0 setzen diff --git a/BlueM.Opt/Common/Individuum/Individuum_PES.vb b/BlueM.Opt/Common/Individuum/Individuum_PES.vb index c73ed5d0..e0fe67a0 100644 --- a/BlueM.Opt/Common/Individuum/Individuum_PES.vb +++ b/BlueM.Opt/Common/Individuum/Individuum_PES.vb @@ -23,7 +23,7 @@ Public Class Individuum_PES ''' ''' Die OptParameter als Objekte ''' - Public Overrides Property OptParameter() As BlueM.Opt.Common.OptParameter() + Public Overrides Property OptParameter() As OptParameter() Get Return Me.mOptParas End Get diff --git a/BlueM.Opt/Common/Log.vb b/BlueM.Opt/Common/Log.vb index 37eeb220..4c0b3640 100644 --- a/BlueM.Opt/Common/Log.vb +++ b/BlueM.Opt/Common/Log.vb @@ -1,4 +1,4 @@ -'BlueM.Opt +'BlueM.Opt 'Copyright (C) BlueM Dev Group 'Website: ' @@ -15,8 +15,6 @@ 'You should have received a copy of the GNU General Public License 'along with this program. If not, see . ' -Imports System.IO -Imports System.Net.Sockets ''' ''' The log ''' @@ -69,7 +67,7 @@ Public Module Log Public Sub AddMessage(level As levels, msg As String) 'format message - msg = $"{DateTime.Now:dd.MM.yyyy HH:mm:ss} {level.ToString.ToUpper()}: {msg}{eol}" + msg = $"{DateTime.Now:dd.MM.yyyy HH:mm:ss} {level.ToString.ToUpper()}: {msg}{Constants.eol}" 'store _Log &= msg @@ -79,7 +77,7 @@ Public Module Log Try 'use a lock to ensure only one thread writes to the file at a time SyncLock locker - Using writer As New StreamWriter(_File, True) + Using writer As New IO.StreamWriter(_File, True) writer.WriteLine(msg) End Using End SyncLock diff --git a/BlueM.Opt/Common/ObjectiveFunctions/ObjectiveFunction.vb b/BlueM.Opt/Common/ObjectiveFunctions/ObjectiveFunction.vb index b728a0a2..273b59cd 100644 --- a/BlueM.Opt/Common/ObjectiveFunctions/ObjectiveFunction.vb +++ b/BlueM.Opt/Common/ObjectiveFunctions/ObjectiveFunction.vb @@ -15,11 +15,9 @@ 'You should have received a copy of the GNU General Public License 'along with this program. If not, see . ' -Imports System.Globalization -Imports BlueM ''' -''' Klasse für die Definition von Objective Funktionen +''' Klasse für die Definition von Objective Funktionen ''' Public MustInherit Class ObjectiveFunction @@ -46,7 +44,6 @@ Public MustInherit Class ObjectiveFunction Public Enum ObjectiveType As Integer Series = 1 - Value = 2 ValueFromSeries = 3 Aggregate = 5 End Enum @@ -77,7 +74,7 @@ Public MustInherit Class ObjectiveFunction Public Factor As Double ''' - ''' File extension of the result file from which to read the simulation result, e.g. "WEL", "ASC", "KTR.WEL", "WBL", etc. + ''' File extension of the result file from which to read the simulation result, e.g. "WEL", "KTR.WEL", "WBL", etc. ''' Public FileExtension As String @@ -272,7 +269,7 @@ Public MustInherit Class ObjectiveFunction Next objectiveValue = sUnter - Case "NGT", "NÜBER" + Case "NGT", "NÜBER" 'Relative number of timesteps where simulation is greater than reference [%] '--------------------------------------------------------------------------- Dim nUeber As Integer = 0 @@ -283,7 +280,7 @@ Public MustInherit Class ObjectiveFunction Next objectiveValue = nUeber / SimSeries.Length * 100 - Case "SGT", "SÜBER" + Case "SGT", "SÜBER" 'Sum of simulation values greater than reference '----------------------------------------------- Dim sUeber As Double = 0 @@ -386,18 +383,6 @@ Public MustInherit Class ObjectiveFunction Dim variabilityratio As Double = (std_sim / avg_sim) / (std_obs / avg_obs) objectiveValue = 1 - Math.Sqrt((corr - 1) ^ 2 + (biasratio - 1) ^ 2 + (variabilityratio - 1) ^ 2) - Case "NASHSUTT" - 'Modified Nash Sutcliffe (deprecated) - '1 - NSE - '------------------------------------ - objectiveValue = 1.0 - compareSeries(SimSeries, RefSeries, "NSE") - - Case "LNNASHSUTT" - 'Modified Logarithmic Nash Sutcliffe (deprecated) - '1 - lnNSE - '------------------------------------------------ - objectiveValue = 1.0 - compareSeries(SimSeries, RefSeries, "lnNSE") - Case Else Throw New Exception($"The objective function '{[Function]}' is not supported for series comparisons!") diff --git a/BlueM.Opt/Common/ObjectiveFunctions/Objectivefunction_Value.vb b/BlueM.Opt/Common/ObjectiveFunctions/Objectivefunction_Value.vb deleted file mode 100644 index dba47cb1..00000000 --- a/BlueM.Opt/Common/ObjectiveFunctions/Objectivefunction_Value.vb +++ /dev/null @@ -1,68 +0,0 @@ -'BlueM.Opt -'Copyright (C) BlueM Dev Group -'Website: -' -'This program is free software: you can redistribute it and/or modify -'it under the terms of the GNU General Public License as published by -'the Free Software Foundation, either version 3 of the License, or -'(at your option) any later version. -' -'This program is distributed in the hope that it will be useful, -'but WITHOUT ANY WARRANTY; without even the implied warranty of -'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -'GNU General Public License for more details. -' -'You should have received a copy of the GNU General Public License -'along with this program. If not, see . -' -Public Class Objectivefunction_Value - Inherits ObjectiveFunction - - ''' - ''' Returns the type of the ObjectiveFunction - ''' - Public Overrides ReadOnly Property GetObjType() As ObjectiveType - Get - Return ObjectiveType.Value - End Get - End Property - - ''' - ''' Reference value - ''' - Public RefValue As Double - - ''' - ''' Section (block) in which the target variable is located - ''' - Public Block As String - - ''' - ''' Target variable (column) within the block - ''' - Public Column As String - - ''' - ''' Calculate ObjectiveFunction value - ''' - ''' simulation result - ''' objective function value - Public Overrides Function calculateObjective(ByVal SimResult As SimResults) As Double - - Dim SimValue As Double - Dim objectiveValue As Double - - 'SimWert aus SimErgebnis rausholen - SimValue = SimResult.Values(Me.Description) - - 'Wertevergleich ausführen - objectiveValue = ObjectiveFunction.compareValues(SimValue, Me.RefValue, Me.Function) - - 'Zielrichtung berücksichtigen - objectiveValue *= Me.Direction - - Return objectiveValue - - End Function - -End Class diff --git a/BlueM.Opt/Common/OptParameter.vb b/BlueM.Opt/Common/OptParameter.vb index b8e5a5c5..6b41e78b 100644 --- a/BlueM.Opt/Common/OptParameter.vb +++ b/BlueM.Opt/Common/OptParameter.vb @@ -17,7 +17,7 @@ ' ''' ''' Klasse OptParameter -''' für das Speichern eines Optimierungsparameters und zugehöriger Informationen +''' für das Speichern eines Optimierungsparameters und zugehöriger Informationen ''' Public Class OptParameter @@ -29,8 +29,8 @@ Public Class OptParameter 'Parameterwerte Public Xn As Double 'Skalierter Parameterwert - Public Min As Double 'Minwert für die Umrechnung in reellen Parameterwert - Public Max As Double 'Maxwert für die Umrechnung in reellen Parameterwert + Public Min As Double 'Minwert für die Umrechnung in reellen Parameterwert + Public Max As Double 'Maxwert für die Umrechnung in reellen Parameterwert Public Property RWert() As Double 'Reeller Parameterwert Get @@ -45,11 +45,11 @@ Public Class OptParameter 'Schrittweite Public Dn As Double - 'Schiefemaß + 'Schiefemaß Public C As Double 'Beziehung - Public Beziehung As Common.Constants.Relationship + Public Beziehung As Constants.Relationship #End Region 'Eigenschaften @@ -84,16 +84,16 @@ Public Class OptParameter '******************************* Public Function Clone() As OptParameter - Clone = New OptParameter() - - Clone.Bezeichnung = Me.Bezeichnung - Clone.Einheit = Me.Einheit - Clone.Xn = Me.Xn - Clone.Dn = Me.Dn - Clone.Min = Me.Min - Clone.Max = Me.Max - Clone.StartWert = Me.StartWert - Clone.Beziehung = Me.Beziehung + Clone = New OptParameter With { + .Bezeichnung = Me.Bezeichnung, + .Einheit = Me.Einheit, + .Xn = Me.Xn, + .Dn = Me.Dn, + .Min = Me.Min, + .Max = Me.Max, + .StartWert = Me.StartWert, + .Beziehung = Me.Beziehung + } Return Clone @@ -118,7 +118,7 @@ Public Class OptParameter 'Konvertiert eine Liste von OptParametern in ein Array von Doubles (Xn) '********************************************************************** - Public Shared Function Get_OptParas_Xn(ByVal OptParameter() As BlueM.Opt.Common.OptParameter) As Double() + Public Shared Function Get_OptParas_Xn(ByVal OptParameter() As OptParameter) As Double() Dim i As Integer Dim Xn() As Double diff --git a/BlueM.Opt/Common/Problem.vb b/BlueM.Opt/Common/Problem.vb index 23afa629..bac1b06f 100644 --- a/BlueM.Opt/Common/Problem.vb +++ b/BlueM.Opt/Common/Problem.vb @@ -15,12 +15,10 @@ 'You should have received a copy of the GNU General Public License 'along with this program. If not, see . ' -Imports System.IO -Imports BlueM ''' ''' Klasse Problem -''' Definiert das zu lösende Optimierungsproblem +''' Definiert das zu lösende Optimierungsproblem ''' Public Class Problem @@ -62,7 +60,7 @@ Public Class Problem ''' ''' Liste der Objective Functions ''' - ''' Enthält sowohl Objective Functions als auch PrimaryObjectiveFunctions + ''' Enthält sowohl Objective Functions als auch PrimaryObjectiveFunctions Public List_ObjectiveFunctions() As ObjectiveFunction ''' ''' Liste der Constraint Functions @@ -129,13 +127,13 @@ Public Class Problem ''' Optimierungsmodus ''' ''' Single-Objective oder Multi-Objective - Public ReadOnly Property Modus() As BlueM.Opt.Common.Constants.EVO_MODE + Public ReadOnly Property Modus() As Constants.EVO_MODE Get Select Case Me.NumPrimObjective Case 1 - Return EVO_MODE.Single_Objective + Return Constants.EVO_MODE.Single_Objective Case Is > 1 - Return EVO_MODE.Multi_Objective + Return Constants.EVO_MODE.Multi_Objective Case Else Throw New Exception("No primary objective functions are defined!") End Select @@ -215,21 +213,21 @@ Public Class Problem Public ReadOnly Property Description() As String Get Dim msg As String - msg = $"Objective Functions ({Me.NumPrimObjective} primary, {Me.NumSecObjectives} secondary):" & eol + msg = $"Objective Functions ({Me.NumPrimObjective} primary, {Me.NumSecObjectives} secondary):" & Constants.eol For Each obj As ObjectiveFunction In Me.List_ObjectiveFunctions - msg &= "* " & obj.Description & eol + msg &= "* " & obj.Description & Constants.eol Next - msg &= $"Optimization parameters ({Me.NumOptParams}):" & eol + msg &= $"Optimization parameters ({Me.NumOptParams}):" & Constants.eol For Each optparam As OptParameter In Me.List_OptParameter - msg &= "* " & optparam.Bezeichnung & eol + msg &= "* " & optparam.Bezeichnung & Constants.eol Next - msg &= $"Model parameters ({Me.NumModelParams}):" & eol + msg &= $"Model parameters ({Me.NumModelParams}):" & Constants.eol For Each modparam As Struct_ModellParameter In Me.List_ModellParameter - msg &= "* " & modparam.Bezeichnung & eol + msg &= "* " & modparam.Bezeichnung & Constants.eol Next - msg &= $"Constraints ({Me.NumConstraints}):" & eol + msg &= $"Constraints ({Me.NumConstraints}):" & Constants.eol For Each constraint As Constraintfunction In Me.List_Constraintfunctions - msg &= "* " & constraint.Bezeichnung & eol + msg &= "* " & constraint.Bezeichnung & Constants.eol Next Return msg End Get @@ -279,7 +277,7 @@ Public Class Problem '----------- 'Modell-/Optparameter validieren Call Me.Validate_OPT_fits_to_MOD() - 'Prüfen der Anfangswerte + 'Prüfen der Anfangswerte Call Me.Validate_Startvalues() @@ -298,8 +296,8 @@ Public Class Problem Dim Datei As String = IO.Path.Combine(Me.mWorkDir, Me.Datensatz & "." & FILEEXT_OPT) - Dim FiStr As FileStream = New FileStream(Datei, FileMode.Open, IO.FileAccess.ReadWrite) - Dim StrRead As StreamReader = New StreamReader(FiStr, System.Text.Encoding.GetEncoding("iso8859-1")) + Dim FiStr As New IO.FileStream(Datei, IO.FileMode.Open, IO.FileAccess.ReadWrite) + Dim StrRead As New IO.StreamReader(FiStr, Text.Encoding.GetEncoding("iso8859-1")) Dim Zeile As String Dim AnzParam As Integer = 0 @@ -315,8 +313,8 @@ Public Class Problem ReDim List_OptParameter(AnzParam - 1) - 'Zurück zum Dateianfang und lesen - FiStr.Seek(0, SeekOrigin.Begin) + 'Zurück zum Dateianfang und lesen + FiStr.Seek(0, IO.SeekOrigin.Begin) Dim array() As String Dim Bez_str As String = "" @@ -327,19 +325,19 @@ Public Class Problem Continue Do End If 'OptParameter instanzieren - List_OptParameter(i) = New BlueM.Opt.Common.OptParameter() + List_OptParameter(i) = New OptParameter() array = Zeile.Split("|") 'Werte zuweisen List_OptParameter(i).Bezeichnung = array(1).Trim() List_OptParameter(i).Einheit = array(2).Trim() - List_OptParameter(i).StartWert = Convert.ToDouble(array(3).Trim(), Common.Provider.FortranProvider) - List_OptParameter(i).Min = Convert.ToDouble(array(4).Trim(), Common.Provider.FortranProvider) - List_OptParameter(i).Max = Convert.ToDouble(array(5).Trim(), Common.Provider.FortranProvider) + List_OptParameter(i).StartWert = Convert.ToDouble(array(3).Trim(), Provider.FortranProvider) + List_OptParameter(i).Min = Convert.ToDouble(array(4).Trim(), Provider.FortranProvider) + List_OptParameter(i).Max = Convert.ToDouble(array(5).Trim(), Provider.FortranProvider) 'liegt eine Beziehung vor? If (i > 0 And array.GetUpperBound(0) > 6) Then If Not array(6).Trim() = "" Then - Me.List_OptParameter(i).Beziehung = Common.Constants.getRelationship(array(6).Trim()) + Me.List_OptParameter(i).Beziehung = Constants.getRelationship(array(6).Trim()) End If End If @@ -366,8 +364,8 @@ Public Class Problem Dim Datei As String = IO.Path.Combine(Me.mWorkDir, Me.Datensatz & "." & FILEEXT_MOD) - Dim FiStr As FileStream = New FileStream(Datei, FileMode.Open, IO.FileAccess.ReadWrite) - Dim StrRead As StreamReader = New StreamReader(FiStr, System.Text.Encoding.GetEncoding("iso8859-1")) + Dim FiStr As New IO.FileStream(Datei, IO.FileMode.Open, IO.FileAccess.ReadWrite) + Dim StrRead As New IO.StreamReader(FiStr, Text.Encoding.GetEncoding("iso8859-1")) Dim Zeile As String Dim AnzParam As Integer = 0 @@ -383,8 +381,8 @@ Public Class Problem ReDim Me.List_ModellParameter(AnzParam - 1) - 'Zurück zum Dateianfang und lesen - FiStr.Seek(0, SeekOrigin.Begin) + 'Zurück zum Dateianfang und lesen + FiStr.Seek(0, IO.SeekOrigin.Begin) Dim array() As String Dim i As Integer = 0 @@ -405,7 +403,7 @@ Public Class Problem .ZeileNr = Convert.ToInt16(array(6).Trim()) .SpVon = If(array(7).Trim() <> "", Convert.ToInt16(array(7).Trim()), 0) .SpBis = If(array(8).Trim() <> "", Convert.ToInt16(array(8).Trim()), 0) - .Faktor = Convert.ToDouble(array(9).Trim(), Common.Provider.FortranProvider) + .Faktor = Convert.ToDouble(array(9).Trim(), Provider.FortranProvider) End With i += 1 Loop Until StrRead.Peek() = -1 @@ -424,7 +422,6 @@ Public Class Problem Private Sub Read_OBF(ByVal SimStart As DateTime, ByVal SimEnde As DateTime) Const AnzSpalten_ObjFSeries As Integer = 13 'Anzahl Spalten Reihenvergleich in der OBF-Datei - Const AnzSpalten_ObjFValue As Integer = 12 'Anzahl Spalten Wertevergleich in der OBF-Datei Const AnzSpalten_ObjFValueFromSeries As Integer = 13 'Anzahl Spalten Reihenwertevergleich in der OBF-Datei Const AnzSpalten_ObjFAggregate As Integer = 5 'Anzahl Spalten Aggregierte Ziele in der OBF-Datei @@ -436,11 +433,11 @@ Public Class Problem Dim filepath As String = IO.Path.Combine(Me.mWorkDir, Me.Datensatz & "." & FILEEXT_OBF) 'Open the file - Dim FiStr As New FileStream(filepath, FileMode.Open, IO.FileAccess.Read) - Dim StrRead As New StreamReader(FiStr, System.Text.Encoding.GetEncoding("iso8859-1")) + Dim FiStr As New IO.FileStream(filepath, IO.FileMode.Open, IO.FileAccess.Read) + Dim StrRead As New IO.StreamReader(FiStr, Text.Encoding.GetEncoding("iso8859-1")) ReDim Me.List_ObjectiveFunctions(-1) - Dim currentObjectiveType As Common.ObjectiveFunction.ObjectiveType + Dim currentObjectiveType As ObjectiveFunction.ObjectiveType Try @@ -454,7 +451,7 @@ Public Class Problem If Zeile.StartsWith("*Series") Then currentObjectiveType = ObjectiveFunction.ObjectiveType.Series ElseIf Zeile.StartsWith("*Values") Then - currentObjectiveType = ObjectiveFunction.ObjectiveType.Value + Throw New Exception("The block ""*Values"" is no longer supported in the OBF file!") ElseIf Zeile.StartsWith("*ValueFromSeries") Then currentObjectiveType = ObjectiveFunction.ObjectiveType.ValueFromSeries ElseIf Zeile.StartsWith("*Aggregate") Then @@ -485,7 +482,7 @@ Public Class Problem End If 'ObjectiveFunction instanzieren - Dim Objective_Series As New Common.ObjectiveFunction_Series() + Dim Objective_Series As New ObjectiveFunction_Series() 'Gemeinsame Spalten einlesen Call Me.Read_OBF_CommonColumns(Objective_Series, Zeile) @@ -510,7 +507,7 @@ Public Class Problem .RefSeriesFile = WerteArray(12).Trim() If (WerteArray(13).Trim() <> "") Then .hasCurrentValue = True - .CurrentValue = Convert.ToDouble(WerteArray(13).Trim(), Common.Provider.FortranProvider) + .CurrentValue = Convert.ToDouble(WerteArray(13).Trim(), Provider.FortranProvider) 'Reverse the sign for objective functions that should be maximized (#198) If .Direction = EVO_DIRECTION.Maximization Then .CurrentValue = .CurrentValue * -1 @@ -529,46 +526,6 @@ Public Class Problem Me.List_ObjectiveFunctions(i) = Objective_Series i += 1 - Case ObjectiveFunction.ObjectiveType.Value - - 'Wertevergleich - '============== - - 'Kontrolle - If (WerteArray.GetUpperBound(0) <> AnzSpalten_ObjFValue + 1) Then - Throw New Exception("The block ""Values"" in the OBF input file has the wrong number of columns!") - End If - - 'ObjectiveFunction instanzieren - Dim Objective_Value As New Common.Objectivefunction_Value() - - 'Gemeinsame Spalten einlesen - Call Me.Read_OBF_CommonColumns(Objective_Value, Zeile) - - 'Restliche Spalten einlesen - With Objective_Value - .Block = WerteArray(9).Trim() - .Column = WerteArray(10).Trim() - If (WerteArray(11).Trim() <> "") Then - .RefValue = Convert.ToDouble(WerteArray(11).Trim(), Common.Provider.FortranProvider) - End If - If (WerteArray(12).Trim() <> "") Then - .hasCurrentValue = True - .CurrentValue = Convert.ToDouble(WerteArray(12).Trim(), Common.Provider.FortranProvider) - 'Reverse the sign for objective functions that should be maximized (#198) - If .Direction = EVO_DIRECTION.Maximization Then - .CurrentValue = .CurrentValue * -1 - End If - Else - .hasCurrentValue = False - End If - End With - - 'Neue ObjectiveFunction abspeichern - ReDim Preserve Me.List_ObjectiveFunctions(i) - Me.List_ObjectiveFunctions(i) = Objective_Value - i += 1 - Case ObjectiveFunction.ObjectiveType.ValueFromSeries 'ReihenWertevergleich @@ -580,7 +537,7 @@ Public Class Problem End If 'ObjectiveFunction instanzieren - Dim Objective_ValueFromSeries As New Common.ObjectiveFunction_ValueFromSeries() + Dim Objective_ValueFromSeries As New ObjectiveFunction_ValueFromSeries() 'Gemeinsame Spalten einlesen Call Me.Read_OBF_CommonColumns(Objective_ValueFromSeries, Zeile) @@ -603,11 +560,11 @@ Public Class Problem End If .ValueFunction = WerteArray(11).Trim() If (WerteArray(12).Trim() <> "") Then - .RefValue = Convert.ToDouble(WerteArray(12).Trim(), Common.Provider.FortranProvider) + .RefValue = Convert.ToDouble(WerteArray(12).Trim(), Provider.FortranProvider) End If If (WerteArray(13).Trim() <> "") Then .hasCurrentValue = True - .CurrentValue = Convert.ToDouble(WerteArray(13).Trim(), Common.Provider.FortranProvider) + .CurrentValue = Convert.ToDouble(WerteArray(13).Trim(), Provider.FortranProvider) 'Reverse the sign for objective functions that should be maximized (#198) If .Direction = EVO_DIRECTION.Maximization Then .CurrentValue = .CurrentValue * -1 @@ -633,7 +590,7 @@ Public Class Problem End If 'ObjectiveFunction instanzieren - Dim Objective_Aggregate As New Common.ObjectiveFunction_Aggregate() + Dim Objective_Aggregate As New ObjectiveFunction_Aggregate() 'Spalten einlesen With Objective_Aggregate @@ -645,13 +602,13 @@ Public Class Problem .Description = WerteArray(2).Trim() .Group = WerteArray(3).Trim() If (WerteArray(4).Trim() = "+") Then - .Direction = Common.EVO_DIRECTION.Maximization + .Direction = Constants.EVO_DIRECTION.Maximization Else - .Direction = Common.EVO_DIRECTION.Minimization + .Direction = Constants.EVO_DIRECTION.Minimization End If If (WerteArray(5).Trim() <> "") Then .hasCurrentValue = True - .CurrentValue = Convert.ToDouble(WerteArray(5).Trim(), Common.Provider.FortranProvider) + .CurrentValue = Convert.ToDouble(WerteArray(5).Trim(), Provider.FortranProvider) 'Reverse the sign for objective functions that should be maximized (#198) If .Direction = EVO_DIRECTION.Maximization Then .CurrentValue = .CurrentValue * -1 @@ -696,7 +653,7 @@ Public Class Problem ''' objective function in der die Werte abgelegt werden sollen ''' Zeile der OBF-Datei ''' - Private Sub Read_OBF_CommonColumns(ByRef objective As BlueM.Opt.Common.ObjectiveFunction, ByVal zeile As String) + Private Sub Read_OBF_CommonColumns(ByRef objective As ObjectiveFunction, ByVal zeile As String) Dim WerteArray() As String @@ -711,9 +668,9 @@ Public Class Problem .Description = WerteArray(2).Trim() .Group = WerteArray(3).Trim() If (WerteArray(4).Trim() = "+") Then - .Direction = Common.EVO_DIRECTION.Maximization + .Direction = Constants.EVO_DIRECTION.Maximization Else - .Direction = Common.EVO_DIRECTION.Minimization + .Direction = Constants.EVO_DIRECTION.Minimization End If If (WerteArray(5).Trim() = "+") Then @@ -751,16 +708,16 @@ Public Class Problem refSeries = fileInstance.getTimeSeries(refName) End If Catch ex As Exception - Throw New Exception($"Unable to read reference series '{filePath}'!{eol}Error: {ex.Message}", ex) + Throw New Exception($"Unable to read reference series '{filePath}'!{Constants.eol}Error: {ex.Message}", ex) End Try - 'Zeitraum der Referenzreihe überprüfen + 'Zeitraum der Referenzreihe überprüfen If (refSeries.StartDate > EvalStart Or refSeries.EndDate < EvalEnde) Then 'Referenzreihe deckt Evaluierungszeitraum nicht ab Throw New Exception($"The reference series '{filePath}' does not cover the evaluation period!") End If - 'Referenzreihe auf Evaluierungszeitraum kürzen + 'Referenzreihe auf Evaluierungszeitraum kürzen Call refSeries.Cut(EvalStart, EvalEnde) If refSeries.Length = 0 Then Throw New Exception($"The reference series '{filePath}' is empty after cutting to the evaluation period!") @@ -789,7 +746,7 @@ Public Class Problem 'Format: '*|---------------|----------|-------|-----------|------------|----------------------|-----------------------------| '*| | | | | | Grenzwert | Grenzreihe | - '*| Bezeichnung | GrenzTyp | Datei | SimGröße | Oben/Unten | WertTyp | Grenzwert | Grenzgröße | Datei | + '*| Bezeichnung | GrenzTyp | Datei | SimGröße | Oben/Unten | WertTyp | Grenzwert | Grenzgröße | Datei | '*|---------------|----------|-------|-----------|------------|----------|-----------|------------|----------------| Dim i As Integer @@ -799,10 +756,10 @@ Public Class Problem Dim Datei As String = IO.Path.Combine(Me.mWorkDir, Me.Datensatz & "." & FILEEXT_CON) - If (File.Exists(Datei)) Then + If (IO.File.Exists(Datei)) Then - Dim FiStr As FileStream = New FileStream(Datei, FileMode.Open, IO.FileAccess.Read) - Dim StrRead As StreamReader = New StreamReader(FiStr, System.Text.Encoding.GetEncoding("iso8859-1")) + Dim FiStr As New IO.FileStream(Datei, IO.FileMode.Open, IO.FileAccess.Read) + Dim StrRead As New IO.StreamReader(FiStr, Text.Encoding.GetEncoding("iso8859-1")) i = 0 Do @@ -818,7 +775,7 @@ Public Class Problem End If 'Neues Constraint anlegen ReDim Preserve Me.List_Constraintfunctions(i) - Me.List_Constraintfunctions(i) = New Common.Constraintfunction() + Me.List_Constraintfunctions(i) = New Constraintfunction() 'Werte zuweisen With Me.List_Constraintfunctions(i) .Bezeichnung = WerteArray(1).Trim() @@ -828,7 +785,7 @@ Public Class Problem .GrenzPos = WerteArray(5).Trim() .WertFunktion = WerteArray(6).Trim() If (WerteArray(7).Trim() <> "") Then - .GrenzWert = Convert.ToDouble(WerteArray(7).Trim(), Common.Provider.FortranProvider) + .GrenzWert = Convert.ToDouble(WerteArray(7).Trim(), Provider.FortranProvider) End If .GrenzGr = WerteArray(8).Trim() .GrenzReiheDatei = WerteArray(9).Trim() @@ -865,7 +822,7 @@ Public Class Problem .GrenzReihe = fileInstance.getTimeSeries(.GrenzGr) End If - 'Zeitraum der Grenzwertreihe überprüfen + 'Zeitraum der Grenzwertreihe überprüfen '-------------------------------------- GrenzStart = .GrenzReihe.StartDate GrenzEnde = .GrenzReihe.EndDate @@ -874,7 +831,7 @@ Public Class Problem 'Grenzwertreihe deckt Simulationszeitraum nicht ab Throw New Exception($"Constraints: The threshold series '{ .GrenzReiheDatei}' does not cover the simulation period!") Else - 'Zielreihe auf Simulationszeitraum kürzen + 'Zielreihe auf Simulationszeitraum kürzen Call .GrenzReihe.Cut(SimStart, SimEnde) If .GrenzReihe.Length = 0 Then Throw New Exception($"Constraints: The threshold series '{ .GrenzReiheDatei}' is empty after cutting to the simulation period!") @@ -901,7 +858,7 @@ Public Class Problem ''' - ''' Prüft ob Optparameter und Modellparameter zusammenpassen + ''' Prüft ob Optparameter und Modellparameter zusammenpassen ''' Private Sub Validate_OPT_fits_to_MOD() @@ -910,7 +867,7 @@ Public Class Problem Dim isValid_B As Boolean = True Dim isValid As Boolean = False - 'A: Prüfung ob für jeden OptParameter mindestens ein Modellparameter existiert + 'A: Prüfung ob für jeden OptParameter mindestens ein Modellparameter existiert For i = 0 To List_OptParameter.GetUpperBound(0) isValid = False For j = 0 To List_ModellParameter.GetUpperBound(0) @@ -923,7 +880,7 @@ Public Class Problem End If Next - 'B: Prüfung ob jeder ModellParameter einem richtigen OptParameter zugewiesen ist. + 'B: Prüfung ob jeder ModellParameter einem richtigen OptParameter zugewiesen ist. For i = 0 To List_ModellParameter.GetUpperBound(0) isValid = False For j = 0 To List_OptParameter.GetUpperBound(0) @@ -947,7 +904,7 @@ Public Class Problem End Sub ''' - ''' Prüft ob die Startwerte der OptParameter innerhalb der Min und Max Grenzen liegen + ''' Prüft ob die Startwerte der OptParameter innerhalb der Min und Max Grenzen liegen ''' Private Sub Validate_Startvalues() Dim i As Integer @@ -960,7 +917,7 @@ Public Class Problem End Sub '''' - '''' Validierungsfunktion der Ziele Datei (Objectives), prüft ob die Gruppenzuordnung passt + '''' Validierungsfunktion der Ziele Datei (Objectives), prüft ob die Gruppenzuordnung passt '''' 'Public Sub Validate_Objectives() @@ -992,8 +949,8 @@ Public Class Problem ''' ''' ''' Beta-Version - erlaubt Kalirbierung der Tagesganlinie - ''' dafür muss für den jeweiligen Tagesgangwert in der .mod Datei in der Spalte "Elem" "TGG_QH" eingetragen werden - ''' Vorschlag: Aktivierung der kalibrierung des Tagesganlinie über einen Schalter, damit diese Funktion nicht bei jeder optimierung aufgerufen wird + ''' dafür muss für den jeweiligen Tagesgangwert in der .mod Datei in der Spalte "Elem" "TGG_QH" eingetragen werden + ''' Vorschlag: Aktivierung der kalibrierung des Tagesganlinie über einen Schalter, damit diese Funktion nicht bei jeder optimierung aufgerufen wird ''' Kontakt: Valentin Gamerith ''' Private Sub VG_Kalibrierung_Tagesganglinie() @@ -1018,13 +975,13 @@ Public Class Problem Next End If Next - 'Überprüft ob 24 Werte zugeordnet wurden + 'Überprüft ob 24 Werte zugeordnet wurden If VG_check_24 = 24 Then 'Faktor um auf 24 zu kommen:Xi = Xsim,i * n/Summe(Xi,Sim) VG_Faktor = VG_check_24 / VG_sum_TGG For i = 0 To List_ModellParameter.GetUpperBound(0) If Trim(List_ModellParameter(i).Element) = "TGG_QH" Then - List_ModellParameter(i).Faktor = VG_Faktor 'setzt den Faktor für den jeweiligen Tagesgangwert + List_ModellParameter(i).Faktor = VG_Faktor 'setzt den Faktor für den jeweiligen Tagesgangwert End If Next Else @@ -1032,17 +989,17 @@ Public Class Problem End Sub ''' - ''' Gibt ein neues Individuum zurück, dessen Optparameter alle auf die Startwerte gesetzt sind + ''' Gibt ein neues Individuum zurück, dessen Optparameter alle auf die Startwerte gesetzt sind ''' ''' - ''' Das Individuum erhält die ID 1 - Public Function getIndividuumStart() As BlueM.Opt.Common.Individuum + ''' Das Individuum erhält die ID 1 + Public Function getIndividuumStart() As Individuum - Dim startind As BlueM.Opt.Common.Individuum + Dim startind As Individuum Dim i As Integer - startind = New BlueM.Opt.Common.Individuum_PES("start", 1) + startind = New Individuum_PES("start", 1) 'Startwerte der OptParameter setzen For i = 0 To Me.NumOptParams - 1 startind.OptParameter(i).RWert = Me.List_OptParameter(i).StartWert diff --git a/BlueM.Opt/Common/Provider.vb b/BlueM.Opt/Common/Provider.vb index b75f7ab1..30c6c6bc 100644 --- a/BlueM.Opt/Common/Provider.vb +++ b/BlueM.Opt/Common/Provider.vb @@ -15,19 +15,18 @@ 'You should have received a copy of the GNU General Public License 'along with this program. If not, see . ' -Imports System.Globalization Public Module Provider - Public ReadOnly Property FortranProvider() As NumberFormatInfo + Public ReadOnly Property FortranProvider() As Globalization.NumberFormatInfo Get 'Fortran Provider einrichten '--------------------------- - Dim provider As New NumberFormatInfo() - - provider.NumberDecimalSeparator = "." - provider.NumberGroupSeparator = "" - provider.NumberGroupSizes = New Integer() {3} + Dim provider As New Globalization.NumberFormatInfo With { + .NumberDecimalSeparator = ".", + .NumberGroupSeparator = "", + .NumberGroupSizes = New Integer() {3} + } Return provider End Get diff --git a/BlueM.Opt/Common/Settings/Settings.vb b/BlueM.Opt/Common/Settings/Settings.vb index e308fd8b..4f04cd20 100644 --- a/BlueM.Opt/Common/Settings/Settings.vb +++ b/BlueM.Opt/Common/Settings/Settings.vb @@ -22,7 +22,7 @@ Imports System.Xml.Serialization ''' Public Class Settings - 'Klasse für generelle Settings + 'Klasse für generelle Settings '----------------------------- Public Class Settings_General Private mUseMultithreading As Boolean @@ -115,7 +115,7 @@ Public Class Settings Dim writer As IO.StreamWriter Dim serializer As XmlSerializer - 'Streamwriter öffnen + 'Streamwriter öffnen writer = New IO.StreamWriter(path) serializer = New XmlSerializer(GetType(Settings), New XmlRootAttribute("Settings")) @@ -132,18 +132,18 @@ Public Class Settings ''' Public Shared Function Load(path As String) As Settings - Dim serializer As New XmlSerializer(GetType(Common.Settings)) + Dim serializer As New XmlSerializer(GetType(Settings)) Dim settings As Settings AddHandler serializer.UnknownElement, AddressOf serializerUnknownElement AddHandler serializer.UnknownAttribute, AddressOf serializerUnknownAttribute - 'Filestream öffnen + 'Filestream öffnen Dim fs As New IO.FileStream(path, IO.FileMode.Open) 'Deserialisieren 'TODO: XmlDeserializationEvents ms-help://MS.VSCC.v90/MS.MSDNQTR.v90.en/fxref_system.xml/html/e0657840-5678-bf57-6e7a-1bd93b2b27d1.htm - settings = CType(serializer.Deserialize(fs), Common.Settings) + settings = CType(serializer.Deserialize(fs), Settings) fs.Close() diff --git a/BlueM.Opt/Diagramm/CustomPlot.vb b/BlueM.Opt/Diagramm/CustomPlot.vb index 844beb6f..814e5ffe 100644 --- a/BlueM.Opt/Diagramm/CustomPlot.vb +++ b/BlueM.Opt/Diagramm/CustomPlot.vb @@ -15,6 +15,7 @@ 'You should have received a copy of the GNU General Public License 'along with this program. If not, see . ' +Imports BlueM.Opt.Common ''' ''' Form for displaying a custom plot ''' @@ -22,7 +23,7 @@ Public Class CustomPlot Private _isInitializing As Boolean - Private _problem As Common.Problem + Private _problem As Problem Private _optresult As OptResult.OptResult Private _series_StartValue As Steema.TeeChart.Styles.Points @@ -34,7 +35,7 @@ Public Class CustomPlot ''' Is raised when a solution is selected ''' ''' the selected individual - Public Event pointSelected(ByVal ind As Common.Individuum) + Public Event pointSelected(ByVal ind As Individuum) ''' ''' Index of the currently set optimization parameter @@ -61,7 +62,7 @@ Public Class CustomPlot ''' ''' the optimization problem definition ''' the optresult data to plot - Public Sub New(problem As Common.Problem, optresult As OptResult.OptResult) + Public Sub New(problem As Problem, optresult As OptResult.OptResult) ' This call is required by the designer. InitializeComponent() @@ -75,13 +76,13 @@ Public Class CustomPlot ' populate combo boxes Me.ComboBox_OptParameters.Items.Clear() - For Each param As Common.OptParameter In Me._problem.List_OptParameter + For Each param As OptParameter In Me._problem.List_OptParameter Me.ComboBox_OptParameters.Items.Add(param) Next Me.ComboBox_OptParameters.SelectedIndex = 0 Me.ComboBox_ObjectiveFunctions.Items.Clear() - For Each objective As Common.ObjectiveFunction In Me._problem.List_ObjectiveFunctions + For Each objective As ObjectiveFunction In Me._problem.List_ObjectiveFunctions Me.ComboBox_ObjectiveFunctions.Items.Add(objective) Next Me.ComboBox_ObjectiveFunctions.SelectedIndex = 0 @@ -98,7 +99,7 @@ Public Class CustomPlot 'instantiate series Me._series_Population = Me.Diag.getSeriesPoint("Population", "Orange") - If Me._problem.Method <> Common.METH_SENSIPLOT Then + If Me._problem.Method <> Constants.METH_SENSIPLOT Then Me._series_StartValue = Me.Diag.getSeriesPoint("Start value", "Yellow", Steema.TeeChart.Styles.PointerStyles.Circle, 4) Me._series_SekPop = Me.Diag.getSeriesPoint("Secondary population", "Green") End If @@ -127,8 +128,8 @@ Public Class CustomPlot Private Sub UpdateChart() 'get selection from comboboxes - Dim param As Common.OptParameter = Me.ComboBox_OptParameters.SelectedItem - Dim objective As Common.ObjectiveFunction = Me.ComboBox_ObjectiveFunctions.SelectedItem + Dim param As OptParameter = Me.ComboBox_OptParameters.SelectedItem + Dim objective As ObjectiveFunction = Me.ComboBox_ObjectiveFunctions.SelectedItem 'set chart title Me.Diag.Chart.Header.Text = $"{param.Bezeichnung} vs. {objective.Description}" @@ -164,9 +165,9 @@ Public Class CustomPlot ''' Private Sub UpdatePlot() - Dim ind As Common.Individuum + Dim ind As Individuum - If Me._problem.Method <> Common.METH_SENSIPLOT Then + If Me._problem.Method <> Constants.METH_SENSIPLOT Then 'plot start value _series_StartValue.Clear() ind = _optresult.getSolution(1) @@ -179,7 +180,7 @@ Public Class CustomPlot _series_Population.Add(ind.OptParameter(iParameter).RWert, ind.Objectives(iObjective) * _problem.List_ObjectiveFunctions(iObjective).Direction, ind.ID.ToString) Next - If Me._problem.Method <> Common.METH_SENSIPLOT Then + If Me._problem.Method <> Constants.METH_SENSIPLOT Then 'plot secondary population _series_SekPop.Clear() For Each ind In Me._optresult.getSekPop @@ -206,7 +207,7 @@ Public Class CustomPlot ''' Shows a selected solution in the plot ''' ''' the selected individual - Public Sub showSelectedSolution(ind As Common.Individuum) + Public Sub showSelectedSolution(ind As Individuum) Me._series_Selected.Add(ind.OptParameter(iParameter).RWert, ind.Objectives(iObjective) * _problem.List_ObjectiveFunctions(iObjective).Direction, ind.ID.ToString) End Sub @@ -217,7 +218,7 @@ Public Class CustomPlot Private Sub seriesClick(ByVal sender As Object, ByVal s As Steema.TeeChart.Styles.Series, ByVal valueIndex As Integer, ByVal e As System.Windows.Forms.MouseEventArgs) Dim indID_clicked As Integer - Dim ind As Common.Individuum + Dim ind As Individuum Try 'get solution ID from series label @@ -230,8 +231,8 @@ Public Class CustomPlot RaiseEvent pointSelected(ind) Catch ex As Exception - Common.Log.AddMessage(Common.Log.levels.error, ex.Message) - MsgBox($"Solution is not selectable!{Common.Constants.eol}{ex.Message}", MsgBoxStyle.Information) + Log.AddMessage(Log.levels.error, ex.Message) + MsgBox($"Solution is not selectable!{Constants.eol}{ex.Message}", MsgBoxStyle.Information) End Try End Sub diff --git a/BlueM.Opt/Diagramm/Diagramm.vb b/BlueM.Opt/Diagramm/Diagramm.vb index db2d984c..f8b401ec 100644 --- a/BlueM.Opt/Diagramm/Diagramm.vb +++ b/BlueM.Opt/Diagramm/Diagramm.vb @@ -16,9 +16,10 @@ 'along with this program. If not, see . ' Imports System.Drawing +Imports BlueM.Opt.Common ''' -''' Klasse stellt Diagrammfunktionalitäten zur Verfügung +''' Klasse stellt Diagrammfunktionalitäten zur Verfügung ''' ''' Erweiterung der Klasse Steema.TeeChart.TChart Public Class Diagramm @@ -46,7 +47,7 @@ Public Class Diagramm Me.Chart.Axes.Bottom.Grid.Visible = True End Sub - 'Diagramm zurücksetzen + 'Diagramm zurücksetzen '********************* Public Sub Reset() With Me @@ -63,7 +64,7 @@ Public Class Diagramm Try Call Steema.TeeChart.Editor.Show(Me) Catch ex As Exception - MsgBox("Fehler in TeeChart!" & BlueM.Opt.Common.eol & ex.Message, MsgBoxStyle.Critical) + MsgBox("Fehler in TeeChart!" & Constants.eol & ex.Message, MsgBoxStyle.Critical) End Try End Sub @@ -72,7 +73,7 @@ Public Class Diagramm #Region "Serienverwaltung" 'Serien-Initialisierung (Punkt) - 'gibt die Serie zurück + 'gibt die Serie zurück '****************************** Public Function getSeriesPoint(ByVal title As String, _ Optional ByVal colorName As String = "", _ @@ -84,7 +85,7 @@ Public Class Diagramm Dim baseColor, borderColor As Color Dim serie As Steema.TeeChart.Styles.Points - 'Überprüfen, ob Serie bereits existiert + 'Überprüfen, ob Serie bereits existiert For i = 0 To Me.Chart.Series.Count - 1 If (Me.Chart.Series(i).Title = title) Then serie = Me.Chart.Series(i) @@ -92,13 +93,14 @@ Public Class Diagramm End If Next - 'Sonst Serie neu hinzufügen - serie = New Steema.TeeChart.Styles.Points(Me.Chart) - serie.Title = title + 'Sonst Serie neu hinzufügen + serie = New Steema.TeeChart.Styles.Points(Me.Chart) With { + .Title = title, + .ColorEach = ColEach + } serie.Pointer.Style = style serie.Pointer.HorizSize = size serie.Pointer.VertSize = size - serie.ColorEach = ColEach If (Not colorName = "") Then baseColor = Color.FromName(colorName) serie.Pointer.Color = baseColor @@ -106,7 +108,7 @@ Public Class Diagramm borderColor = getDarkerColor(baseColor) serie.Pointer.Pen.Color = borderColor End If - + Call Me.add_MarksTips(serie) serie.Cursor = Windows.Forms.Cursors.Hand @@ -115,7 +117,7 @@ Public Class Diagramm End Function 'Serien-Initialisierung (Linie) - 'gibt die Serie zurück + 'gibt die Serie zurück '****************************** Public Function getSeriesLine(ByVal title As String, _ Optional ByVal colorName As String = "") As Steema.TeeChart.Styles.Line @@ -123,7 +125,7 @@ Public Class Diagramm Dim i As Integer Dim serie As Steema.TeeChart.Styles.Line - 'Überprüfen, ob Serie bereits existiert + 'Überprüfen, ob Serie bereits existiert For i = 0 To Me.Chart.Series.Count - 1 If (Me.Chart.Series(i).Title = title) Then serie = Me.Chart.Series(i) @@ -131,11 +133,12 @@ Public Class Diagramm End If Next - 'Sonst Serie neu hinzufügen - serie = New Steema.TeeChart.Styles.Line(Me.Chart) - serie.Title = title + 'Sonst Serie neu hinzufügen + serie = New Steema.TeeChart.Styles.Line(Me.Chart) With { + .Title = title + } If (Not colorName = "") Then - serie.Color = Drawing.Color.FromName(colorName) + serie.Color = Color.FromName(colorName) End If Call Me.add_MarksTips(serie, Steema.TeeChart.Styles.MarksStyles.XY) @@ -145,7 +148,7 @@ Public Class Diagramm End Function 'Serien-Initialisierung (3DPunkt) - 'gibt die Serie zurück + 'gibt die Serie zurück '******************************** Public Function getSeries3DPoint(ByVal title As String, _ Optional ByVal colorName As String = "", _ @@ -155,9 +158,9 @@ Public Class Diagramm Dim i As Integer Dim baseColor, borderColor As Color - Dim serie As New Steema.TeeChart.Styles.Points3D + Dim serie As Steema.TeeChart.Styles.Points3D - 'Überprüfen, ob Serie bereits existiert + 'Überprüfen, ob Serie bereits existiert For i = 0 To Me.Chart.Series.Count - 1 If (Me.Chart.Series(i).Title = title) Then serie = Me.Chart.Series(i) @@ -165,18 +168,19 @@ Public Class Diagramm End If Next - 'Sonst Serie neu hinzufügen - serie = New Steema.TeeChart.Styles.Points3D(Me.Chart) - serie.Title = title + 'Sonst Serie neu hinzufügen + serie = New Steema.TeeChart.Styles.Points3D(Me.Chart) With { + .Title = title, + .Depth = size, + .ColorEach = ColEach + } serie.Pointer.Style = style serie.Pointer.HorizSize = size serie.Pointer.VertSize = size serie.Pointer.Draw3D = True - serie.Depth = size serie.LinePen.Visible = False - serie.ColorEach = ColEach If (Not colorName = "") Then - baseColor = Drawing.Color.FromName(colorName) + baseColor = Color.FromName(colorName) serie.Color = baseColor 'Border-Color etwas dunkler borderColor = getDarkerColor(baseColor) @@ -191,7 +195,7 @@ Public Class Diagramm End Function - 'Serien werden von Hinten gelöscht + 'Serien werden von Hinten gelöscht '********************************* Sub DeleteSeries(ByVal Max As Integer, ByVal Min As Integer) @@ -204,16 +208,17 @@ Public Class Diagramm End Sub - 'MarksTips zu einer Serie hinzufügen + 'MarksTips zu einer Serie hinzufügen '*********************************** Public Sub add_MarksTips(ByVal serie As Steema.TeeChart.Styles.Series, Optional ByVal style As Steema.TeeChart.Styles.MarksStyles = Steema.TeeChart.Styles.MarksStyles.Label) Dim myMarksTip As Steema.TeeChart.Tools.MarksTip - myMarksTip = New Steema.TeeChart.Tools.MarksTip(Me.Chart) - myMarksTip.Series = serie - myMarksTip.MouseAction = Steema.TeeChart.Tools.MarksTipMouseAction.Move - myMarksTip.MouseDelay = 10 'millisekunden - myMarksTip.Style = style + myMarksTip = New Steema.TeeChart.Tools.MarksTip(Me.Chart) With { + .Series = serie, + .MouseAction = Steema.TeeChart.Tools.MarksTipMouseAction.Move, + .MouseDelay = 10, 'millisekunden + .Style = style + } End Sub @@ -222,7 +227,7 @@ Public Class Diagramm #Region "Misc" ''' - ''' Erzeugt von einer übergebenen Farbe eine etwas dunklere Farbe + ''' Erzeugt von einer übergebenen Farbe eine etwas dunklere Farbe ''' ''' die Basisfarbe ''' eine etwas dunklere Farbe diff --git a/BlueM.Opt/Diagramm/Hauptdiagramm.vb b/BlueM.Opt/Diagramm/Hauptdiagramm.vb index 474e3a4f..c4b0640d 100644 --- a/BlueM.Opt/Diagramm/Hauptdiagramm.vb +++ b/BlueM.Opt/Diagramm/Hauptdiagramm.vb @@ -15,6 +15,9 @@ 'You should have received a copy of the GNU General Public License 'along with this program. If not, see . ' +Imports System.Drawing +Imports BlueM.Opt.Common + ''' ''' Diagramm zeigt Lösungen (Individuen) im Lösungsraum an ''' @@ -22,10 +25,10 @@ Public Class Hauptdiagramm Inherits Diagramm 'lokale Referenz auf Settings - Private mSettings As BlueM.Opt.Common.Settings + Private mSettings As Settings 'Das Problem - Private mProblem As BlueM.Opt.Common.Problem + Private mProblem As Problem 'Zuordnung zwischen Zielfunktionen und Achsen Public ZielIndexX, ZielIndexY, ZielIndexZ As Integer @@ -35,7 +38,7 @@ Public Class Hauptdiagramm 'Diagramm Initialisierung (Titel und Achsen) '******************************************* - Public Sub DiagInitialise(ByVal Titel As String, ByVal Achsen As Collection, ByRef prob As BlueM.Opt.Common.Problem) + Public Sub DiagInitialise(ByVal Titel As String, ByVal Achsen As Collection, ByRef prob As Problem) Dim xachse, yachse, zachse As Diagramm.Achse @@ -108,13 +111,14 @@ Public Class Hauptdiagramm .Chart.Aspect.Orthogonal = False .Chart.Aspect.Perspective = 62 .Chart.Aspect.Rotation = 329 - .Chart.Aspect.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality + .Chart.Aspect.SmoothingMode = Drawing2D.SmoothingMode.HighQuality .Chart.Aspect.VertOffset = -20 .Chart.Aspect.Zoom = 66 'Rotate Tool - Dim rotate As New Steema.TeeChart.Tools.Rotate(.Chart) - rotate.Button = Windows.Forms.MouseButtons.Right + Dim rotate As New Steema.TeeChart.Tools.Rotate(.Chart) With { + .Button = Windows.Forms.MouseButtons.Right + } End If @@ -126,7 +130,7 @@ Public Class Hauptdiagramm ''' Settings setzen ''' ''' Settings - Public Sub setSettings(ByRef settings As BlueM.Opt.Common.Settings) + Public Sub setSettings(ByRef settings As Settings) 'Settings übergeben Me.mSettings = settings @@ -138,14 +142,14 @@ Public Class Hauptdiagramm 'Lösung zeichnen '*************** - Public Sub ZeichneIndividuum(ByVal ind As Common.Individuum, ByVal runde As Integer, ByVal pop As Integer, ByVal gen As Integer, ByVal nachf As Integer, _ - ByVal Farbe As System.Drawing.Color, Optional ByVal ColEach As Boolean = False) + Public Sub ZeichneIndividuum(ByVal ind As Individuum, ByVal runde As Integer, ByVal pop As Integer, ByVal gen As Integer, ByVal nachf As Integer, + ByVal Farbe As Color, Optional ByVal ColEach As Boolean = False) Dim serie As Steema.TeeChart.Styles.Series 'Ungültige Individuen immer Grau anzeigen! If (Not ind.Is_Feasible) Then - Farbe = System.Drawing.Color.Gray + Farbe = Color.Gray End If If (Me.mProblem.NumPrimObjective = 1) Then @@ -157,7 +161,7 @@ Public Class Hauptdiagramm serie = Me.getSeriesPoint($"Population {pop + 1}", , , , ColEach) End If Select Case Me.mProblem.Method - Case BlueM.Opt.Common.METH_PES + Case METH_PES Call serie.Add(runde * Me.mSettings.PES.N_Gen * Me.mSettings.PES.N_Nachf + gen * Me.mSettings.PES.N_Nachf + nachf, ind.PrimObjectives(0) * Me.mProblem.List_PrimObjectiveFunctions(0).Direction, ind.ID.ToString(), Farbe) Case Else Throw New Exception("Drawing function not defined for this single objective method!") @@ -193,7 +197,7 @@ Public Class Hauptdiagramm ''' Start-Individuum zeichnen ''' ''' das Individuum, das mit den Startwerten evaluiert wurde - Public Sub ZeichneStartWert(ByVal ind As Common.Individuum) + Public Sub ZeichneStartWert(ByVal ind As Individuum) Dim farbe As String Dim serie As Steema.TeeChart.Styles.Series @@ -232,7 +236,7 @@ Public Class Hauptdiagramm 'Population zeichnen '******************* - Public Sub ZeichneSekPopulation(ByVal pop() As Common.Individuum) + Public Sub ZeichneSekPopulation(ByVal pop() As Individuum) Dim i As Integer Dim serie, serie_inv As Steema.TeeChart.Styles.Series @@ -240,7 +244,7 @@ Public Class Hauptdiagramm Dim values(,) As Double 'Population in Array von Penalties transformieren - values = Common.Individuum.Get_All_Penalty_of_Array(pop) + values = Individuum.Get_All_Penalty_of_Array(pop) If (Me.mProblem.NumPrimObjective = 2) Then '2 Zielfunktionen @@ -327,7 +331,7 @@ Public Class Hauptdiagramm If (Me.ZielIndexX <> -1) Then If (Me.mProblem.List_ObjectiveFunctions(Me.ZielIndexX).hasCurrentValue) Then colorline1 = New Steema.TeeChart.Tools.ColorLine(Me.Chart) - colorline1.Pen.Color = System.Drawing.Color.Red + colorline1.Pen.Color = Color.Red colorline1.AllowDrag = False colorline1.Draw3D = True colorline1.Axis = Me.Axes.Bottom @@ -339,7 +343,7 @@ Public Class Hauptdiagramm If (Me.ZielIndexY <> -1) Then If (Me.mProblem.List_ObjectiveFunctions(Me.ZielIndexY).hasCurrentValue) Then colorline1 = New Steema.TeeChart.Tools.ColorLine(Me.Chart) - colorline1.Pen.Color = System.Drawing.Color.Red + colorline1.Pen.Color = Color.Red colorline1.AllowDrag = False colorline1.Draw3D = True colorline1.Axis = Me.Axes.Left @@ -353,7 +357,7 @@ Public Class Hauptdiagramm 'TODO: ColorLine auf Depth-Axis geht nicht! (#203) MsgBox($"The current value on the Z-axis ({Me.mProblem.List_ObjectiveFunctions(Me.ZielIndexZ).Description}) can not be displayed (see #203)", MsgBoxStyle.Information) 'colorline1 = New Steema.TeeChart.Tools.ColorLine(Me.Chart) - 'colorline1.Pen.Color = System.Drawing.Color.Red + 'colorline1.Pen.Color = Color.Red 'colorline1.AllowDrag = False 'colorline1.Draw3D = True 'colorline1.Axis = Me.Axes.Depth @@ -371,7 +375,7 @@ Public Class Hauptdiagramm ''' Draw a selected solution in the diagram ''' ''' the solution to draw - Public Sub DrawSelectedSolution(ind As Common.Individuum) + Public Sub DrawSelectedSolution(ind As Individuum) Dim x, y, z As Double @@ -383,12 +387,12 @@ Public Class Hauptdiagramm serie.Marks.Style = Steema.TeeChart.Styles.MarksStyles.Label serie.Marks.Transparency = 50 serie.Marks.ArrowLength = 10 - If Me.mProblem.Method = Common.METH_SENSIPLOT Then + If Me.mProblem.Method = Constants.METH_SENSIPLOT Then 'x axis is optparameter, y axis is objective function x = ind.OptParameter(Me.mSettings.SensiPlot.Selected_OptParameters(0)).RWert y = ind.Objectives(Me.mSettings.SensiPlot.Selected_Objective) * Me.mProblem.List_ObjectiveFunctions(Me.mSettings.SensiPlot.Selected_Objective).Direction Else - If Me.mProblem.Modus = Common.Constants.EVO_MODE.Single_Objective Then + If Me.mProblem.Modus = Constants.EVO_MODE.Single_Objective Then 'x axis is simulation ID (single objective) x = ind.ID y = ind.Objectives(Me.ZielIndexY) * Me.mProblem.List_ObjectiveFunctions(Me.ZielIndexY).Direction @@ -407,7 +411,7 @@ Public Class Hauptdiagramm serie3D.Marks.Style = Steema.TeeChart.Styles.MarksStyles.Label serie3D.Marks.Transparency = 50 serie3D.Marks.ArrowLength = 10 - If Me.mProblem.Method = Common.METH_SENSIPLOT Then + If Me.mProblem.Method = Constants.METH_SENSIPLOT Then 'x and z axis are optparameters, y axis is objective function x = ind.OptParameter(Me.mSettings.SensiPlot.Selected_OptParameters(0)).RWert z = ind.OptParameter(Me.mSettings.SensiPlot.Selected_OptParameters(1)).RWert diff --git a/BlueM.Opt/Diagramm/Monitor.vb b/BlueM.Opt/Diagramm/Monitor.vb index 3c25c8bc..1803aee5 100644 --- a/BlueM.Opt/Diagramm/Monitor.vb +++ b/BlueM.Opt/Diagramm/Monitor.vb @@ -15,7 +15,8 @@ 'You should have received a copy of the GNU General Public License 'along with this program. If not, see . ' -Imports System.IO +Imports System.Drawing +Imports System.Windows.Forms ''' ''' Der Monitor stellt ein Diagramm und ein Textfeld (Log) zur Verfügung @@ -73,7 +74,7 @@ Partial Public Class Monitor ''' der Text Public Sub LogAppend(ByVal text As String) Call Me.LogAppendText(text) - System.Windows.Forms.Application.DoEvents() + Application.DoEvents() End Sub ''' @@ -122,14 +123,14 @@ Partial Public Class Monitor .Chart.Axes.Right.Ticks.Color = Drawing.Color.Black .Chart.Axes.Left.Ticks.Width = 1 .Chart.Axes.Right.Ticks.Width = 1 - .BackColor = System.Drawing.Color.Transparent - .Cursor = System.Windows.Forms.Cursors.Default + .BackColor = Color.Transparent + .Cursor = Cursors.Default .Header.Visible = False '.Legend.Visible = False .Legend.Alignment = Steema.TeeChart.LegendAlignments.Bottom .Legend.LegendStyle = Steema.TeeChart.LegendStyles.Series .Location = New System.Drawing.Point(0, 0) - .Panel.Brush.Color = System.Drawing.Color.Transparent + .Panel.Brush.Color = Color.Transparent .Panel.Color = Drawing.Color.White .Panel.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None .Panel.Bevel.Inner = Steema.TeeChart.Drawing.BevelStyles.None diff --git a/BlueM.Opt/Diagramm/Scatterplot.vb b/BlueM.Opt/Diagramm/Scatterplot.vb index 44cb4a7e..30ca4aee 100644 --- a/BlueM.Opt/Diagramm/Scatterplot.vb +++ b/BlueM.Opt/Diagramm/Scatterplot.vb @@ -17,23 +17,24 @@ ' Imports System.Windows.Forms Imports System.Drawing +Imports BlueM.Opt.Common ''' -''' Zeigt den Lösungs- oder Entscheidungsraum in Form einer Scatterplot-Matrix an +''' Zeigt den Lösungs- oder Entscheidungsraum in Form einer Scatterplot-Matrix an ''' Partial Public Class Scatterplot Inherits System.Windows.Forms.Form 'Das Problem - Private mProblem As BlueM.Opt.Common.Problem + Private mProblem As Problem - Private Diags(,) As BlueM.Opt.Diagramm.Diagramm + Private Diags(,) As Diagramm Private NearestPointTools(,) As Steema.TeeChart.Tools.NearestPoint Private dimension As Integer - Private OptResult, OptResultRef As BlueM.Opt.OptResult.OptResult + Private OptResult, OptResultRef As OptResult.OptResult Private selectedIndices() As Integer Private ShowSekPopOnly, ShowStartValue, ShowIstWerte, ShowRefResult As Boolean - Private ShownSpace As BlueM.Opt.Common.SPACE + Private ShownSpace As SPACE Private ReadOnly Property HighlightingIsActive As Boolean Get @@ -42,11 +43,11 @@ Partial Public Class Scatterplot End Property ''' - ''' Event wird ausgelöst, wenn in der Scatterplot-Matrix eine Lösung ausgewählt wird + ''' Event wird ausgelöst, wenn in der Scatterplot-Matrix eine Lösung ausgewählt wird ''' - ''' Das ausgewählte Individuum + ''' Das ausgewählte Individuum ''' wird von Form1.selectSolution() verarbeitet - Public Event pointSelected(ByVal ind As Common.Individuum) + Public Event pointSelected(ByVal ind As Individuum) ''' ''' Konstruktor @@ -54,30 +55,30 @@ Partial Public Class Scatterplot ''' Das Optimierungsproblem ''' Das Optimierungsergebnis ''' Ein Referenz-Optimierungsergebnis (darf Nothing sein) - Public Sub New(ByRef prob As BlueM.Opt.Common.Problem, ByVal optres As BlueM.Opt.OptResult.OptResult, ByVal optresref As BlueM.Opt.OptResult.OptResult) + Public Sub New(ByRef prob As Problem, ByVal optres As OptResult.OptResult, ByVal optresref As OptResult.OptResult) Dim Dialog As ScatterplotDialog Dim diagresult As DialogResult - ' Dieser Aufruf ist für den Windows Form-Designer erforderlich. + ' Dieser Aufruf ist für den Windows Form-Designer erforderlich. InitializeComponent() - ' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu. + ' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu. 'Problem speichern Me.mProblem = prob - 'Optimierungsergebnis übergeben + 'Optimierungsergebnis übergeben Me.OptResult = optres Me.OptResultRef = optresref 'Scatterplot-Dialog aufrufen Dim refResultExists As Boolean = Not IsNothing(Me.OptResultRef) - Dialog = New BlueM.Opt.Diagramm.ScatterplotDialog(Me.mProblem, refResultExists) + Dialog = New ScatterplotDialog(Me.mProblem, refResultExists) diagresult = Dialog.ShowDialog() If (diagresult = DialogResult.OK) Then - 'Einstellungen übernehmen + 'Einstellungen übernehmen Me.ShownSpace = Dialog.selectedSpace Me.selectedIndices = Dialog.selectedIndices Me.ShowSekPopOnly = Dialog.ShowSekPopOnly @@ -85,7 +86,7 @@ Partial Public Class Scatterplot Me.ShowStartValue = Dialog.ShowStartValue Me.ShowIstWerte = Dialog.ShowIstWerte - If (Me.ShowRefResult And Me.ShownSpace = Common.SPACE.DecisionSpace) Then + If (Me.ShowRefResult And Me.ShownSpace = Constants.SPACE.DecisionSpace) Then If (Not Me.OptResultRef.holdsOptparameters) Then MsgBox("The comparison result was loaded without optimization parameters and can therefore not be displayed in the decision space!", MsgBoxStyle.Information, "Scatterplot matrix") Me.ShowRefResult = False @@ -114,18 +115,18 @@ Partial Public Class Scatterplot 'Diagramme zeichnen Select Case Me.ShownSpace - Case Common.SPACE.SolutionSpace + Case Constants.SPACE.SolutionSpace Me.Text &= " - Solution space" Call Me.draw_solutionspace() - Case Common.SPACE.DecisionSpace + Case Constants.SPACE.DecisionSpace Me.Text &= " - Decision space" Call Me.draw_decisionspace() End Select - 'Bereits ausgewählte Lösungen anzeigen - For Each ind As Common.Individuum In Me.OptResult.getSelectedSolutions + 'Bereits ausgewählte Lösungen anzeigen + For Each ind As Individuum In Me.OptResult.getSelectedSolutions Call Me.showSelectedSolution(ind) Next @@ -134,7 +135,7 @@ Partial Public Class Scatterplot End Sub - 'Lösungsraum zeichnen + 'Lösungsraum zeichnen '******************** Private Sub draw_solutionspace() @@ -142,11 +143,11 @@ Partial Public Class Scatterplot Dim xAchse, yAchse As String Dim min() As Double Dim max() As Double - Dim ind As BlueM.Opt.Common.Individuum + Dim ind As Individuum Dim serie, serie_inv As Steema.TeeChart.Styles.Series Dim shape1 As Steema.TeeChart.Styles.Shape - 'Min und Max für Achsen bestimmen + 'Min und Max für Achsen bestimmen '-------------------------------- ReDim min(Me.dimension - 1) ReDim max(Me.dimension - 1) @@ -154,13 +155,13 @@ Partial Public Class Scatterplot min(i) = Double.MaxValue max(i) = Double.MinValue If (Me.ShowSekPopOnly) Then - 'Nur Sekundäre Population + 'Nur Sekundäre Population For Each ind In Me.OptResult.getSekPop() min(i) = Math.Min(ind.Objectives(Me.selectedIndices(i)) * Me.mProblem.List_ObjectiveFunctions(Me.selectedIndices(i)).Direction, min(i)) max(i) = Math.Max(ind.Objectives(Me.selectedIndices(i)) * Me.mProblem.List_ObjectiveFunctions(Me.selectedIndices(i)).Direction, max(i)) Next Else - 'Alle Lösungen + 'Alle Lösungen For Each ind In Me.OptResult.Solutions min(i) = Math.Min(ind.Objectives(Me.selectedIndices(i)) * Me.mProblem.List_ObjectiveFunctions(Me.selectedIndices(i)).Direction, min(i)) max(i) = Math.Max(ind.Objectives(Me.selectedIndices(i)) * Me.mProblem.List_ObjectiveFunctions(Me.selectedIndices(i)).Direction, max(i)) @@ -192,15 +193,15 @@ Partial Public Class Scatterplot Next - 'Schleife über Spalten + 'Schleife über Spalten '--------------------- For i = 0 To Me.dimension - 1 - 'Schleife über Reihen + 'Schleife über Reihen '-------------------- For j = 0 To Me.dimension - 1 'Neues Diagramm erstellen - Me.Diags(i, j) = New BlueM.Opt.Diagramm.Diagramm() + Me.Diags(i, j) = New Diagramm() Me.matrix.Controls.Add(Me.Diags(i, j), i, j) With Me.Diags(i, j) @@ -247,11 +248,11 @@ Partial Public Class Scatterplot If (max(i) >= 1000 Or min(i) <= -1000) Then .Axes.Bottom.Labels.ValueFormat = "0.##E0" If (max(j) >= 1000 Or min(j) <= -1000) Then .Axes.Left.Labels.ValueFormat = "0.##E0" - 'Achsen nur an den Rändern anzeigen + 'Achsen nur an den Rändern anzeigen '---------------------------------- 'YAchsen If (i = 0) Then - 'Achse standardmäßig anzeigen + 'Achse standardmäßig anzeigen ElseIf (i = Me.dimension - 1) Then 'Achse rechts anzeigen .Axes.Left.OtherSide = True @@ -259,19 +260,19 @@ Partial Public Class Scatterplot 'Achse verstecken .Axes.Left.Title.Visible = False .Axes.Left.Labels.CustomSize = 1 - .Axes.Left.Labels.Font.Color = System.Drawing.Color.Empty + .Axes.Left.Labels.Font.Color = Color.Empty End If 'XAchsen If (j = 0) Then 'Achse oben anzeigen .Axes.Bottom.OtherSide = True ElseIf (j = Me.dimension - 1) Then - 'Achse standardmäßig anzeigen + 'Achse standardmäßig anzeigen Else 'Achse verstecken .Axes.Bottom.Title.Visible = False .Axes.Bottom.Labels.CustomSize = 1 - .Axes.Bottom.Labels.Font.Color = System.Drawing.Color.Empty + .Axes.Bottom.Labels.Font.Color = Color.Empty End If 'IstWerte eintragen @@ -281,20 +282,20 @@ Partial Public Class Scatterplot (Me.mProblem.List_ObjectiveFunctions(Me.selectedIndices(i)).hasCurrentValue Or Me.mProblem.List_ObjectiveFunctions(Me.selectedIndices(j)).hasCurrentValue)) Then - shape1 = New Steema.TeeChart.Styles.Shape(.Chart) - shape1.Style = Steema.TeeChart.Styles.ShapeStyles.Rectangle - shape1.Title = "Area of improvement" - 'Shape formatieren - shape1.Color = System.Drawing.Color.FromArgb(CType(CType(64, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(128, Byte), Integer)) 'Light Green, 75% transparent - shape1.Brush.Color = System.Drawing.Color.FromArgb(CType(CType(64, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(128, Byte), Integer)) 'Light Green, 75% transparent + shape1 = New Steema.TeeChart.Styles.Shape(.Chart) With { + .Style = Steema.TeeChart.Styles.ShapeStyles.Rectangle, + .Title = "Area of improvement", + .Color = Color.FromArgb(64, 128, 255, 128) 'Light Green, 75% transparent + } + shape1.Brush.Color = Color.FromArgb(64, 128, 255, 128) 'Light Green, 75% transparent shape1.Pen.Transparency = 0 shape1.Pen.Color = Color.Green shape1.Pen.Width = 1 'X-Werte If Me.mProblem.List_ObjectiveFunctions(Me.selectedIndices(i)).hasCurrentValue Then - If Me.mProblem.List_ObjectiveFunctions(Me.selectedIndices(i)).Direction = Common.EVO_DIRECTION.Minimization Then + If Me.mProblem.List_ObjectiveFunctions(Me.selectedIndices(i)).Direction = Constants.EVO_DIRECTION.Minimization Then shape1.X0 = min(i) * 0.9 ^ (min(i) / Math.Abs(min(i))) shape1.X1 = Me.mProblem.List_ObjectiveFunctions(Me.selectedIndices(i)).CurrentValue * Me.mProblem.List_ObjectiveFunctions(Me.selectedIndices(i)).Direction Else @@ -307,7 +308,7 @@ Partial Public Class Scatterplot End If 'Y-Werte If Me.mProblem.List_ObjectiveFunctions(Me.selectedIndices(j)).hasCurrentValue Then - If Me.mProblem.List_ObjectiveFunctions(Me.selectedIndices(j)).Direction = Common.EVO_DIRECTION.Minimization Then + If Me.mProblem.List_ObjectiveFunctions(Me.selectedIndices(j)).Direction = Constants.EVO_DIRECTION.Minimization Then shape1.Y0 = min(j) * 0.9 ^ (min(j) / Math.Abs(min(j))) shape1.Y1 = Me.mProblem.List_ObjectiveFunctions(Me.selectedIndices(j)).CurrentValue * Me.mProblem.List_ObjectiveFunctions(Me.selectedIndices(j)).Direction Else @@ -333,20 +334,20 @@ Partial Public Class Scatterplot 'add event handler AddHandler Me.NearestPointTools(i, j).Change, AddressOf Me.OnNearestPointChange - 'Lösungen eintragen + 'Lösungen eintragen '================== If Not Me.ShowSekPopOnly Then - 'Alle Lösungen + 'Alle Lösungen '------------- serie = .getSeriesPoint($"{xAchse}, {yAchse}", "Orange", Steema.TeeChart.Styles.PointerStyles.Circle, 2) serie_inv = .getSeriesPoint($"{xAchse}, {yAchse} (invalid)", "Gray", Steema.TeeChart.Styles.PointerStyles.Circle, 2) For Each ind In Me.OptResult.Solutions - 'Constraintverletzung prüfen + 'Constraintverletzung prüfen If (ind.Is_Feasible) Then - 'gültige Lösung Zeichnen + 'gültige Lösung Zeichnen serie.Add(ind.Objectives(Me.selectedIndices(i)) * Me.mProblem.List_ObjectiveFunctions(Me.selectedIndices(i)).Direction, ind.Objectives(Me.selectedIndices(j)) * Me.mProblem.List_ObjectiveFunctions(Me.selectedIndices(j)).Direction, ind.ID.ToString()) Else - 'ungültige Lösung zeichnen + 'ungültige Lösung zeichnen serie_inv.Add(ind.Objectives(Me.selectedIndices(i)) * Me.mProblem.List_ObjectiveFunctions(Me.selectedIndices(i)).Direction, ind.Objectives(Me.selectedIndices(j)) * Me.mProblem.List_ObjectiveFunctions(Me.selectedIndices(j)).Direction, ind.ID.ToString()) End If Next @@ -354,7 +355,7 @@ Partial Public Class Scatterplot Me.NearestPointTools(i, j).Series = serie End If - 'Sekundäre Population + 'Sekundäre Population '-------------------- serie = .getSeriesPoint($"{xAchse}, {yAchse} (sec pop)", "Green", Steema.TeeChart.Styles.PointerStyles.Circle, 2) For Each ind In Me.OptResult.getSekPop() @@ -484,7 +485,7 @@ Partial Public Class Scatterplot Dim max() As Double Dim serie, serie_inv As Steema.TeeChart.Styles.Series - 'Min und Max für Achsen bestimmen + 'Min und Max für Achsen bestimmen '-------------------------------- ReDim min(Me.dimension - 1) ReDim max(Me.dimension - 1) @@ -493,15 +494,15 @@ Partial Public Class Scatterplot max(i) = Me.mProblem.List_OptParameter(Me.selectedIndices(i)).Max Next - 'Schleife über Spalten + 'Schleife über Spalten '--------------------- For i = 0 To Me.dimension - 1 - 'Schleife über Reihen + 'Schleife über Reihen '-------------------- For j = 0 To Me.dimension - 1 'Neues Diagramm erstellen - Me.Diags(i, j) = New BlueM.Opt.Diagramm.Diagramm() + Me.Diags(i, j) = New Diagramm() Me.matrix.Controls.Add(Me.Diags(i, j), i, j) With Me.Diags(i, j) @@ -548,11 +549,11 @@ Partial Public Class Scatterplot 'If (max(i) >= 1000 Or min(i) <= -1000) Then .Axes.Bottom.Labels.ValueFormat = "0.##E0" 'If (max(j) >= 1000 Or min(j) <= -1000) Then .Axes.Left.Labels.ValueFormat = "0.##E0" - 'Achsen nur an den Rändern anzeigen + 'Achsen nur an den Rändern anzeigen '---------------------------------- 'YAchsen If (i = 0) Then - 'Achse standardmäßig anzeigen + 'Achse standardmäßig anzeigen ElseIf (i = Me.dimension - 1) Then 'Achse rechts anzeigen .Axes.Left.OtherSide = True @@ -560,19 +561,19 @@ Partial Public Class Scatterplot 'Achse verstecken .Axes.Left.Title.Visible = False .Axes.Left.Labels.CustomSize = 1 - .Axes.Left.Labels.Font.Color = System.Drawing.Color.Empty + .Axes.Left.Labels.Font.Color = Color.Empty End If 'XAchsen If (j = 0) Then 'Achse oben anzeigen .Axes.Bottom.OtherSide = True ElseIf (j = dimension - 1) Then - 'Achse standardmäßig anzeigen + 'Achse standardmäßig anzeigen Else 'Achse verstecken .Axes.Bottom.Title.Visible = False .Axes.Bottom.Labels.CustomSize = 1 - .Axes.Bottom.Labels.Font.Color = System.Drawing.Color.Empty + .Axes.Bottom.Labels.Font.Color = Color.Empty End If 'setup NearestPoint tool @@ -589,17 +590,17 @@ Partial Public Class Scatterplot 'Punkte eintragen '================ If Not Me.ShowSekPopOnly Then - 'Alle Lösungen + 'Alle Lösungen '------------- serie = .getSeriesPoint($"{xAchse}, {yAchse}", "Orange", Steema.TeeChart.Styles.PointerStyles.Circle, 2) serie_inv = .getSeriesPoint($"{xAchse}, {yAchse} (invalid)", "Gray", Steema.TeeChart.Styles.PointerStyles.Circle, 2) - For Each ind As Common.Individuum In Me.OptResult.Solutions - 'Constraintverletzung prüfen + For Each ind As Individuum In Me.OptResult.Solutions + 'Constraintverletzung prüfen If (ind.Is_Feasible) Then - 'gültige Lösung Zeichnen + 'gültige Lösung Zeichnen serie.Add(ind.OptParameter_RWerte(Me.selectedIndices(i)), ind.OptParameter_RWerte(Me.selectedIndices(j)), ind.ID.ToString()) Else - 'ungültige Lösung zeichnen + 'ungültige Lösung zeichnen serie_inv.Add(ind.OptParameter_RWerte(Me.selectedIndices(i)), ind.OptParameter_RWerte(Me.selectedIndices(j)), ind.ID.ToString()) End If Next @@ -607,10 +608,10 @@ Partial Public Class Scatterplot Me.NearestPointTools(i, j).Series = serie End If - 'Sekundäre Population + 'Sekundäre Population '-------------------- serie = .getSeriesPoint($"{xAchse}, {yAchse} (sec pop)", "Green", Steema.TeeChart.Styles.PointerStyles.Circle, 2) - For Each ind As Common.Individuum In Me.OptResult.getSekPop() + For Each ind As Individuum In Me.OptResult.getSekPop() serie.Add(ind.OptParameter_RWerte(Me.selectedIndices(i)), ind.OptParameter_RWerte(Me.selectedIndices(j)), ind.ID.ToString()) Next If Me.ShowSekPopOnly Then @@ -622,7 +623,7 @@ Partial Public Class Scatterplot '=========================== If (Me.ShowRefResult) Then serie = .getSeriesPoint($"{xAchse}, {yAchse} (comparison result)", "Blue", Steema.TeeChart.Styles.PointerStyles.Circle, 2) - For Each ind As Common.Individuum In Me.OptResultRef.getSekPop() + For Each ind As Individuum In Me.OptResultRef.getSekPop() serie.Add(ind.OptParameter_RWerte(Me.selectedIndices(i)), ind.OptParameter_RWerte(Me.selectedIndices(j)), ind.ID & " (comparison result)") Next End If @@ -718,12 +719,12 @@ Partial Public Class Scatterplot End If End Sub - 'Einen Punkt auswählen + 'Einen Punkt auswählen '********************* Private Sub seriesClick(ByVal sender As Object, ByVal s As Steema.TeeChart.Styles.Series, ByVal valueIndex As Integer, ByVal e As System.Windows.Forms.MouseEventArgs) Dim indID_clicked As Integer - Dim ind As Common.Individuum + Dim ind As Individuum 'Punkt-Informationen bestimmen '----------------------------- @@ -731,20 +732,20 @@ Partial Public Class Scatterplot 'Solution-ID indID_clicked = s.Labels(valueIndex) - 'Lösung holen + 'Lösung holen '------------ ind = Me.OptResult.getSolution(indID_clicked) If (ind.ID = indID_clicked) Then - 'Lösung auswählen (wird von Form1.selectSolution() verarbeitet) + 'Lösung auswählen (wird von Form1.selectSolution() verarbeitet) RaiseEvent pointSelected(ind) End If Catch ex As Exception - Common.Log.AddMessage(Common.Log.levels.error, ex.Message) - MsgBox($"Solution is not selectable!{Common.Constants.eol}{ex.Message}", MsgBoxStyle.Information) + Log.AddMessage(Log.levels.error, ex.Message) + MsgBox($"Solution is not selectable!{Constants.eol}{ex.Message}", MsgBoxStyle.Information) End Try End Sub @@ -754,7 +755,7 @@ Partial Public Class Scatterplot ''' ''' the solution to highlight ''' - Private Sub showHighlightedSolution(ByVal ind As Common.Individuum) + Private Sub showHighlightedSolution(ByVal ind As Individuum) Dim serie As Steema.TeeChart.Styles.Points Dim i, j As Integer @@ -777,9 +778,9 @@ Partial Public Class Scatterplot 'plot the point Select Case Me.ShownSpace - Case Common.SPACE.SolutionSpace + Case Constants.SPACE.SolutionSpace serie.Add(ind.Objectives(Me.selectedIndices(i)) * Me.mProblem.List_ObjectiveFunctions(Me.selectedIndices(i)).Direction, ind.Objectives(Me.selectedIndices(j)) * Me.mProblem.List_ObjectiveFunctions(Me.selectedIndices(j)).Direction, ind.ID.ToString()) - Case Common.SPACE.DecisionSpace + Case Constants.SPACE.DecisionSpace serie.Add(ind.OptParameter_RWerte(Me.selectedIndices(i)), ind.OptParameter_RWerte(Me.selectedIndices(j)), ind.ID.ToString()) End Select Next j @@ -788,16 +789,16 @@ Partial Public Class Scatterplot End Sub ''' - ''' Eine ausgewählte Lösung in den Diagrammen anzeigen + ''' Eine ausgewählte Lösung in den Diagrammen anzeigen ''' - ''' das ausgewählte Individuum + ''' das ausgewählte Individuum ''' wird von Form1.selectSolution() aufgerufen - Public Sub showSelectedSolution(ByVal ind As Common.Individuum) + Public Sub showSelectedSolution(ByVal ind As Individuum) Dim serie As Steema.TeeChart.Styles.Series Dim i, j As Integer - 'Lösung in alle Diagramme eintragen + 'Lösung in alle Diagramme eintragen '---------------------------------- For i = 0 To dimension - 1 For j = 0 To dimension - 1 @@ -813,9 +814,9 @@ Partial Public Class Scatterplot serie = .getSeriesPoint("Selected solutions", "Red", Steema.TeeChart.Styles.PointerStyles.Circle, 3) Select Case Me.ShownSpace - Case Common.SPACE.SolutionSpace + Case Constants.SPACE.SolutionSpace serie.Add(ind.Objectives(Me.selectedIndices(i)) * Me.mProblem.List_ObjectiveFunctions(Me.selectedIndices(i)).Direction, ind.Objectives(Me.selectedIndices(j)) * Me.mProblem.List_ObjectiveFunctions(Me.selectedIndices(j)).Direction, ind.ID.ToString()) - Case Common.SPACE.DecisionSpace + Case Constants.SPACE.DecisionSpace serie.Add(ind.OptParameter_RWerte(Me.selectedIndices(i)), ind.OptParameter_RWerte(Me.selectedIndices(j)), ind.ID.ToString()) End Select @@ -833,7 +834,7 @@ Partial Public Class Scatterplot End Sub ''' - ''' Serie der ausgewählten Lösungen löschen + ''' Serie der ausgewählten Lösungen löschen ''' Public Sub clearSelection() @@ -843,7 +844,7 @@ Partial Public Class Scatterplot For i = 0 To Me.Diags.GetUpperBound(0) For j = 0 To Me.Diags.GetUpperBound(1) - 'Serie löschen + 'Serie löschen serie = Me.Diags(i, j).getSeriesPoint("Selected solutions") serie.Dispose() diff --git a/BlueM.Opt/Diagramm/ScatterplotDialog.vb b/BlueM.Opt/Diagramm/ScatterplotDialog.vb index 205db6a9..855f8341 100644 --- a/BlueM.Opt/Diagramm/ScatterplotDialog.vb +++ b/BlueM.Opt/Diagramm/ScatterplotDialog.vb @@ -16,19 +16,20 @@ 'along with this program. If not, see . ' Imports System.Windows.Forms +Imports BlueM.Opt.Common Public Class ScatterplotDialog - Private mProblem As BlueM.Opt.Common.Problem + Private mProblem As Problem Private isInitializing As Boolean Private RefResultExists As Boolean - Public ReadOnly Property selectedSpace() As BlueM.Opt.Common.SPACE + Public ReadOnly Property selectedSpace() As Constants.SPACE Get If (Me.RadioButton_SolutionSpace.Checked) Then - Return Common.SPACE.SolutionSpace + Return Constants.SPACE.SolutionSpace Else - Return Common.SPACE.DecisionSpace + Return Constants.SPACE.DecisionSpace End If End Get End Property @@ -72,7 +73,7 @@ Public Class ScatterplotDialog End Get End Property - Public Sub New(ByRef prob As BlueM.Opt.Common.Problem, Optional ByVal _refResultExists As Boolean = False) + Public Sub New(ByRef prob As Problem, Optional ByVal _refResultExists As Boolean = False) ' This call is required by the Windows Form Designer. Me.isInitializing = True @@ -91,13 +92,13 @@ Public Class ScatterplotDialog Private Sub ScatterplotDialog_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load - 'Option für Referenz-Ergebnis ggf. ausblenden + 'Option für Referenz-Ergebnis ggf. ausblenden If (Not Me.RefResultExists) Then Me.CheckBox_showRef.Enabled = False End If 'Deactive SekPop only option for SensiPlot - If Me.mProblem.Method = Common.METH_SENSIPLOT Then + If Me.mProblem.Method = Constants.METH_SENSIPLOT Then Me.CheckBox_SekPopOnly.Checked = False Me.CheckBox_SekPopOnly.Enabled = False End If @@ -111,7 +112,7 @@ Public Class ScatterplotDialog Dim i As Integer - 'Alle Variablen auswählen + 'Alle Variablen auswählen For i = 0 To Me.CheckedListBox_Auswahl.Items.Count - 1 Me.CheckedListBox_Auswahl.SetItemCheckState(i, CheckState.Checked) Next @@ -130,18 +131,18 @@ Public Class ScatterplotDialog Select Case Me.selectedSpace - Case Common.SPACE.SolutionSpace + Case Constants.SPACE.SolutionSpace 'Solution Space - For Each feature As Common.ObjectiveFunction In Me.mProblem.List_ObjectiveFunctions + For Each feature As ObjectiveFunction In Me.mProblem.List_ObjectiveFunctions bezeichnung = feature.Description 'Penalty-Functions mit Sternchen markieren If (feature.isPrimObjective) Then bezeichnung &= " (*)" Me.CheckedListBox_Auswahl.Items.Add(bezeichnung) Next - Case Common.SPACE.DecisionSpace + Case Constants.SPACE.DecisionSpace 'Decision Space - For Each param As Common.OptParameter In Me.mProblem.List_OptParameter + For Each param As OptParameter In Me.mProblem.List_OptParameter bezeichnung = param.Bezeichnung Me.CheckedListBox_Auswahl.Items.Add(bezeichnung) Next @@ -151,9 +152,9 @@ Public Class ScatterplotDialog End Sub Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_OK.Click - 'Mindestens 2 Variablen müssen ausgewählt sein + 'Mindestens 2 Variablen müssen ausgewählt sein If (Me.CheckedListBox_Auswahl.CheckedIndices.Count < 2) Then - MsgBox("Bitte mindestens 2 Variablen auswählen!", MsgBoxStyle.Exclamation) + MsgBox("Bitte mindestens 2 Variablen auswählen!", MsgBoxStyle.Exclamation) Me.DialogResult = Windows.Forms.DialogResult.None Exit Sub End If diff --git a/BlueM.Opt/Main/AboutBox.Designer.vb b/BlueM.Opt/Main/AboutBox.Designer.vb index 6e8d17ec..2a400701 100644 --- a/BlueM.Opt/Main/AboutBox.Designer.vb +++ b/BlueM.Opt/Main/AboutBox.Designer.vb @@ -1,4 +1,4 @@ - _ + _ Partial Class AboutBox Inherits System.Windows.Forms.Form @@ -127,7 +127,7 @@ Partial Class AboutBox 'OKButton ' Me.OKButton.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.OKButton.DialogResult = System.Windows.Forms.DialogResult.Cancel + Me.OKButton.DialogResult = DialogResult.Cancel Me.OKButton.Location = New System.Drawing.Point(287, 254) Me.OKButton.Name = "OKButton" Me.OKButton.Size = New System.Drawing.Size(75, 23) diff --git a/BlueM.Opt/Main/BlueM.Opt.vbproj b/BlueM.Opt/Main/BlueM.Opt.vbproj index f114a9e7..e452288f 100644 --- a/BlueM.Opt/Main/BlueM.Opt.vbproj +++ b/BlueM.Opt/Main/BlueM.Opt.vbproj @@ -278,9 +278,9 @@ MyApplicationCodeGenerator Application.Designer.vb - + Always - + diff --git a/BlueM.Opt/Main/BLUEM.OPT_RELEASE-NOTES.txt b/BlueM.Opt/Main/CHANGELOG.md similarity index 95% rename from BlueM.Opt/Main/BLUEM.OPT_RELEASE-NOTES.txt rename to BlueM.Opt/Main/CHANGELOG.md index 26795c22..021248d4 100644 --- a/BlueM.Opt/Main/BLUEM.OPT_RELEASE-NOTES.txt +++ b/BlueM.Opt/Main/CHANGELOG.md @@ -1,16 +1,20 @@ -=============================================================== -BlueM.Opt Release Notes -=============================================================== +BlueM.Opt Release Notes +======================= Version 2.6.0 ------------- NEW: -* Added support for Talsim datasets in Talsim5 database format (select `TALSIM5` as the app) +* Added support for Talsim datasets in Talsim5 database format (select `TALSIM5` as the app) #243 CHANGED: * Updated Talsim.Engine to v4.1.22 * Updated BlueM.Wave to v2.17.0 +REMOVED: +* Removed support for SWMM #231 +* Removed support for reading objective functions of type "Values" from OBF files +* Removed deprecated objective functions "NashSutt" and "LnNashSutt" (use "NSE" or "lnNSE" instead) + Version 2.5.0 ------------- NEW: diff --git a/BlueM.Opt/Main/EVO_Einstellungen.vb b/BlueM.Opt/Main/EVO_Einstellungen.vb index 02768c4b..2f67e026 100644 --- a/BlueM.Opt/Main/EVO_Einstellungen.vb +++ b/BlueM.Opt/Main/EVO_Einstellungen.vb @@ -15,15 +15,15 @@ 'You should have received a copy of the GNU General Public License 'along with this program. If not, see . ' -Imports BlueM.Opt.Common.Constants +Imports BlueM.Opt.Common Public Class EVO_Einstellungen Inherits Windows.Forms.UserControl #Region "Eigenschaften" - Private mSettings As BlueM.Opt.Common.Settings - Private mProblem As BlueM.Opt.Common.Problem 'Das Problem + Private mSettings As Settings + Private mProblem As Problem 'Das Problem Private isInitializing As Boolean #End Region @@ -36,32 +36,32 @@ Public Class EVO_Einstellungen Me.isInitializing = True - ' Dieser Aufruf ist für den Windows Form-Designer erforderlich. + ' Dieser Aufruf ist für den Windows Form-Designer erforderlich. Call Me.InitializeComponent() 'Comboboxen initialisieren '------------------------- 'PES: - Me.PES_Combo_Strategie.DataSource = System.Enum.GetValues(GetType(EVO_STRATEGY)) - Me.PES_Combo_Startparameter.DataSource = System.Enum.GetValues(GetType(EVO_STARTPARAMETERS)) - Me.PES_Combo_DnMutation.DataSource = System.Enum.GetValues(GetType(PES_MUTATIONSOP)) - Me.PES_Combo_OptEltern.DataSource = System.Enum.GetValues(GetType(PES_REPRODOP)) - Me.PES_Combo_PopEltern.DataSource = System.Enum.GetValues(GetType(EVO_POP_ELTERN)) - Me.PES_Combo_PopStrategie.DataSource = System.Enum.GetValues(GetType(EVO_STRATEGY)) + Me.PES_Combo_Strategie.DataSource = [Enum].GetValues(GetType(EVO_STRATEGY)) + Me.PES_Combo_Startparameter.DataSource = [Enum].GetValues(GetType(EVO_STARTPARAMETERS)) + Me.PES_Combo_DnMutation.DataSource = [Enum].GetValues(GetType(PES_MUTATIONSOP)) + Me.PES_Combo_OptEltern.DataSource = [Enum].GetValues(GetType(PES_REPRODOP)) + Me.PES_Combo_PopEltern.DataSource = [Enum].GetValues(GetType(EVO_POP_ELTERN)) + Me.PES_Combo_PopStrategie.DataSource = [Enum].GetValues(GetType(EVO_STRATEGY)) 'TSP - Me.TSP_ComboBox_prob_instance.DataSource = System.Enum.GetValues(GetType(EnProblem)) - Me.TSP_ComboBox_Reproductionoperator.DataSource = System.Enum.GetValues(GetType(EnReprodOperator)) - Me.TSP_ComboBox_Mutationoperator.DataSource = System.Enum.GetValues(GetType(EnMutOperator)) + Me.TSP_ComboBox_prob_instance.DataSource = [Enum].GetValues(GetType(EnProblem)) + Me.TSP_ComboBox_Reproductionoperator.DataSource = [Enum].GetValues(GetType(EnReprodOperator)) + Me.TSP_ComboBox_Mutationoperator.DataSource = [Enum].GetValues(GetType(EnMutOperator)) - 'Listboxen von SensiPlot werden erst bei setProblem() gefüllt! + 'Listboxen von SensiPlot werden erst bei setProblem() gefüllt! Me.isInitializing = False End Sub ''' - ''' Setzt das Problem zurück + ''' Setzt das Problem zurück ''' Public Sub Reset() Me.mProblem = Nothing @@ -71,7 +71,7 @@ Public Class EVO_Einstellungen ''' Setzt die Settings und aktiviert die entsprechenden TabPages ''' ''' Settings - Public Sub setSettings(ByRef settings As Common.Settings) + Public Sub setSettings(ByRef settings As Settings) Me.mSettings = settings @@ -158,7 +158,7 @@ Public Class EVO_Einstellungen ''' und zeigt die entsprechenden TabPages an ''' ''' Das Problem - Public Sub setProblem(ByRef prob As BlueM.Opt.Common.Problem) + Public Sub setProblem(ByRef prob As Problem) 'Problem speichern Me.mProblem = prob @@ -168,47 +168,47 @@ Public Class EVO_Einstellungen Case METH_PES 'PES-Settings instanzieren - Me.mSettings.PES = New Common.Settings_PES() + Me.mSettings.PES = New Settings_PES() Me.mSettings.PES.setStandard(Me.mProblem.Modus) Case METH_HOOKEJEEVES 'HJ-Settings instanzieren - Me.mSettings.HookeJeeves = New Common.Settings_HookeJeeves() + Me.mSettings.HookeJeeves = New Settings_HookeJeeves() Me.mSettings.HookeJeeves.setStandard() Case METH_DDS 'DDS-Settings initialisieren - Me.mSettings.DDS = New Common.Settings_DDS() + Me.mSettings.DDS = New Settings_DDS() Me.mSettings.DDS.setStandard() Case METH_METAEVO 'MetaEvo-Settings instanzieren - Me.mSettings.MetaEvo = New Common.Settings_MetaEvo() + Me.mSettings.MetaEvo = New Settings_MetaEvo() Me.mSettings.MetaEvo.setStandard() Case METH_SENSIPLOT 'Sensiplot-Settings instanzieren - Me.mSettings.SensiPlot = New Common.Settings_Sensiplot() + Me.mSettings.SensiPlot = New Settings_Sensiplot() Me.mSettings.SensiPlot.setStandard() - 'Listboxen füllen + 'Listboxen füllen Me.isInitializing = True Me.SensiPlot_ListBox_OptParameter.Items.Clear() - For Each optpara As Common.OptParameter In Me.mProblem.List_OptParameter + For Each optpara As OptParameter In Me.mProblem.List_OptParameter Call Me.SensiPlot_ListBox_OptParameter.Items.Add(optpara) Next Me.SensiPlot_ListBox_Objectives.Items.Clear() - For Each objective As Common.ObjectiveFunction In Me.mProblem.List_ObjectiveFunctions + For Each objective As ObjectiveFunction In Me.mProblem.List_ObjectiveFunctions Call Me.SensiPlot_ListBox_Objectives.Items.Add(objective) Next Me.isInitializing = False - 'Standardmäßig ersten OptParameter und erste ObjectiveFunction auswählen + 'Standardmäßig ersten OptParameter und erste ObjectiveFunction auswählen Me.SensiPlot_ListBox_OptParameter.SetSelected(0, True) Me.SensiPlot_ListBox_Objectives.SetSelected(0, True) Case METH_TSP 'TSP-Settings instanzieren - Me.mSettings.TSP = New Common.Settings_TSP() + Me.mSettings.TSP = New Settings_TSP() Me.mSettings.TSP.setStandard() Case Else @@ -372,7 +372,7 @@ Public Class EVO_Einstellungen End If SensiPlot_Label_NumCombinations.Text = $"{NumCombinations} parameter combinations" Catch ex As OverflowException - MsgBox($"The current settings result in too many parameter combinations!{eol}Setting no. of steps to 2.") + MsgBox($"The current settings result in too many parameter combinations!{Constants.eol}Setting no. of steps to 2.") SensiPlot_NumericUpDown_NumSteps.Value = 2 End Try diff --git a/BlueM.Opt/Main/EVO_Opt_Verlauf.vb b/BlueM.Opt/Main/EVO_Opt_Verlauf.vb index 50e8fffa..00887421 100644 --- a/BlueM.Opt/Main/EVO_Opt_Verlauf.vb +++ b/BlueM.Opt/Main/EVO_Opt_Verlauf.vb @@ -15,6 +15,8 @@ 'You should have received a copy of the GNU General Public License 'along with this program. If not, see . ' +Imports BlueM.Opt.Common + ''' ''' Ein Benutzersteuerelement, dass den in einem Progress-Objekt ''' abgebildeten Optimierungsverlauf in GUI-Form wiedergibt @@ -22,19 +24,19 @@ Partial Public Class EVO_Opt_Verlauf Inherits System.Windows.Forms.UserControl - Private WithEvents mProgress As BlueM.Opt.Common.Progress + Private WithEvents mProgress As Progress ''' ''' EVO_Opt_Verlauf initialisieren ''' - ''' Übergabe des Progress-Objekts + ''' Übergabe des Progress-Objekts ''' Braucht nur ein einziges Mal aufgerufen zu werden - Public Sub Initialisieren(ByRef progress As BlueM.Opt.Common.Progress) + Public Sub Initialisieren(ByRef progress As Progress) 'Progress-Objekt speichern Me.mProgress = progress - 'Zurücksetzen + 'Zurücksetzen Call Me.Reset() End Sub @@ -76,7 +78,7 @@ Partial Public Class EVO_Opt_Verlauf ProgressBarRunde.Value = Me.mProgress.iRunde LabelaktRunde.Text = Me.mProgress.iRunde.ToString() - System.Windows.Forms.Application.DoEvents() + Application.DoEvents() End Sub @@ -84,7 +86,7 @@ Partial Public Class EVO_Opt_Verlauf ProgressBarPop.Value = Me.mProgress.iPopul LabelaktPop.Text = Me.mProgress.iPopul.ToString() - System.Windows.Forms.Application.DoEvents() + Application.DoEvents() End Sub @@ -92,7 +94,7 @@ Partial Public Class EVO_Opt_Verlauf ProgressBarGen.Value = Me.mProgress.iGen LabelaktGen.Text = Me.mProgress.iGen.ToString() - System.Windows.Forms.Application.DoEvents() + Application.DoEvents() End Sub @@ -100,7 +102,7 @@ Partial Public Class EVO_Opt_Verlauf ProgressBarNach.Value = Me.mProgress.iNachf LabelaktNachf.Text = Me.mProgress.iNachf.ToString() - System.Windows.Forms.Application.DoEvents() + Application.DoEvents() End Sub diff --git a/BlueM.Opt/Main/Form1.Designer.vb b/BlueM.Opt/Main/Form1.Designer.vb index be052b93..a44635cc 100644 --- a/BlueM.Opt/Main/Form1.Designer.vb +++ b/BlueM.Opt/Main/Form1.Designer.vb @@ -4,11 +4,11 @@ Partial Class Form1 Public Sub New() MyBase.New() - 'Dieser Aufruf ist für den Windows Form-Designer erforderlich. + 'Dieser Aufruf ist für den Windows Form-Designer erforderlich. IsInitializing = True InitializeComponent() End Sub - 'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. + 'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. Protected Overloads Overrides Sub Dispose(ByVal Disposing As Boolean) If Disposing Then If Not components Is Nothing Then @@ -17,12 +17,12 @@ Partial Class Form1 End If MyBase.Dispose(Disposing) End Sub - 'Wird vom Windows Form-Designer benötigt. + 'Wird vom Windows Form-Designer benötigt. Private components As System.ComponentModel.IContainer Public ToolTip1 As System.Windows.Forms.ToolTip - 'Hinweis: Die folgende Prozedur wird vom Windows Form-Designer benötigt. - 'Das Verändern mit dem Windows Form-Designer ist nicht möglich. - 'Das Verändern mit dem Code-Editor ist nicht möglich. + 'Hinweis: Die folgende Prozedur wird vom Windows Form-Designer benötigt. + 'Das Verändern mit dem Windows Form-Designer ist nicht möglich. + 'Das Verändern mit dem Code-Editor ist nicht möglich. Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container() Dim MenuStrip1 As System.Windows.Forms.MenuStrip @@ -36,9 +36,9 @@ Partial Class Form1 Dim ToolStripSeparator7 As System.Windows.Forms.ToolStripSeparator Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Form1)) Dim Margins1 As Steema.TeeChart.Margins = New Steema.TeeChart.Margins() - Me.MenuItem_DatensatzZurücksetzen = New System.Windows.Forms.ToolStripMenuItem() + Me.MenuItem_DatensatzZurücksetzen = New System.Windows.Forms.ToolStripMenuItem() Me.ToolStripMenuItem_Help = New System.Windows.Forms.ToolStripMenuItem() - Me.ReleaseNotesToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() + Me.ToolStripMenuItem_Changelog = New System.Windows.Forms.ToolStripMenuItem() Me.ToolStripMenuItem_About = New System.Windows.Forms.ToolStripMenuItem() Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components) Me.Button_Start = New System.Windows.Forms.Button() @@ -99,22 +99,22 @@ Partial Class Form1 ' 'MenuItem_Tools ' - MenuItem_Tools.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.MenuItem_DatensatzZurücksetzen}) + MenuItem_Tools.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.MenuItem_DatensatzZurücksetzen}) MenuItem_Tools.Name = "MenuItem_Tools" MenuItem_Tools.Size = New System.Drawing.Size(46, 20) MenuItem_Tools.Text = "Tools" ' - 'MenuItem_DatensatzZurücksetzen + 'MenuItem_DatensatzZurücksetzen ' - Me.MenuItem_DatensatzZurücksetzen.Enabled = False - Me.MenuItem_DatensatzZurücksetzen.Name = "MenuItem_DatensatzZurücksetzen" - Me.MenuItem_DatensatzZurücksetzen.Size = New System.Drawing.Size(143, 22) - Me.MenuItem_DatensatzZurücksetzen.Text = "Reset dataset" + Me.MenuItem_DatensatzZurücksetzen.Enabled = False + Me.MenuItem_DatensatzZurücksetzen.Name = "MenuItem_DatensatzZurücksetzen" + Me.MenuItem_DatensatzZurücksetzen.Size = New System.Drawing.Size(143, 22) + Me.MenuItem_DatensatzZurücksetzen.Text = "Reset dataset" ' 'MenuItem_Info ' MenuItem_Info.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right - MenuItem_Info.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripMenuItem_Help, Me.ReleaseNotesToolStripMenuItem, Me.ToolStripMenuItem_About}) + MenuItem_Info.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripMenuItem_Help, Me.ToolStripMenuItem_Changelog, Me.ToolStripMenuItem_About}) MenuItem_Info.Name = "MenuItem_Info" MenuItem_Info.Size = New System.Drawing.Size(24, 20) MenuItem_Info.Text = "?" @@ -122,19 +122,19 @@ Partial Class Form1 'ToolStripMenuItem_Help ' Me.ToolStripMenuItem_Help.Name = "ToolStripMenuItem_Help" - Me.ToolStripMenuItem_Help.Size = New System.Drawing.Size(145, 22) + Me.ToolStripMenuItem_Help.Size = New System.Drawing.Size(180, 22) Me.ToolStripMenuItem_Help.Text = "Help" ' - 'ReleaseNotesToolStripMenuItem + 'ToolStripMenuItem_Changelog ' - Me.ReleaseNotesToolStripMenuItem.Name = "ReleaseNotesToolStripMenuItem" - Me.ReleaseNotesToolStripMenuItem.Size = New System.Drawing.Size(145, 22) - Me.ReleaseNotesToolStripMenuItem.Text = "Release notes" + Me.ToolStripMenuItem_Changelog.Name = "ToolStripMenuItem_Changelog" + Me.ToolStripMenuItem_Changelog.Size = New System.Drawing.Size(180, 22) + Me.ToolStripMenuItem_Changelog.Text = "Changelog" ' 'ToolStripMenuItem_About ' Me.ToolStripMenuItem_About.Name = "ToolStripMenuItem_About" - Me.ToolStripMenuItem_About.Size = New System.Drawing.Size(145, 22) + Me.ToolStripMenuItem_About.Size = New System.Drawing.Size(180, 22) Me.ToolStripMenuItem_About.Text = "About" ' 'ToolStripSeparator4 @@ -294,7 +294,7 @@ Partial Class Form1 ' Me.ToolStripButton_New.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image Me.ToolStripButton_New.Image = Global.BlueM.Opt.My.Resources.Resources.page_white - Me.ToolStripButton_New.ImageTransparentColor = System.Drawing.Color.Magenta + Me.ToolStripButton_New.ImageTransparentColor = Color.Magenta Me.ToolStripButton_New.Name = "ToolStripButton_New" Me.ToolStripButton_New.Size = New System.Drawing.Size(23, 22) Me.ToolStripButton_New.Text = "New" @@ -304,7 +304,7 @@ Partial Class Form1 ' Me.ToolStripSplitButton_Settings.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripMenuItem_SettingsLoad}) Me.ToolStripSplitButton_Settings.Image = Global.BlueM.Opt.My.Resources.Resources.wrench - Me.ToolStripSplitButton_Settings.ImageTransparentColor = System.Drawing.Color.Magenta + Me.ToolStripSplitButton_Settings.ImageTransparentColor = Color.Magenta Me.ToolStripSplitButton_Settings.Name = "ToolStripSplitButton_Settings" Me.ToolStripSplitButton_Settings.Size = New System.Drawing.Size(81, 22) Me.ToolStripSplitButton_Settings.Text = "Settings" @@ -313,14 +313,14 @@ Partial Class Form1 ' Me.ToolStripMenuItem_SettingsLoad.Image = Global.BlueM.Opt.My.Resources.Resources.page_white_get Me.ToolStripMenuItem_SettingsLoad.Name = "ToolStripMenuItem_SettingsLoad" - Me.ToolStripMenuItem_SettingsLoad.Size = New System.Drawing.Size(180, 22) + Me.ToolStripMenuItem_SettingsLoad.Size = New System.Drawing.Size(153, 22) Me.ToolStripMenuItem_SettingsLoad.Text = "Load settings..." ' 'ToolStripSplitButton_ErgebnisDB ' Me.ToolStripSplitButton_ErgebnisDB.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripMenuItem_ErgebnisDBLoad, Me.ToolStripMenuItem_ErgebnisDBCompare}) Me.ToolStripSplitButton_ErgebnisDB.Image = Global.BlueM.Opt.My.Resources.Resources.database - Me.ToolStripSplitButton_ErgebnisDB.ImageTransparentColor = System.Drawing.Color.Magenta + Me.ToolStripSplitButton_ErgebnisDB.ImageTransparentColor = Color.Magenta Me.ToolStripSplitButton_ErgebnisDB.Name = "ToolStripSplitButton_ErgebnisDB" Me.ToolStripSplitButton_ErgebnisDB.Size = New System.Drawing.Size(71, 22) Me.ToolStripSplitButton_ErgebnisDB.Text = "Result" @@ -346,7 +346,7 @@ Partial Class Form1 ' Me.ToolStripSplitButton_Diagramm.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripMenuItem_TChartEdit, Me.ToolStripMenuItem_TChartSave, Me.ToolStripMenuItem_TChart2PNG, Me.ToolStripMenuItem_Tchart2CSV}) Me.ToolStripSplitButton_Diagramm.Image = Global.BlueM.Opt.My.Resources.Resources.chart_curve - Me.ToolStripSplitButton_Diagramm.ImageTransparentColor = System.Drawing.Color.Magenta + Me.ToolStripSplitButton_Diagramm.ImageTransparentColor = Color.Magenta Me.ToolStripSplitButton_Diagramm.Name = "ToolStripSplitButton_Diagramm" Me.ToolStripSplitButton_Diagramm.Size = New System.Drawing.Size(68, 22) Me.ToolStripSplitButton_Diagramm.Text = "Chart" @@ -388,7 +388,7 @@ Partial Class Form1 Me.ToolStripButton_Monitor.CheckOnClick = True Me.ToolStripButton_Monitor.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image Me.ToolStripButton_Monitor.Image = Global.BlueM.Opt.My.Resources.Resources.monitor - Me.ToolStripButton_Monitor.ImageTransparentColor = System.Drawing.Color.Magenta + Me.ToolStripButton_Monitor.ImageTransparentColor = Color.Magenta Me.ToolStripButton_Monitor.Name = "ToolStripButton_Monitor" Me.ToolStripButton_Monitor.Size = New System.Drawing.Size(23, 22) Me.ToolStripButton_Monitor.Text = "Show/hide Monitor" @@ -397,7 +397,7 @@ Partial Class Form1 ' Me.ToolStripButton_Scatterplot.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image Me.ToolStripButton_Scatterplot.Image = Global.BlueM.Opt.My.Resources.Resources.scatterplot - Me.ToolStripButton_Scatterplot.ImageTransparentColor = System.Drawing.Color.Magenta + Me.ToolStripButton_Scatterplot.ImageTransparentColor = Color.Magenta Me.ToolStripButton_Scatterplot.Name = "ToolStripButton_Scatterplot" Me.ToolStripButton_Scatterplot.Size = New System.Drawing.Size(23, 22) Me.ToolStripButton_Scatterplot.Text = "Scatterplot" @@ -407,7 +407,7 @@ Partial Class Form1 ' Me.ToolStripButton_CustomPlot.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image Me.ToolStripButton_CustomPlot.Image = CType(resources.GetObject("ToolStripButton_CustomPlot.Image"), System.Drawing.Image) - Me.ToolStripButton_CustomPlot.ImageTransparentColor = System.Drawing.Color.Magenta + Me.ToolStripButton_CustomPlot.ImageTransparentColor = Color.Magenta Me.ToolStripButton_CustomPlot.Name = "ToolStripButton_CustomPlot" Me.ToolStripButton_CustomPlot.Size = New System.Drawing.Size(23, 22) Me.ToolStripButton_CustomPlot.Text = "Display/update custom plot" @@ -417,7 +417,7 @@ Partial Class Form1 ' Me.ToolStripButton_SelectedSolutions.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image Me.ToolStripButton_SelectedSolutions.Image = Global.BlueM.Opt.My.Resources.Resources.table - Me.ToolStripButton_SelectedSolutions.ImageTransparentColor = System.Drawing.Color.Magenta + Me.ToolStripButton_SelectedSolutions.ImageTransparentColor = Color.Magenta Me.ToolStripButton_SelectedSolutions.Name = "ToolStripButton_SelectedSolutions" Me.ToolStripButton_SelectedSolutions.Size = New System.Drawing.Size(23, 22) Me.ToolStripButton_SelectedSolutions.Text = "Show selected solutions window" @@ -452,13 +452,13 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Bottom.Labels.Bevel.ColorOne = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) - Me.Hauptdiagramm1.Axes.Bottom.Labels.Bevel.ColorTwo = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) + Me.Hauptdiagramm1.Axes.Bottom.Labels.Bevel.ColorOne = Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.Hauptdiagramm1.Axes.Bottom.Labels.Bevel.ColorTwo = Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) Me.Hauptdiagramm1.Axes.Bottom.Labels.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None ' ' ' - Me.Hauptdiagramm1.Axes.Bottom.Labels.Brush.Color = System.Drawing.Color.White + Me.Hauptdiagramm1.Axes.Bottom.Labels.Brush.Color = Color.White Me.Hauptdiagramm1.Axes.Bottom.Labels.Brush.Solid = True Me.Hauptdiagramm1.Axes.Bottom.Labels.Brush.Visible = True ' @@ -468,7 +468,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Bottom.Labels.Font.Brush.Color = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) + Me.Hauptdiagramm1.Axes.Bottom.Labels.Font.Brush.Color = Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) Me.Hauptdiagramm1.Axes.Bottom.Labels.Font.Brush.Solid = True Me.Hauptdiagramm1.Axes.Bottom.Labels.Font.Brush.Visible = True ' @@ -477,7 +477,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Bottom.Labels.Font.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.Axes.Bottom.Labels.Font.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.Axes.Bottom.Labels.Font.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Axes.Bottom.Labels.Font.Shadow.Brush.Visible = True Me.Hauptdiagramm1.Axes.Bottom.Labels.Font.Size = 9 @@ -488,7 +488,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Bottom.Labels.ImageBevel.Brush.Color = System.Drawing.Color.LightGray + Me.Hauptdiagramm1.Axes.Bottom.Labels.ImageBevel.Brush.Color = Color.LightGray Me.Hauptdiagramm1.Axes.Bottom.Labels.ImageBevel.Brush.Solid = True Me.Hauptdiagramm1.Axes.Bottom.Labels.ImageBevel.Brush.Visible = True ' @@ -497,7 +497,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Bottom.Labels.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.Axes.Bottom.Labels.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.Axes.Bottom.Labels.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Axes.Bottom.Labels.Shadow.Brush.Visible = True ' @@ -507,13 +507,13 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Bottom.Title.Bevel.ColorOne = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) - Me.Hauptdiagramm1.Axes.Bottom.Title.Bevel.ColorTwo = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) + Me.Hauptdiagramm1.Axes.Bottom.Title.Bevel.ColorOne = Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.Hauptdiagramm1.Axes.Bottom.Title.Bevel.ColorTwo = Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) Me.Hauptdiagramm1.Axes.Bottom.Title.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None ' ' ' - Me.Hauptdiagramm1.Axes.Bottom.Title.Brush.Color = System.Drawing.Color.Silver + Me.Hauptdiagramm1.Axes.Bottom.Title.Brush.Color = Color.Silver Me.Hauptdiagramm1.Axes.Bottom.Title.Brush.Solid = True Me.Hauptdiagramm1.Axes.Bottom.Title.Brush.Visible = True ' @@ -523,7 +523,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Bottom.Title.Font.Brush.Color = System.Drawing.Color.FromArgb(CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer)) + Me.Hauptdiagramm1.Axes.Bottom.Title.Font.Brush.Color = Color.FromArgb(CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer)) Me.Hauptdiagramm1.Axes.Bottom.Title.Font.Brush.Solid = True Me.Hauptdiagramm1.Axes.Bottom.Title.Font.Brush.Visible = True ' @@ -532,7 +532,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Bottom.Title.Font.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.Axes.Bottom.Title.Font.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.Axes.Bottom.Title.Font.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Axes.Bottom.Title.Font.Shadow.Brush.Visible = True Me.Hauptdiagramm1.Axes.Bottom.Title.Font.Size = 11 @@ -543,7 +543,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Bottom.Title.ImageBevel.Brush.Color = System.Drawing.Color.LightGray + Me.Hauptdiagramm1.Axes.Bottom.Title.ImageBevel.Brush.Color = Color.LightGray Me.Hauptdiagramm1.Axes.Bottom.Title.ImageBevel.Brush.Solid = True Me.Hauptdiagramm1.Axes.Bottom.Title.ImageBevel.Brush.Visible = True ' @@ -552,10 +552,9 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Bottom.Title.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.Axes.Bottom.Title.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.Axes.Bottom.Title.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Axes.Bottom.Title.Shadow.Brush.Visible = True - Me.Hauptdiagramm1.Axes.Bottom.UseMaxPixelPos = True ' ' ' @@ -565,13 +564,13 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Depth.Labels.Bevel.ColorOne = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) - Me.Hauptdiagramm1.Axes.Depth.Labels.Bevel.ColorTwo = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) + Me.Hauptdiagramm1.Axes.Depth.Labels.Bevel.ColorOne = Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.Hauptdiagramm1.Axes.Depth.Labels.Bevel.ColorTwo = Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) Me.Hauptdiagramm1.Axes.Depth.Labels.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None ' ' ' - Me.Hauptdiagramm1.Axes.Depth.Labels.Brush.Color = System.Drawing.Color.White + Me.Hauptdiagramm1.Axes.Depth.Labels.Brush.Color = Color.White Me.Hauptdiagramm1.Axes.Depth.Labels.Brush.Solid = True Me.Hauptdiagramm1.Axes.Depth.Labels.Brush.Visible = True ' @@ -581,7 +580,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Depth.Labels.Font.Brush.Color = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) + Me.Hauptdiagramm1.Axes.Depth.Labels.Font.Brush.Color = Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) Me.Hauptdiagramm1.Axes.Depth.Labels.Font.Brush.Solid = True Me.Hauptdiagramm1.Axes.Depth.Labels.Font.Brush.Visible = True ' @@ -590,7 +589,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Depth.Labels.Font.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.Axes.Depth.Labels.Font.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.Axes.Depth.Labels.Font.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Axes.Depth.Labels.Font.Shadow.Brush.Visible = True Me.Hauptdiagramm1.Axes.Depth.Labels.Font.Size = 9 @@ -601,7 +600,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Depth.Labels.ImageBevel.Brush.Color = System.Drawing.Color.LightGray + Me.Hauptdiagramm1.Axes.Depth.Labels.ImageBevel.Brush.Color = Color.LightGray Me.Hauptdiagramm1.Axes.Depth.Labels.ImageBevel.Brush.Solid = True Me.Hauptdiagramm1.Axes.Depth.Labels.ImageBevel.Brush.Visible = True ' @@ -610,7 +609,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Depth.Labels.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.Axes.Depth.Labels.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.Axes.Depth.Labels.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Axes.Depth.Labels.Shadow.Brush.Visible = True ' @@ -620,13 +619,13 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Depth.Title.Bevel.ColorOne = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) - Me.Hauptdiagramm1.Axes.Depth.Title.Bevel.ColorTwo = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) + Me.Hauptdiagramm1.Axes.Depth.Title.Bevel.ColorOne = Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.Hauptdiagramm1.Axes.Depth.Title.Bevel.ColorTwo = Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) Me.Hauptdiagramm1.Axes.Depth.Title.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None ' ' ' - Me.Hauptdiagramm1.Axes.Depth.Title.Brush.Color = System.Drawing.Color.Silver + Me.Hauptdiagramm1.Axes.Depth.Title.Brush.Color = Color.Silver Me.Hauptdiagramm1.Axes.Depth.Title.Brush.Solid = True Me.Hauptdiagramm1.Axes.Depth.Title.Brush.Visible = True ' @@ -636,7 +635,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Depth.Title.Font.Brush.Color = System.Drawing.Color.FromArgb(CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer)) + Me.Hauptdiagramm1.Axes.Depth.Title.Font.Brush.Color = Color.FromArgb(CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer)) Me.Hauptdiagramm1.Axes.Depth.Title.Font.Brush.Solid = True Me.Hauptdiagramm1.Axes.Depth.Title.Font.Brush.Visible = True ' @@ -645,7 +644,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Depth.Title.Font.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.Axes.Depth.Title.Font.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.Axes.Depth.Title.Font.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Axes.Depth.Title.Font.Shadow.Brush.Visible = True Me.Hauptdiagramm1.Axes.Depth.Title.Font.Size = 11 @@ -656,7 +655,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Depth.Title.ImageBevel.Brush.Color = System.Drawing.Color.LightGray + Me.Hauptdiagramm1.Axes.Depth.Title.ImageBevel.Brush.Color = Color.LightGray Me.Hauptdiagramm1.Axes.Depth.Title.ImageBevel.Brush.Solid = True Me.Hauptdiagramm1.Axes.Depth.Title.ImageBevel.Brush.Visible = True ' @@ -665,10 +664,9 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Depth.Title.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.Axes.Depth.Title.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.Axes.Depth.Title.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Axes.Depth.Title.Shadow.Brush.Visible = True - Me.Hauptdiagramm1.Axes.Depth.UseMaxPixelPos = True ' ' ' @@ -678,13 +676,13 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.DepthTop.Labels.Bevel.ColorOne = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) - Me.Hauptdiagramm1.Axes.DepthTop.Labels.Bevel.ColorTwo = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) + Me.Hauptdiagramm1.Axes.DepthTop.Labels.Bevel.ColorOne = Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.Hauptdiagramm1.Axes.DepthTop.Labels.Bevel.ColorTwo = Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) Me.Hauptdiagramm1.Axes.DepthTop.Labels.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None ' ' ' - Me.Hauptdiagramm1.Axes.DepthTop.Labels.Brush.Color = System.Drawing.Color.White + Me.Hauptdiagramm1.Axes.DepthTop.Labels.Brush.Color = Color.White Me.Hauptdiagramm1.Axes.DepthTop.Labels.Brush.Solid = True Me.Hauptdiagramm1.Axes.DepthTop.Labels.Brush.Visible = True ' @@ -694,7 +692,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.DepthTop.Labels.Font.Brush.Color = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) + Me.Hauptdiagramm1.Axes.DepthTop.Labels.Font.Brush.Color = Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) Me.Hauptdiagramm1.Axes.DepthTop.Labels.Font.Brush.Solid = True Me.Hauptdiagramm1.Axes.DepthTop.Labels.Font.Brush.Visible = True ' @@ -703,7 +701,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.DepthTop.Labels.Font.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.Axes.DepthTop.Labels.Font.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.Axes.DepthTop.Labels.Font.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Axes.DepthTop.Labels.Font.Shadow.Brush.Visible = True Me.Hauptdiagramm1.Axes.DepthTop.Labels.Font.Size = 9 @@ -714,7 +712,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.DepthTop.Labels.ImageBevel.Brush.Color = System.Drawing.Color.LightGray + Me.Hauptdiagramm1.Axes.DepthTop.Labels.ImageBevel.Brush.Color = Color.LightGray Me.Hauptdiagramm1.Axes.DepthTop.Labels.ImageBevel.Brush.Solid = True Me.Hauptdiagramm1.Axes.DepthTop.Labels.ImageBevel.Brush.Visible = True ' @@ -723,7 +721,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.DepthTop.Labels.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.Axes.DepthTop.Labels.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.Axes.DepthTop.Labels.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Axes.DepthTop.Labels.Shadow.Brush.Visible = True ' @@ -733,13 +731,13 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.DepthTop.Title.Bevel.ColorOne = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) - Me.Hauptdiagramm1.Axes.DepthTop.Title.Bevel.ColorTwo = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) + Me.Hauptdiagramm1.Axes.DepthTop.Title.Bevel.ColorOne = Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.Hauptdiagramm1.Axes.DepthTop.Title.Bevel.ColorTwo = Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) Me.Hauptdiagramm1.Axes.DepthTop.Title.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None ' ' ' - Me.Hauptdiagramm1.Axes.DepthTop.Title.Brush.Color = System.Drawing.Color.Silver + Me.Hauptdiagramm1.Axes.DepthTop.Title.Brush.Color = Color.Silver Me.Hauptdiagramm1.Axes.DepthTop.Title.Brush.Solid = True Me.Hauptdiagramm1.Axes.DepthTop.Title.Brush.Visible = True ' @@ -749,7 +747,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.DepthTop.Title.Font.Brush.Color = System.Drawing.Color.FromArgb(CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer)) + Me.Hauptdiagramm1.Axes.DepthTop.Title.Font.Brush.Color = Color.FromArgb(CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer)) Me.Hauptdiagramm1.Axes.DepthTop.Title.Font.Brush.Solid = True Me.Hauptdiagramm1.Axes.DepthTop.Title.Font.Brush.Visible = True ' @@ -758,7 +756,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.DepthTop.Title.Font.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.Axes.DepthTop.Title.Font.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.Axes.DepthTop.Title.Font.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Axes.DepthTop.Title.Font.Shadow.Brush.Visible = True Me.Hauptdiagramm1.Axes.DepthTop.Title.Font.Size = 11 @@ -769,7 +767,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.DepthTop.Title.ImageBevel.Brush.Color = System.Drawing.Color.LightGray + Me.Hauptdiagramm1.Axes.DepthTop.Title.ImageBevel.Brush.Color = Color.LightGray Me.Hauptdiagramm1.Axes.DepthTop.Title.ImageBevel.Brush.Solid = True Me.Hauptdiagramm1.Axes.DepthTop.Title.ImageBevel.Brush.Visible = True ' @@ -778,10 +776,9 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.DepthTop.Title.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.Axes.DepthTop.Title.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.Axes.DepthTop.Title.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Axes.DepthTop.Title.Shadow.Brush.Visible = True - Me.Hauptdiagramm1.Axes.DepthTop.UseMaxPixelPos = True ' ' ' @@ -791,13 +788,13 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Left.Labels.Bevel.ColorOne = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) - Me.Hauptdiagramm1.Axes.Left.Labels.Bevel.ColorTwo = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) + Me.Hauptdiagramm1.Axes.Left.Labels.Bevel.ColorOne = Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.Hauptdiagramm1.Axes.Left.Labels.Bevel.ColorTwo = Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) Me.Hauptdiagramm1.Axes.Left.Labels.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None ' ' ' - Me.Hauptdiagramm1.Axes.Left.Labels.Brush.Color = System.Drawing.Color.White + Me.Hauptdiagramm1.Axes.Left.Labels.Brush.Color = Color.White Me.Hauptdiagramm1.Axes.Left.Labels.Brush.Solid = True Me.Hauptdiagramm1.Axes.Left.Labels.Brush.Visible = True ' @@ -807,7 +804,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Left.Labels.Font.Brush.Color = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) + Me.Hauptdiagramm1.Axes.Left.Labels.Font.Brush.Color = Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) Me.Hauptdiagramm1.Axes.Left.Labels.Font.Brush.Solid = True Me.Hauptdiagramm1.Axes.Left.Labels.Font.Brush.Visible = True ' @@ -816,7 +813,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Left.Labels.Font.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.Axes.Left.Labels.Font.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.Axes.Left.Labels.Font.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Axes.Left.Labels.Font.Shadow.Brush.Visible = True Me.Hauptdiagramm1.Axes.Left.Labels.Font.Size = 9 @@ -827,7 +824,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Left.Labels.ImageBevel.Brush.Color = System.Drawing.Color.LightGray + Me.Hauptdiagramm1.Axes.Left.Labels.ImageBevel.Brush.Color = Color.LightGray Me.Hauptdiagramm1.Axes.Left.Labels.ImageBevel.Brush.Solid = True Me.Hauptdiagramm1.Axes.Left.Labels.ImageBevel.Brush.Visible = True ' @@ -836,7 +833,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Left.Labels.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.Axes.Left.Labels.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.Axes.Left.Labels.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Axes.Left.Labels.Shadow.Brush.Visible = True ' @@ -846,13 +843,13 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Left.Title.Bevel.ColorOne = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) - Me.Hauptdiagramm1.Axes.Left.Title.Bevel.ColorTwo = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) + Me.Hauptdiagramm1.Axes.Left.Title.Bevel.ColorOne = Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.Hauptdiagramm1.Axes.Left.Title.Bevel.ColorTwo = Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) Me.Hauptdiagramm1.Axes.Left.Title.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None ' ' ' - Me.Hauptdiagramm1.Axes.Left.Title.Brush.Color = System.Drawing.Color.Silver + Me.Hauptdiagramm1.Axes.Left.Title.Brush.Color = Color.Silver Me.Hauptdiagramm1.Axes.Left.Title.Brush.Solid = True Me.Hauptdiagramm1.Axes.Left.Title.Brush.Visible = True ' @@ -862,7 +859,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Left.Title.Font.Brush.Color = System.Drawing.Color.FromArgb(CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer)) + Me.Hauptdiagramm1.Axes.Left.Title.Font.Brush.Color = Color.FromArgb(CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer)) Me.Hauptdiagramm1.Axes.Left.Title.Font.Brush.Solid = True Me.Hauptdiagramm1.Axes.Left.Title.Font.Brush.Visible = True ' @@ -871,7 +868,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Left.Title.Font.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.Axes.Left.Title.Font.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.Axes.Left.Title.Font.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Axes.Left.Title.Font.Shadow.Brush.Visible = True Me.Hauptdiagramm1.Axes.Left.Title.Font.Size = 11 @@ -882,7 +879,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Left.Title.ImageBevel.Brush.Color = System.Drawing.Color.LightGray + Me.Hauptdiagramm1.Axes.Left.Title.ImageBevel.Brush.Color = Color.LightGray Me.Hauptdiagramm1.Axes.Left.Title.ImageBevel.Brush.Solid = True Me.Hauptdiagramm1.Axes.Left.Title.ImageBevel.Brush.Visible = True ' @@ -891,10 +888,9 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Left.Title.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.Axes.Left.Title.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.Axes.Left.Title.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Axes.Left.Title.Shadow.Brush.Visible = True - Me.Hauptdiagramm1.Axes.Left.UseMaxPixelPos = True ' ' ' @@ -904,13 +900,13 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Right.Labels.Bevel.ColorOne = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) - Me.Hauptdiagramm1.Axes.Right.Labels.Bevel.ColorTwo = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) + Me.Hauptdiagramm1.Axes.Right.Labels.Bevel.ColorOne = Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.Hauptdiagramm1.Axes.Right.Labels.Bevel.ColorTwo = Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) Me.Hauptdiagramm1.Axes.Right.Labels.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None ' ' ' - Me.Hauptdiagramm1.Axes.Right.Labels.Brush.Color = System.Drawing.Color.White + Me.Hauptdiagramm1.Axes.Right.Labels.Brush.Color = Color.White Me.Hauptdiagramm1.Axes.Right.Labels.Brush.Solid = True Me.Hauptdiagramm1.Axes.Right.Labels.Brush.Visible = True ' @@ -920,7 +916,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Right.Labels.Font.Brush.Color = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) + Me.Hauptdiagramm1.Axes.Right.Labels.Font.Brush.Color = Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) Me.Hauptdiagramm1.Axes.Right.Labels.Font.Brush.Solid = True Me.Hauptdiagramm1.Axes.Right.Labels.Font.Brush.Visible = True ' @@ -929,7 +925,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Right.Labels.Font.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.Axes.Right.Labels.Font.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.Axes.Right.Labels.Font.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Axes.Right.Labels.Font.Shadow.Brush.Visible = True Me.Hauptdiagramm1.Axes.Right.Labels.Font.Size = 9 @@ -940,7 +936,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Right.Labels.ImageBevel.Brush.Color = System.Drawing.Color.LightGray + Me.Hauptdiagramm1.Axes.Right.Labels.ImageBevel.Brush.Color = Color.LightGray Me.Hauptdiagramm1.Axes.Right.Labels.ImageBevel.Brush.Solid = True Me.Hauptdiagramm1.Axes.Right.Labels.ImageBevel.Brush.Visible = True ' @@ -949,7 +945,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Right.Labels.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.Axes.Right.Labels.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.Axes.Right.Labels.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Axes.Right.Labels.Shadow.Brush.Visible = True ' @@ -959,13 +955,13 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Right.Title.Bevel.ColorOne = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) - Me.Hauptdiagramm1.Axes.Right.Title.Bevel.ColorTwo = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) + Me.Hauptdiagramm1.Axes.Right.Title.Bevel.ColorOne = Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.Hauptdiagramm1.Axes.Right.Title.Bevel.ColorTwo = Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) Me.Hauptdiagramm1.Axes.Right.Title.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None ' ' ' - Me.Hauptdiagramm1.Axes.Right.Title.Brush.Color = System.Drawing.Color.Silver + Me.Hauptdiagramm1.Axes.Right.Title.Brush.Color = Color.Silver Me.Hauptdiagramm1.Axes.Right.Title.Brush.Solid = True Me.Hauptdiagramm1.Axes.Right.Title.Brush.Visible = True ' @@ -975,7 +971,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Right.Title.Font.Brush.Color = System.Drawing.Color.FromArgb(CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer)) + Me.Hauptdiagramm1.Axes.Right.Title.Font.Brush.Color = Color.FromArgb(CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer)) Me.Hauptdiagramm1.Axes.Right.Title.Font.Brush.Solid = True Me.Hauptdiagramm1.Axes.Right.Title.Font.Brush.Visible = True ' @@ -984,7 +980,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Right.Title.Font.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.Axes.Right.Title.Font.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.Axes.Right.Title.Font.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Axes.Right.Title.Font.Shadow.Brush.Visible = True Me.Hauptdiagramm1.Axes.Right.Title.Font.Size = 11 @@ -995,7 +991,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Right.Title.ImageBevel.Brush.Color = System.Drawing.Color.LightGray + Me.Hauptdiagramm1.Axes.Right.Title.ImageBevel.Brush.Color = Color.LightGray Me.Hauptdiagramm1.Axes.Right.Title.ImageBevel.Brush.Solid = True Me.Hauptdiagramm1.Axes.Right.Title.ImageBevel.Brush.Visible = True ' @@ -1004,10 +1000,9 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Right.Title.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.Axes.Right.Title.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.Axes.Right.Title.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Axes.Right.Title.Shadow.Brush.Visible = True - Me.Hauptdiagramm1.Axes.Right.UseMaxPixelPos = True ' ' ' @@ -1017,13 +1012,13 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Top.Labels.Bevel.ColorOne = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) - Me.Hauptdiagramm1.Axes.Top.Labels.Bevel.ColorTwo = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) + Me.Hauptdiagramm1.Axes.Top.Labels.Bevel.ColorOne = Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.Hauptdiagramm1.Axes.Top.Labels.Bevel.ColorTwo = Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) Me.Hauptdiagramm1.Axes.Top.Labels.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None ' ' ' - Me.Hauptdiagramm1.Axes.Top.Labels.Brush.Color = System.Drawing.Color.White + Me.Hauptdiagramm1.Axes.Top.Labels.Brush.Color = Color.White Me.Hauptdiagramm1.Axes.Top.Labels.Brush.Solid = True Me.Hauptdiagramm1.Axes.Top.Labels.Brush.Visible = True ' @@ -1033,7 +1028,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Top.Labels.Font.Brush.Color = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) + Me.Hauptdiagramm1.Axes.Top.Labels.Font.Brush.Color = Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) Me.Hauptdiagramm1.Axes.Top.Labels.Font.Brush.Solid = True Me.Hauptdiagramm1.Axes.Top.Labels.Font.Brush.Visible = True ' @@ -1042,7 +1037,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Top.Labels.Font.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.Axes.Top.Labels.Font.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.Axes.Top.Labels.Font.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Axes.Top.Labels.Font.Shadow.Brush.Visible = True Me.Hauptdiagramm1.Axes.Top.Labels.Font.Size = 9 @@ -1053,7 +1048,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Top.Labels.ImageBevel.Brush.Color = System.Drawing.Color.LightGray + Me.Hauptdiagramm1.Axes.Top.Labels.ImageBevel.Brush.Color = Color.LightGray Me.Hauptdiagramm1.Axes.Top.Labels.ImageBevel.Brush.Solid = True Me.Hauptdiagramm1.Axes.Top.Labels.ImageBevel.Brush.Visible = True ' @@ -1062,7 +1057,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Top.Labels.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.Axes.Top.Labels.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.Axes.Top.Labels.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Axes.Top.Labels.Shadow.Brush.Visible = True ' @@ -1072,13 +1067,13 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Top.Title.Bevel.ColorOne = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) - Me.Hauptdiagramm1.Axes.Top.Title.Bevel.ColorTwo = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) + Me.Hauptdiagramm1.Axes.Top.Title.Bevel.ColorOne = Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.Hauptdiagramm1.Axes.Top.Title.Bevel.ColorTwo = Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) Me.Hauptdiagramm1.Axes.Top.Title.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None ' ' ' - Me.Hauptdiagramm1.Axes.Top.Title.Brush.Color = System.Drawing.Color.Silver + Me.Hauptdiagramm1.Axes.Top.Title.Brush.Color = Color.Silver Me.Hauptdiagramm1.Axes.Top.Title.Brush.Solid = True Me.Hauptdiagramm1.Axes.Top.Title.Brush.Visible = True ' @@ -1088,7 +1083,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Top.Title.Font.Brush.Color = System.Drawing.Color.FromArgb(CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer)) + Me.Hauptdiagramm1.Axes.Top.Title.Font.Brush.Color = Color.FromArgb(CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer)) Me.Hauptdiagramm1.Axes.Top.Title.Font.Brush.Solid = True Me.Hauptdiagramm1.Axes.Top.Title.Font.Brush.Visible = True ' @@ -1097,7 +1092,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Top.Title.Font.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.Axes.Top.Title.Font.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.Axes.Top.Title.Font.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Axes.Top.Title.Font.Shadow.Brush.Visible = True Me.Hauptdiagramm1.Axes.Top.Title.Font.Size = 11 @@ -1108,7 +1103,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Top.Title.ImageBevel.Brush.Color = System.Drawing.Color.LightGray + Me.Hauptdiagramm1.Axes.Top.Title.ImageBevel.Brush.Color = Color.LightGray Me.Hauptdiagramm1.Axes.Top.Title.ImageBevel.Brush.Solid = True Me.Hauptdiagramm1.Axes.Top.Title.ImageBevel.Brush.Visible = True ' @@ -1117,23 +1112,22 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Axes.Top.Title.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.Axes.Top.Title.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.Axes.Top.Title.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Axes.Top.Title.Shadow.Brush.Visible = True - Me.Hauptdiagramm1.Axes.Top.UseMaxPixelPos = True ' ' ' ' ' ' - Me.Hauptdiagramm1.Footer.Bevel.ColorOne = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) - Me.Hauptdiagramm1.Footer.Bevel.ColorTwo = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) + Me.Hauptdiagramm1.Footer.Bevel.ColorOne = Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.Hauptdiagramm1.Footer.Bevel.ColorTwo = Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) Me.Hauptdiagramm1.Footer.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None ' ' ' - Me.Hauptdiagramm1.Footer.Brush.Color = System.Drawing.Color.Silver + Me.Hauptdiagramm1.Footer.Brush.Color = Color.Silver Me.Hauptdiagramm1.Footer.Brush.Solid = True Me.Hauptdiagramm1.Footer.Brush.Visible = True ' @@ -1143,7 +1137,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Footer.Font.Brush.Color = System.Drawing.Color.Red + Me.Hauptdiagramm1.Footer.Font.Brush.Color = Color.Red Me.Hauptdiagramm1.Footer.Font.Brush.Solid = True Me.Hauptdiagramm1.Footer.Font.Brush.Visible = True ' @@ -1152,7 +1146,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Footer.Font.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.Footer.Font.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.Footer.Font.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Footer.Font.Shadow.Brush.Visible = True Me.Hauptdiagramm1.Footer.Font.Size = 8 @@ -1163,7 +1157,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Footer.ImageBevel.Brush.Color = System.Drawing.Color.LightGray + Me.Hauptdiagramm1.Footer.ImageBevel.Brush.Color = Color.LightGray Me.Hauptdiagramm1.Footer.ImageBevel.Brush.Solid = True Me.Hauptdiagramm1.Footer.ImageBevel.Brush.Visible = True ' @@ -1172,7 +1166,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Footer.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.Footer.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.Footer.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Footer.Shadow.Brush.Visible = True ' @@ -1181,13 +1175,13 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Header.Bevel.ColorOne = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) - Me.Hauptdiagramm1.Header.Bevel.ColorTwo = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) + Me.Hauptdiagramm1.Header.Bevel.ColorOne = Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.Hauptdiagramm1.Header.Bevel.ColorTwo = Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) Me.Hauptdiagramm1.Header.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None ' ' ' - Me.Hauptdiagramm1.Header.Brush.Color = System.Drawing.Color.FromArgb(CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer)) + Me.Hauptdiagramm1.Header.Brush.Color = Color.FromArgb(CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer)) Me.Hauptdiagramm1.Header.Brush.Solid = True Me.Hauptdiagramm1.Header.Brush.Visible = True ' @@ -1197,7 +1191,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Header.Font.Brush.Color = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) + Me.Hauptdiagramm1.Header.Font.Brush.Color = Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) Me.Hauptdiagramm1.Header.Font.Brush.Solid = True Me.Hauptdiagramm1.Header.Font.Brush.Visible = True ' @@ -1206,7 +1200,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Header.Font.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.Header.Font.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.Header.Font.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Header.Font.Shadow.Brush.Visible = True Me.Hauptdiagramm1.Header.Font.Size = 12 @@ -1217,7 +1211,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Header.ImageBevel.Brush.Color = System.Drawing.Color.LightGray + Me.Hauptdiagramm1.Header.ImageBevel.Brush.Color = Color.LightGray Me.Hauptdiagramm1.Header.ImageBevel.Brush.Solid = True Me.Hauptdiagramm1.Header.ImageBevel.Brush.Visible = True Me.Hauptdiagramm1.Header.Lines = New String() {"BlueM.Opt"} @@ -1227,7 +1221,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Header.Shadow.Brush.Color = System.Drawing.Color.FromArgb(CType(CType(169, Byte), Integer), CType(CType(169, Byte), Integer), CType(CType(169, Byte), Integer)) + Me.Hauptdiagramm1.Header.Shadow.Brush.Color = Color.FromArgb(CType(CType(169, Byte), Integer), CType(CType(169, Byte), Integer), CType(CType(169, Byte), Integer)) Me.Hauptdiagramm1.Header.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Header.Shadow.Brush.Visible = True ' @@ -1236,13 +1230,13 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Legend.Bevel.ColorOne = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) - Me.Hauptdiagramm1.Legend.Bevel.ColorTwo = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) + Me.Hauptdiagramm1.Legend.Bevel.ColorOne = Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.Hauptdiagramm1.Legend.Bevel.ColorTwo = Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) Me.Hauptdiagramm1.Legend.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None ' ' ' - Me.Hauptdiagramm1.Legend.Brush.Color = System.Drawing.Color.White + Me.Hauptdiagramm1.Legend.Brush.Color = Color.White Me.Hauptdiagramm1.Legend.Brush.Solid = True Me.Hauptdiagramm1.Legend.Brush.Visible = True ' @@ -1252,7 +1246,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Legend.Font.Brush.Color = System.Drawing.Color.FromArgb(CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer)) + Me.Hauptdiagramm1.Legend.Font.Brush.Color = Color.FromArgb(CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer)) Me.Hauptdiagramm1.Legend.Font.Brush.Solid = True Me.Hauptdiagramm1.Legend.Font.Brush.Visible = True ' @@ -1261,7 +1255,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Legend.Font.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.Legend.Font.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.Legend.Font.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Legend.Font.Shadow.Brush.Visible = True Me.Hauptdiagramm1.Legend.Font.Size = 9 @@ -1272,7 +1266,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Legend.ImageBevel.Brush.Color = System.Drawing.Color.LightGray + Me.Hauptdiagramm1.Legend.ImageBevel.Brush.Color = Color.LightGray Me.Hauptdiagramm1.Legend.ImageBevel.Brush.Solid = True Me.Hauptdiagramm1.Legend.ImageBevel.Brush.Visible = True ' @@ -1281,7 +1275,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Legend.Shadow.Brush.Color = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer)) + Me.Hauptdiagramm1.Legend.Shadow.Brush.Color = Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer)) Me.Hauptdiagramm1.Legend.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Legend.Shadow.Brush.Visible = True ' @@ -1293,7 +1287,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Legend.Symbol.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.Legend.Symbol.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.Legend.Symbol.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Legend.Symbol.Shadow.Brush.Visible = True ' @@ -1302,13 +1296,13 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Legend.Title.Bevel.ColorOne = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) - Me.Hauptdiagramm1.Legend.Title.Bevel.ColorTwo = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) + Me.Hauptdiagramm1.Legend.Title.Bevel.ColorOne = Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.Hauptdiagramm1.Legend.Title.Bevel.ColorTwo = Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) Me.Hauptdiagramm1.Legend.Title.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None ' ' ' - Me.Hauptdiagramm1.Legend.Title.Brush.Color = System.Drawing.Color.White + Me.Hauptdiagramm1.Legend.Title.Brush.Color = Color.White Me.Hauptdiagramm1.Legend.Title.Brush.Solid = True Me.Hauptdiagramm1.Legend.Title.Brush.Visible = True ' @@ -1318,7 +1312,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Legend.Title.Font.Brush.Color = System.Drawing.Color.Black + Me.Hauptdiagramm1.Legend.Title.Font.Brush.Color = Color.Black Me.Hauptdiagramm1.Legend.Title.Font.Brush.Solid = True Me.Hauptdiagramm1.Legend.Title.Font.Brush.Visible = True ' @@ -1327,7 +1321,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Legend.Title.Font.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.Legend.Title.Font.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.Legend.Title.Font.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Legend.Title.Font.Shadow.Brush.Visible = True Me.Hauptdiagramm1.Legend.Title.Font.Size = 8 @@ -1338,7 +1332,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Legend.Title.ImageBevel.Brush.Color = System.Drawing.Color.LightGray + Me.Hauptdiagramm1.Legend.Title.ImageBevel.Brush.Color = Color.LightGray Me.Hauptdiagramm1.Legend.Title.ImageBevel.Brush.Solid = True Me.Hauptdiagramm1.Legend.Title.ImageBevel.Brush.Visible = True ' @@ -1347,7 +1341,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Legend.Title.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.Legend.Title.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.Legend.Title.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Legend.Title.Shadow.Brush.Visible = True Me.Hauptdiagramm1.Location = New System.Drawing.Point(241, 106) @@ -1359,13 +1353,13 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Panel.Bevel.ColorOne = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) - Me.Hauptdiagramm1.Panel.Bevel.ColorTwo = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) + Me.Hauptdiagramm1.Panel.Bevel.ColorOne = Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.Hauptdiagramm1.Panel.Bevel.ColorTwo = Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) Me.Hauptdiagramm1.Panel.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None ' ' ' - Me.Hauptdiagramm1.Panel.Brush.Color = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.Hauptdiagramm1.Panel.Brush.Color = Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) Me.Hauptdiagramm1.Panel.Brush.Solid = True Me.Hauptdiagramm1.Panel.Brush.Visible = True ' @@ -1374,7 +1368,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Panel.ImageBevel.Brush.Color = System.Drawing.Color.LightGray + Me.Hauptdiagramm1.Panel.ImageBevel.Brush.Color = Color.LightGray Me.Hauptdiagramm1.Panel.ImageBevel.Brush.Solid = True Me.Hauptdiagramm1.Panel.ImageBevel.Brush.Visible = True ' @@ -1383,7 +1377,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Panel.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.Panel.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.Panel.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Panel.Shadow.Brush.Visible = True ' @@ -1401,13 +1395,13 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.SubFooter.Bevel.ColorOne = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) - Me.Hauptdiagramm1.SubFooter.Bevel.ColorTwo = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) + Me.Hauptdiagramm1.SubFooter.Bevel.ColorOne = Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.Hauptdiagramm1.SubFooter.Bevel.ColorTwo = Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) Me.Hauptdiagramm1.SubFooter.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None ' ' ' - Me.Hauptdiagramm1.SubFooter.Brush.Color = System.Drawing.Color.Silver + Me.Hauptdiagramm1.SubFooter.Brush.Color = Color.Silver Me.Hauptdiagramm1.SubFooter.Brush.Solid = True Me.Hauptdiagramm1.SubFooter.Brush.Visible = True ' @@ -1417,7 +1411,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.SubFooter.Font.Brush.Color = System.Drawing.Color.Red + Me.Hauptdiagramm1.SubFooter.Font.Brush.Color = Color.Red Me.Hauptdiagramm1.SubFooter.Font.Brush.Solid = True Me.Hauptdiagramm1.SubFooter.Font.Brush.Visible = True ' @@ -1426,7 +1420,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.SubFooter.Font.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.SubFooter.Font.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.SubFooter.Font.Shadow.Brush.Solid = True Me.Hauptdiagramm1.SubFooter.Font.Shadow.Brush.Visible = True Me.Hauptdiagramm1.SubFooter.Font.Size = 8 @@ -1437,7 +1431,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.SubFooter.ImageBevel.Brush.Color = System.Drawing.Color.LightGray + Me.Hauptdiagramm1.SubFooter.ImageBevel.Brush.Color = Color.LightGray Me.Hauptdiagramm1.SubFooter.ImageBevel.Brush.Solid = True Me.Hauptdiagramm1.SubFooter.ImageBevel.Brush.Visible = True ' @@ -1446,7 +1440,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.SubFooter.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.SubFooter.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.SubFooter.Shadow.Brush.Solid = True Me.Hauptdiagramm1.SubFooter.Shadow.Brush.Visible = True ' @@ -1455,13 +1449,13 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.SubHeader.Bevel.ColorOne = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) - Me.Hauptdiagramm1.SubHeader.Bevel.ColorTwo = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) + Me.Hauptdiagramm1.SubHeader.Bevel.ColorOne = Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.Hauptdiagramm1.SubHeader.Bevel.ColorTwo = Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) Me.Hauptdiagramm1.SubHeader.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None ' ' ' - Me.Hauptdiagramm1.SubHeader.Brush.Color = System.Drawing.Color.FromArgb(CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer)) + Me.Hauptdiagramm1.SubHeader.Brush.Color = Color.FromArgb(CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer)) Me.Hauptdiagramm1.SubHeader.Brush.Solid = True Me.Hauptdiagramm1.SubHeader.Brush.Visible = True ' @@ -1471,7 +1465,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.SubHeader.Font.Brush.Color = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) + Me.Hauptdiagramm1.SubHeader.Font.Brush.Color = Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) Me.Hauptdiagramm1.SubHeader.Font.Brush.Solid = True Me.Hauptdiagramm1.SubHeader.Font.Brush.Visible = True ' @@ -1480,7 +1474,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.SubHeader.Font.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.SubHeader.Font.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.SubHeader.Font.Shadow.Brush.Solid = True Me.Hauptdiagramm1.SubHeader.Font.Shadow.Brush.Visible = True Me.Hauptdiagramm1.SubHeader.Font.Size = 12 @@ -1491,7 +1485,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.SubHeader.ImageBevel.Brush.Color = System.Drawing.Color.LightGray + Me.Hauptdiagramm1.SubHeader.ImageBevel.Brush.Color = Color.LightGray Me.Hauptdiagramm1.SubHeader.ImageBevel.Brush.Solid = True Me.Hauptdiagramm1.SubHeader.ImageBevel.Brush.Visible = True ' @@ -1500,7 +1494,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.SubHeader.Shadow.Brush.Color = System.Drawing.Color.FromArgb(CType(CType(169, Byte), Integer), CType(CType(169, Byte), Integer), CType(CType(169, Byte), Integer)) + Me.Hauptdiagramm1.SubHeader.Shadow.Brush.Color = Color.FromArgb(CType(CType(169, Byte), Integer), CType(CType(169, Byte), Integer), CType(CType(169, Byte), Integer)) Me.Hauptdiagramm1.SubHeader.Shadow.Brush.Solid = True Me.Hauptdiagramm1.SubHeader.Shadow.Brush.Visible = True Me.Hauptdiagramm1.TabIndex = 17 @@ -1513,13 +1507,13 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Walls.Back.Bevel.ColorOne = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) - Me.Hauptdiagramm1.Walls.Back.Bevel.ColorTwo = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) + Me.Hauptdiagramm1.Walls.Back.Bevel.ColorOne = Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.Hauptdiagramm1.Walls.Back.Bevel.ColorTwo = Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) Me.Hauptdiagramm1.Walls.Back.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None ' ' ' - Me.Hauptdiagramm1.Walls.Back.Brush.Color = System.Drawing.Color.Silver + Me.Hauptdiagramm1.Walls.Back.Brush.Color = Color.Silver Me.Hauptdiagramm1.Walls.Back.Brush.Solid = True Me.Hauptdiagramm1.Walls.Back.Brush.Visible = False ' @@ -1528,7 +1522,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Walls.Back.ImageBevel.Brush.Color = System.Drawing.Color.LightGray + Me.Hauptdiagramm1.Walls.Back.ImageBevel.Brush.Color = Color.LightGray Me.Hauptdiagramm1.Walls.Back.ImageBevel.Brush.Solid = True Me.Hauptdiagramm1.Walls.Back.ImageBevel.Brush.Visible = True ' @@ -1537,7 +1531,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Walls.Back.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.Walls.Back.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.Walls.Back.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Walls.Back.Shadow.Brush.Visible = True ' @@ -1546,13 +1540,13 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Walls.Bottom.Bevel.ColorOne = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) - Me.Hauptdiagramm1.Walls.Bottom.Bevel.ColorTwo = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) + Me.Hauptdiagramm1.Walls.Bottom.Bevel.ColorOne = Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.Hauptdiagramm1.Walls.Bottom.Bevel.ColorTwo = Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) Me.Hauptdiagramm1.Walls.Bottom.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None ' ' ' - Me.Hauptdiagramm1.Walls.Bottom.Brush.Color = System.Drawing.Color.White + Me.Hauptdiagramm1.Walls.Bottom.Brush.Color = Color.White Me.Hauptdiagramm1.Walls.Bottom.Brush.Solid = True Me.Hauptdiagramm1.Walls.Bottom.Brush.Visible = True ' @@ -1561,7 +1555,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Walls.Bottom.ImageBevel.Brush.Color = System.Drawing.Color.LightGray + Me.Hauptdiagramm1.Walls.Bottom.ImageBevel.Brush.Color = Color.LightGray Me.Hauptdiagramm1.Walls.Bottom.ImageBevel.Brush.Solid = True Me.Hauptdiagramm1.Walls.Bottom.ImageBevel.Brush.Visible = True ' @@ -1570,7 +1564,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Walls.Bottom.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.Walls.Bottom.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.Walls.Bottom.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Walls.Bottom.Shadow.Brush.Visible = True ' @@ -1579,13 +1573,13 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Walls.Left.Bevel.ColorOne = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) - Me.Hauptdiagramm1.Walls.Left.Bevel.ColorTwo = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) + Me.Hauptdiagramm1.Walls.Left.Bevel.ColorOne = Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.Hauptdiagramm1.Walls.Left.Bevel.ColorTwo = Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) Me.Hauptdiagramm1.Walls.Left.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None ' ' ' - Me.Hauptdiagramm1.Walls.Left.Brush.Color = System.Drawing.Color.LightYellow + Me.Hauptdiagramm1.Walls.Left.Brush.Color = Color.LightYellow Me.Hauptdiagramm1.Walls.Left.Brush.Solid = True Me.Hauptdiagramm1.Walls.Left.Brush.Visible = True ' @@ -1594,7 +1588,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Walls.Left.ImageBevel.Brush.Color = System.Drawing.Color.LightGray + Me.Hauptdiagramm1.Walls.Left.ImageBevel.Brush.Color = Color.LightGray Me.Hauptdiagramm1.Walls.Left.ImageBevel.Brush.Solid = True Me.Hauptdiagramm1.Walls.Left.ImageBevel.Brush.Visible = True ' @@ -1603,7 +1597,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Walls.Left.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.Walls.Left.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.Walls.Left.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Walls.Left.Shadow.Brush.Visible = True ' @@ -1612,13 +1606,13 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Walls.Right.Bevel.ColorOne = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) - Me.Hauptdiagramm1.Walls.Right.Bevel.ColorTwo = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) + Me.Hauptdiagramm1.Walls.Right.Bevel.ColorOne = Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.Hauptdiagramm1.Walls.Right.Bevel.ColorTwo = Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer)) Me.Hauptdiagramm1.Walls.Right.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None ' ' ' - Me.Hauptdiagramm1.Walls.Right.Brush.Color = System.Drawing.Color.LightYellow + Me.Hauptdiagramm1.Walls.Right.Brush.Color = Color.LightYellow Me.Hauptdiagramm1.Walls.Right.Brush.Solid = True Me.Hauptdiagramm1.Walls.Right.Brush.Visible = True ' @@ -1627,7 +1621,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Walls.Right.ImageBevel.Brush.Color = System.Drawing.Color.LightGray + Me.Hauptdiagramm1.Walls.Right.ImageBevel.Brush.Color = Color.LightGray Me.Hauptdiagramm1.Walls.Right.ImageBevel.Brush.Solid = True Me.Hauptdiagramm1.Walls.Right.ImageBevel.Brush.Visible = True ' @@ -1636,7 +1630,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Walls.Right.Shadow.Brush.Color = System.Drawing.Color.DarkGray + Me.Hauptdiagramm1.Walls.Right.Shadow.Brush.Color = Color.DarkGray Me.Hauptdiagramm1.Walls.Right.Shadow.Brush.Solid = True Me.Hauptdiagramm1.Walls.Right.Shadow.Brush.Visible = True Me.Hauptdiagramm1.Walls.View3D = False @@ -1646,7 +1640,7 @@ Partial Class Form1 ' ' ' - Me.Hauptdiagramm1.Zoom.Brush.Color = System.Drawing.Color.LightBlue + Me.Hauptdiagramm1.Zoom.Brush.Color = Color.LightBlue Me.Hauptdiagramm1.Zoom.Brush.Solid = True Me.Hauptdiagramm1.Zoom.Brush.Visible = True ' @@ -1713,7 +1707,7 @@ Partial Class Form1 Private WithEvents Label_Methode As System.Windows.Forms.Label Friend WithEvents Button_BrowseDatensatz As System.Windows.Forms.Button Friend WithEvents ComboBox_Datensatz As System.Windows.Forms.ComboBox - Private WithEvents MenuItem_DatensatzZurücksetzen As System.Windows.Forms.ToolStripMenuItem + Private WithEvents MenuItem_DatensatzZurücksetzen As System.Windows.Forms.ToolStripMenuItem Private WithEvents ToolStripMenuItem_About As System.Windows.Forms.ToolStripMenuItem Private WithEvents ToolStripMenuItem_Help As System.Windows.Forms.ToolStripMenuItem Friend WithEvents ToolStrip1 As System.Windows.Forms.ToolStrip @@ -1735,6 +1729,6 @@ Partial Class Form1 Private WithEvents ToolStripButton_Monitor As System.Windows.Forms.ToolStripButton Private WithEvents ToolStripMenuItem_SettingsLoad As System.Windows.Forms.ToolStripMenuItem Friend WithEvents ToolStripButton_SelectedSolutions As System.Windows.Forms.ToolStripButton - Friend WithEvents ReleaseNotesToolStripMenuItem As ToolStripMenuItem + Friend WithEvents ToolStripMenuItem_Changelog As ToolStripMenuItem Friend WithEvents ToolStripButton_CustomPlot As ToolStripButton End Class diff --git a/BlueM.Opt/Main/Form1.resX b/BlueM.Opt/Main/Form1.resX index a5366971..b3c5d69c 100644 --- a/BlueM.Opt/Main/Form1.resX +++ b/BlueM.Opt/Main/Form1.resX @@ -164,13 +164,13 @@ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGwSURBVDhPYxgQ8NXbt+CTq+uDz/ZOBVAh0sBHZ5fHf2ZO - ///J3O4hVIh48D80lO2zrf3dT+aW7z8aWZDugk/Wjr0fTW12AQ1ihgrhBi71Fwscqs89dKo6Bbbpk7Vd - 4AdjmyefDGxEwQpA4FdW+vrvyYm/fyUnrocKwYFzzeknczZe+F8wf+//yIxVZ1+YOH7rCaxpNs/a1maa - tuGBUdraAobvSYm//23d9P9rZOTfX5GRZlC9DC61p+xtK49+sCk69MYtf1f1M1PH22tckreZZm9ZbZCy - 9nfPwgP/deNWPGD4mZiw/mtMzO9v4eGXPgcG3vvm63tyRVzTIvviYw9tSg/Zgwz7aGwx84Oe6UawyUBg - lLK2wCBp5SPd+MWogRhaf4WtP3ny7jOecZ/e2Dq9em9ife2Nnsmf95omX98pGfNDlWEH9vUnJRyqTh2z - Lz2y1KLwGOd7UyuDN4bmf/9Nm/L/lbr2H6gyTOBSe77AuerMc6B/3wA1l0KFweCttuH6V0pav98qamME - MBw4lZ98MHnNxf92ZQdeQoVIA/YVxwpsSw8+sC7cT166HmDAwAAA59q+iZSjxgMAAAAASUVORK5CYII= + ///J3O4hVIh48D80lO2zrf3dT+YW7z8aWZDugk/Wjr0fTW12AQ1ihgrhBi71Fwvsq889dKo6Bbbpk7Vd + 4AdjmyefDGxEwQpA4FdW+vpvSQm/fyUnrocKwYFzzeknczZe+F8wf+//yIxVZ18YO37rCaxpNs/a1maa + tuGBUdraAoZviQm//23d9P9LRMTfX5GRZlC9DC61p+xtKo98sCk69MYtf1f1M1PH22tckreZZm9ZrZ+8 + 5nfPwgP/deNWPGD4mZiw/ktMzO9v4eGXPgcG3vvm63tyRVzTIvuiYw9tSg/Zgwz7aGwx84Oe6UawyUBg + lLK2wCBp5SPd+MWogRhaf4WtP3ny7jMesZ/e2Dq9em9ife21rvGf9xomX98pGfNDlWEH9vUnJRyqTh2z + Lz2y1KLwGOd7UyuD14bmf/9Nm/L/pbrWH6gyTOBSe77AuerMc6B/3wA1l0KFweCttuH6l4qav98qamME + MBw4lZ98MHnNxf92ZftfQoVIA/YVxwpsSw8+sC7cT166HmDAwAAApzK+Z4emFvoAAAAASUVORK5CYII= diff --git a/BlueM.Opt/Main/Form1.vb b/BlueM.Opt/Main/Form1.vb index afc46a26..0b8059c6 100644 --- a/BlueM.Opt/Main/Form1.vb +++ b/BlueM.Opt/Main/Form1.vb @@ -15,10 +15,8 @@ 'You should have received a copy of the GNU General Public License 'along with this program. If not, see . ' -Imports System.Xml -Imports System.Xml.Serialization -Imports BlueM.Opt.Common.Constants - +Imports System.Windows.Forms +Imports BlueM.Opt.Common ''' ''' Main Window ''' @@ -27,19 +25,19 @@ Partial Public Class Form1 #Region "Eigenschaften" - Private IsInitializing As Boolean 'Gibt an, ob das Formular bereits fertig geladen wurde(beim Laden werden sämtliche Events ausgelöst) + Private IsInitializing As Boolean 'Gibt an, ob das Formular bereits fertig geladen wurde(beim Laden werden sämtliche Events ausgelöst) 'Anwendung Private Anwendung As String 'Problem - Public mProblem As BlueM.Opt.Common.Problem + Public mProblem As Problem 'Settings - Private mSettings As BlueM.Opt.Common.Settings + Private mSettings As Settings 'Progress - Private mProgress As BlueM.Opt.Common.Progress + Private mProgress As Progress 'Apps Private Testprobleme1 As BlueM.Opt.Apps.Testprobleme @@ -54,7 +52,7 @@ Partial Public Class Form1 Dim _ispause As Boolean = False ''' - ''' Optimierung läuft + ''' Optimierung läuft ''' Private Property isRun() As Boolean Get @@ -108,19 +106,19 @@ Partial Public Class Form1 '*********** Private Sub Form1_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load 'XP-look - System.Windows.Forms.Application.EnableVisualStyles() + Application.EnableVisualStyles() 'Monitor zuweisen Me.Monitor1 = BlueM.Opt.Diagramm.Monitor.getInstance() 'Monitor zentrieren Me.Monitor1.Location = New Drawing.Point(Me.Location.X + Me.Width / 2 - Me.Monitor1.Width / 2, Me.Location.Y + Me.Height / 2 - Me.Monitor1.Height / 2) 'Add handler for log messages - AddHandler BlueM.Opt.Common.Log.LogMessageAdded, AddressOf Monitor1.LogAppend + AddHandler Log.LogMessageAdded, AddressOf Monitor1.LogAppend 'Formular initialisieren Call Me.INI() - 'Handler für Klick auf Serien zuweisen + 'Handler für Klick auf Serien zuweisen AddHandler Me.Hauptdiagramm1.ClickSeries, AddressOf seriesClick 'Ende der Initialisierung @@ -129,23 +127,23 @@ Partial Public Class Form1 End Sub ''' - ''' Formular zurücksetzen + ''' Formular zurücksetzen ''' Public Sub INI() Me.IsInitializing = True 'clear the log - BlueM.Opt.Common.Log.Reset() + Log.Reset() 'Anwendungs-Groupbox aktivieren Me.GroupBox_Anwendung.Enabled = True 'Anwendung '--------- - 'Liste der Anwendungen in ComboBox schreiben und Anfangseinstellung wählen + 'Liste der Anwendungen in ComboBox schreiben und Anfangseinstellung wählen Me.ComboBox_Anwendung.Items.Clear() - Me.ComboBox_Anwendung.Items.AddRange(New Object() {"", ANW_BLUEM, ANW_SWMM, ANW_TALSIM, ANW_TALSIM5, ANW_TESTPROBLEMS, ANW_TSP}) 'ANW_SMUSI entfernt (#184) + Me.ComboBox_Anwendung.Items.AddRange(New Object() {"", ANW_BLUEM, ANW_TALSIM, ANW_TALSIM5, ANW_TESTPROBLEMS, ANW_TSP}) Me.ComboBox_Anwendung.SelectedIndex = 0 'Datensatz @@ -159,21 +157,21 @@ Partial Public Class Form1 Me.Label_Methode.Enabled = False Me.ComboBox_Methode.Enabled = False - 'Liste der Methoden in ComboBox schreiben und Anfangseinstellung wählen + 'Liste der Methoden in ComboBox schreiben und Anfangseinstellung wählen Me.ComboBox_Methode.Items.Clear() Me.ComboBox_Methode.Items.AddRange(New Object() {"", METH_PES, METH_METAEVO, METH_SENSIPLOT, METH_HOOKEJEEVES, METH_DDS}) Me.ComboBox_Methode.SelectedIndex = 0 'Einstellungen - Me.mSettings = New Common.Settings() - Me.EVO_Einstellungen1.Reset() 'für Neustart wichtig + Me.mSettings = New Settings() + Me.EVO_Einstellungen1.Reset() 'für Neustart wichtig Me.EVO_Einstellungen1.setSettings(Me.mSettings) - 'Monitor zurücksetzen + 'Monitor zurücksetzen Me.Monitor1.Reset() - 'Progress instanzieren und an EVO_Opt_Verlauf übergeben - Me.mProgress = New BlueM.Opt.Common.Progress() + 'Progress instanzieren und an EVO_Opt_Verlauf übergeben + Me.mProgress = New Progress() Me.EVO_Opt_Verlauf1.Initialisieren(Me.mProgress) 'Toolbar-Buttons deaktivieren @@ -224,7 +222,7 @@ Partial Public Class Form1 Private Sub Button_New_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton_New.Click 'Controller stoppen If (Me.STOPPEN()) Then - 'Formular zurücksetzen + 'Formular zurücksetzen Call Me.INI() End If End Sub @@ -241,7 +239,7 @@ Partial Public Class Form1 End Sub - 'Wenn Monitor geöffnet/geschlossen wird, ButtonState aktualisieren + 'Wenn Monitor geöffnet/geschlossen wird, ButtonState aktualisieren '***************************************************************** Private Sub MonitorOpenClose() Handles Monitor1.MonitorClosed, Monitor1.MonitorOpened Me.ToolStripButton_Monitor.Checked = Me.Monitor1.Visible @@ -258,14 +256,14 @@ Partial Public Class Form1 End Sub ''' - ''' Handles Release notes menu item clicked + ''' Handles Changelog menu item clicked ''' Opens the release notes ''' ''' ''' - Private Sub ReleaseNotesToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ReleaseNotesToolStripMenuItem.Click + Private Sub ToolStripMenuItem_Changelog_Click(sender As Object, e As EventArgs) Handles ToolStripMenuItem_Changelog.Click Dim filepath As String - filepath = IO.Path.Combine(Application.StartupPath, "BLUEM.OPT_RELEASE-NOTES.txt") + filepath = IO.Path.Combine(Application.StartupPath, "CHANGELOG.md") Try System.Diagnostics.Process.Start(filepath) Catch ex As Exception @@ -281,7 +279,7 @@ Partial Public Class Form1 Call about.ShowDialog(Me) End Sub - 'Einstellungen-Button hat selbst keine funktionalität -> nur DropDown + 'Einstellungen-Button hat selbst keine funktionalität -> nur DropDown '******************************************************************** Private Sub Button_Einstellungen_ButtonClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripSplitButton_Settings.ButtonClick Call Me.ToolStripSplitButton_Settings.ShowDropDown() @@ -324,14 +322,14 @@ Partial Public Class Form1 Public Sub loadSettings(ByVal filename As String) 'read settings from file - Dim settings As Common.Settings = Common.Settings.Load(filename) + Dim settings As Settings = Settings.Load(filename) 'Checks: PES OptMode has to be identical If settings.PES.OptModus <> Me.mSettings.PES.OptModus Then Throw New Exception("The loaded settings use a different optimization mode (single-/multiobjective) and are not compatible!") End If - 'Geladene Settings überall neu setzen + 'Geladene Settings überall neu setzen Me.mSettings = settings Me.EVO_Einstellungen1.setSettings(Me.mSettings) Me.Hauptdiagramm1.setSettings(Me.mSettings) @@ -345,10 +343,10 @@ Partial Public Class Form1 #Region "Initialisierung der Anwendungen" - 'Die Anwendung wurde ausgewählt und wird jetzt initialisiert + 'Die Anwendung wurde ausgewählt und wird jetzt initialisiert 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - 'Anwendung wurde ausgewählt + 'Anwendung wurde ausgewählt '************************** Private Sub Combo_App_Changed(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox_Anwendung.SelectedIndexChanged If (Not Me.IsInitializing) Then @@ -368,20 +366,20 @@ Partial Public Class Form1 Me.ComboBox_Anwendung.SelectedItem = selectedAnwendung Me.IsInitializing = False - 'Diagramm zurücksetzen + 'Diagramm zurücksetzen Call Me.Hauptdiagramm1.Reset() 'Alles deaktivieren, danach je nach Anwendung aktivieren '------------------------------------------------------- - 'Sim1 zerstören + 'Sim1 zerstören Me.Sim1 = Nothing 'Start Button deaktivieren Me.Button_Start.Enabled = False 'Datensatz-Reset deaktivieren - Me.MenuItem_DatensatzZurücksetzen.Enabled = False + Me.MenuItem_DatensatzZurücksetzen.Enabled = False 'Methodenauswahl deaktivieren Me.Label_Methode.Enabled = False @@ -394,18 +392,18 @@ Partial Public Class Form1 Me.ToolStripButton_SelectedSolutions.Enabled = False Me.ToolStripMenuItem_ErgebnisDBCompare.Enabled = False - 'Multithreading standardmäßig verbieten + 'Multithreading standardmäßig verbieten Me.mSettings.General.MultithreadingAllowed = False 'Mauszeiger busy Cursor = Cursors.WaitCursor - 'Ausgewählte Anwendung speichern + 'Ausgewählte Anwendung speichern Me.Anwendung = selectedAnwendung Select Case Me.Anwendung - Case "" 'Keine Anwendung ausgewählt + Case "" 'Keine Anwendung ausgewählt 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 'nix @@ -417,13 +415,6 @@ Partial Public Class Form1 Sim1 = New BlueM.Opt.Apps.BlueMSim() - Case ANW_SMUSI 'Anwendung Smusi - 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - - 'Objekt der Klasse Smusi initialisieren - 'Sim1 = New BlueM.Opt.Apps.Smusi() - - Case ANW_TALSIM 'Anwendung TALSIM 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx @@ -438,13 +429,6 @@ Partial Public Class Form1 Sim1 = New BlueM.Opt.Apps.Talsim5() - Case ANW_SWMM 'Anwendung SWMM - 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - - 'Objekt der Klasse SWMM initialisieren - Sim1 = New BlueM.Opt.Apps.SWMM() - - Case ANW_TESTPROBLEMS 'Anwendung Testprobleme 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx @@ -461,7 +445,7 @@ Partial Public Class Form1 Case ANW_TSP 'Anwendung Traveling Salesman Problem (TSP) 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - 'HACK: bei TSP Datensatz und Methode nicht notwendig, Abkürzung: + 'HACK: bei TSP Datensatz und Methode nicht notwendig, Abkürzung: 'Start-Button aktivieren (keine Methodenauswahl erforderlich) 'HACK: bei Testproblemen als Methodenauswahl nur PES, H&J, MetaEVO und DDS zulassen! Me.IsInitializing = True @@ -476,7 +460,7 @@ Partial Public Class Form1 'Bei Sim-Anwendungen If (Not IsNothing(Me.Sim1)) Then - 'Settings an Sim1 übergeben + 'Settings an Sim1 übergeben Call Me.Sim1.setSettings(Me.mSettings) 'ggf. Multithreading-Option aktivieren @@ -488,22 +472,22 @@ Partial Public Class Form1 'Datensatz UI aktivieren Call Me.Datensatz_initUI() - 'Progress zurücksetzen + 'Progress zurücksetzen Call Me.mProgress.Initialize() 'log - Common.Log.AddMessage(Common.Log.levels.info, $"Set application to {Me.Anwendung}") + Log.AddMessage(Log.levels.info, $"Set application to {Me.Anwendung}") Catch ex As Exception - MsgBox("Error while initializing the application:" & eol & ex.Message, MsgBoxStyle.Critical) + MsgBox("Error while initializing the application:" & Constants.eol & ex.Message, MsgBoxStyle.Critical) Me.IsInitializing = True Me.ComboBox_Anwendung.SelectedIndex = 0 Me.IsInitializing = False End Try - 'wegen verändertem Setting MultithreadingAllowed + 'wegen verändertem Setting MultithreadingAllowed Call Me.EVO_Einstellungen1.refreshForm() 'Mauszeiger wieder normal @@ -519,10 +503,10 @@ Partial Public Class Form1 Me.Label_Datensatz.Enabled = True Me.ComboBox_Datensatz.Enabled = True - 'Tooltip zurücksetzen + 'Tooltip zurücksetzen Me.ToolTip1.SetToolTip(Me.ComboBox_Datensatz, "") - 'Combo_Datensatz auffüllen + 'Combo_Datensatz auffüllen Call Me.Datensatz_populateCombo() Select Case Me.Anwendung @@ -555,21 +539,21 @@ Partial Public Class Form1 End Sub - 'Combo_Datensatz auffüllen + 'Combo_Datensatz auffüllen '************************* Private Sub Datensatz_populateCombo() Dim i As Integer Dim pfad As String - 'vorherige Einträge löschen + 'vorherige Einträge löschen Me.ComboBox_Datensatz.Items.Clear() Select Case Me.Anwendung Case ANW_TESTPROBLEMS - 'Mit Testproblemen füllen + 'Mit Testproblemen füllen Me.ComboBox_Datensatz.Items.AddRange(Testprobleme1.Testprobleme.ToArray()) Case ANW_TSP @@ -578,14 +562,14 @@ Partial Public Class Form1 Case Else '(Sim-Anwendungen) - 'Mit Benutzer-MRUSimDatensätze füllen + 'Mit Benutzer-MRUSimDatensätze füllen Try If (My.Settings.MRUSimDatensaetze.Count > 0) Then - 'Combobox rückwärts füllen + 'Combobox rückwärts füllen For i = My.Settings.MRUSimDatensaetze.Count - 1 To 0 Step -1 - 'nur existierende, zur Anwendung passende Datensätze anzeigen + 'nur existierende, zur Anwendung passende Datensätze anzeigen pfad = My.Settings.MRUSimDatensaetze(i) If (IO.File.Exists(pfad) _ And IO.Path.GetExtension(pfad).ToUpper() = Me.Sim1.DatensatzExtension) Then @@ -603,7 +587,7 @@ Partial Public Class Form1 End Sub - 'Arbeitsverzeichnis/Datensatz auswählen (nur Sim-Anwendungen) + 'Arbeitsverzeichnis/Datensatz auswählen (nur Sim-Anwendungen) '************************************************************ Private Sub Datensatz_browse(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_BrowseDatensatz.Click @@ -620,7 +604,7 @@ Partial Public Class Form1 OpenFileDialog1.FileName = IO.Path.Combine(Sim1.WorkDir_Original, Sim1.Datensatz & "." & Sim1.DatensatzDateiendungen(0)) End If - 'Dialog öffnen + 'Dialog öffnen DiagResult = OpenFileDialog1.ShowDialog() 'Neuen Datensatz speichern @@ -631,17 +615,17 @@ Partial Public Class Form1 'Datensatz setzen Call Me.INI_Datensatz(pfad) - 'Methodenauswahl wieder zurücksetzen - '(Der Benutzer muss zuerst Ini neu ausführen!) + 'Methodenauswahl wieder zurücksetzen + '(Der Benutzer muss zuerst Ini neu ausführen!) Me.ComboBox_Methode.SelectedItem = "" End If End Sub - 'Sim-Datensatz zurücksetzen + 'Sim-Datensatz zurücksetzen '************************** - Private Sub Datensatz_reset(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem_DatensatzZurücksetzen.Click + Private Sub Datensatz_reset(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem_DatensatzZurücksetzen.Click Call Sim1.resetDatensatz() @@ -649,7 +633,7 @@ Partial Public Class Form1 End Sub - 'Datensatz wurde ausgewählt + 'Datensatz wurde ausgewählt '************************** Private Sub Combo_Datensatz_Changed(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox_Datensatz.SelectedIndexChanged If (Not Me.IsInitializing) Then @@ -665,16 +649,16 @@ Partial Public Class Form1 Try - 'Zurücksetzen + 'Zurücksetzen '------------ 'Tooltip Me.ToolTip1.SetToolTip(Me.ComboBox_Datensatz, "") 'Datensatz-Reset - Me.MenuItem_DatensatzZurücksetzen.Enabled = False + Me.MenuItem_DatensatzZurücksetzen.Enabled = False - 'gewählten Datensatz an Anwendung übergeben + 'gewählten Datensatz an Anwendung übergeben '------------------------------------------ Select Case Me.Anwendung @@ -717,7 +701,7 @@ Partial Public Class Form1 End Select - 'Methodenauswahl aktivieren und zurücksetzen + 'Methodenauswahl aktivieren und zurücksetzen '------------------------------------------- Me.Label_Methode.Enabled = True Me.ComboBox_Methode.Enabled = True @@ -725,11 +709,11 @@ Partial Public Class Form1 Me.ComboBox_Methode.SelectedItem = "" Me.IsInitializing = False - 'Progress zurücksetzen + 'Progress zurücksetzen Call Me.mProgress.Initialize() 'log - Common.Log.AddMessage(Common.Log.levels.info, $"Set dataset to {selectedDatensatz}") + Log.AddMessage(Log.levels.info, $"Set dataset to {selectedDatensatz}") Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical) @@ -737,7 +721,7 @@ Partial Public Class Form1 End Sub - 'Methode wurde ausgewählt + 'Methode wurde ausgewählt '************************ Private Sub Combo_Method_Changed(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox_Methode.SelectedIndexChanged If (Not Me.IsInitializing) Then @@ -765,10 +749,10 @@ Partial Public Class Form1 Call Me.INI_Problem(selectedMethod) 'Methodenspezifische Vorbereitungen - '(zunächst alles deaktivieren, danach je nach Methode aktivieren) + '(zunächst alles deaktivieren, danach je nach Methode aktivieren) '================================================================ - 'Diagramm zurücksetzen + 'Diagramm zurücksetzen Me.Hauptdiagramm1.Reset() 'Start Button deaktivieren @@ -812,7 +796,7 @@ Partial Public Class Form1 Case METH_HOOKEJEEVES 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - 'Kontrolle: Nur SO möglich! + 'Kontrolle: Nur SO möglich! If (Me.mProblem.Modus = EVO_MODE.Multi_Objective) Then Throw New Exception("The method Hooke and Jeeves is only usable for single-objective optimization problems!") End If @@ -829,7 +813,7 @@ Partial Public Class Form1 Case METH_DDS 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - 'Kontrolle: Nur SO möglich! + 'Kontrolle: Nur SO möglich! If (Me.mProblem.Modus = EVO_MODE.Multi_Objective) Then Throw New Exception("The method DDS is only usable for single-objective optimization problems!") End If @@ -876,17 +860,17 @@ Partial Public Class Form1 If (Me.Anwendung <> ANW_TESTPROBLEMS) Then 'Datensatz-Reset aktivieren - Me.MenuItem_DatensatzZurücksetzen.Enabled = True + Me.MenuItem_DatensatzZurücksetzen.Enabled = True End If - 'Multithreading-Option (de)aktivieren (Kombination ist maßgebend!) + 'Multithreading-Option (de)aktivieren (Kombination ist maßgebend!) Me.mSettings.General.MultithreadingAllowed = (Me.mSettings.General.MultithreadingAllowed And Me.controller.MultithreadingSupported) Call Me.EVO_Einstellungen1.refreshForm() Catch ex As Exception - MsgBox("Error while setting the method:" & eol & ex.Message, MsgBoxStyle.Critical) - 'Combobox zurücksetzen + MsgBox("Error while setting the method:" & Constants.eol & ex.Message, MsgBoxStyle.Critical) + 'Combobox zurücksetzen Me.IsInitializing = True Me.ComboBox_Methode.SelectedIndex = 0 Me.IsInitializing = False @@ -899,31 +883,31 @@ Partial Public Class Form1 End Sub ''' - ''' Problem initialisieren und überall bekannt machen + ''' Problem initialisieren und überall bekannt machen ''' - ''' gewählte Methode + ''' gewählte Methode Private Sub INI_Problem(ByVal Method As String) - 'Neues Problem mit ausgewählter Methode instanzieren - Me.mProblem = New BlueM.Opt.Common.Problem(Method) + 'Neues Problem mit ausgewählter Methode instanzieren + Me.mProblem = New Problem(Method) 'Problemdefinition '================= Select Case Me.Anwendung - Case ANW_BLUEM, ANW_SMUSI, ANW_SWMM, ANW_TALSIM, ANW_TALSIM5 + Case ANW_BLUEM, ANW_TALSIM, ANW_TALSIM5 'Bei allen Sim-Anwendungen '----------------------------------------------------- - 'WorkDir und Datensatz übergeben + 'WorkDir und Datensatz übergeben Me.mProblem.WorkDir = Sim1.WorkDir_Original Me.mProblem.Datensatz = Sim1.Datensatz 'EVO-Eingabedateien einlesen Call Me.mProblem.Read_InputFiles(Me.Sim1.SimStart, Me.Sim1.SimEnde) - 'Problem an Sim-Objekt übergeben + 'Problem an Sim-Objekt übergeben Call Me.Sim1.setProblem(Me.mProblem) @@ -940,21 +924,21 @@ Partial Public Class Form1 End Select - 'Problem an EVO_Einstellungen übergeben + 'Problem an EVO_Einstellungen übergeben '-------------------------------------- Call Me.EVO_Einstellungen1.setProblem(Me.mProblem) 'Individuumsklasse mit Problem initialisieren '-------------------------------------------- - Call BlueM.Opt.Common.Individuum.Initialise(Me.mProblem) + Call Individuum.Initialise(Me.mProblem) 'Problembeschreibung in Log schreiben '------------------------------------ - Common.Log.AddMessage(Common.Log.levels.info, $"Set method to {Me.mProblem.Method}") + Log.AddMessage(Log.levels.info, $"Set method to {Me.mProblem.Method}") Dim msg As String - msg = "Optimization problem loaded:" & eol + msg = "Optimization problem loaded:" & Constants.eol msg &= Me.mProblem.Description() - Common.Log.AddMessage(Common.Log.levels.info, msg) + Log.AddMessage(Log.levels.info, msg) Me.Monitor1.SelectTabLog() Me.Monitor1.Show() @@ -990,13 +974,13 @@ Partial Public Class Form1 'Stoppuhr Dim AllOptTime As New Stopwatch - Common.Log.AddMessage(Common.Log.levels.info, "Starting optimization...") + Log.AddMessage(Log.levels.info, "Starting optimization...") Call StarteDurchlauf(AllOptTime) MsgBox("Optimization ended!", MsgBoxStyle.Information, "BlueM.Opt") - Common.Log.AddMessage(Common.Log.levels.info, $"The optimization took {AllOptTime.Elapsed.Days}d {AllOptTime.Elapsed.Hours}h {AllOptTime.Elapsed.Minutes}m {AllOptTime.Elapsed.Seconds}s {AllOptTime.Elapsed.Milliseconds}ms") + Log.AddMessage(Log.levels.info, $"The optimization took {AllOptTime.Elapsed.Days}d {AllOptTime.Elapsed.Hours}h {AllOptTime.Elapsed.Minutes}m {AllOptTime.Elapsed.Seconds}s {AllOptTime.Elapsed.Milliseconds}ms") End Sub @@ -1036,7 +1020,7 @@ Partial Public Class Form1 'Settings deaktivieren Call Me.EVO_Einstellungen1.freeze() - 'Settings an Hauptdiagramm übergeben + 'Settings an Hauptdiagramm übergeben Call Me.Hauptdiagramm1.setSettings(Me.mSettings) 'Diagramm vorbereiten und initialisieren @@ -1044,7 +1028,7 @@ Partial Public Class Form1 Select Case Anwendung - Case ANW_BLUEM, ANW_SMUSI, ANW_SWMM, ANW_TALSIM, ANW_TALSIM5 + Case ANW_BLUEM, ANW_TALSIM, ANW_TALSIM5 'Sim-Anwendungen 'Save settings to file @@ -1053,7 +1037,7 @@ Partial Public Class Form1 'Set log file Dim logfilename As String = IO.Path.Combine(Me.mProblem.WorkDir, $"{Me.mProblem.Datensatz}.BlueM.Opt.{starttime:yyyyMMddHHmm}.log") - BlueM.Opt.Common.Log.SetLogFile(logfilename) + Log.SetLogFile(logfilename) 'Prepare OptResult (database) Call Me.Sim1.PrepareOptResult(starttime) @@ -1070,7 +1054,7 @@ Partial Public Class Form1 End If End If - 'Controller für Sim initialisieren und starten + 'Controller für Sim initialisieren und starten Call controller.Init(Me.mProblem, Me.mSettings, Me.mProgress, Me.Hauptdiagramm1) Call controller.InitApp(Me.Sim1) Call controller.Start() @@ -1078,7 +1062,7 @@ Partial Public Class Form1 Case ANW_TESTPROBLEMS 'Testprobleme - 'Controller für Testproblem initialisieren und starten + 'Controller für Testproblem initialisieren und starten Call controller.Init(Me.mProblem, Me.mSettings, Me.mProgress, Me.Hauptdiagramm1) Call controller.InitApp(Me.Testprobleme1) Call controller.Start() @@ -1086,17 +1070,17 @@ Partial Public Class Form1 Case ANW_TSP 'Traveling Salesman - 'Controller für TSP initialisieren und starten + 'Controller für TSP initialisieren und starten Call controller.Init(Me.mProblem, Me.mSettings, Me.mProgress, Me.Hauptdiagramm1) - 'Call controller.InitApp() bei TSP nicht benötigt + 'Call controller.InitApp() bei TSP nicht benötigt Call controller.Start() End Select Catch ex As Exception - 'Globale Fehlerbehandlung für Optimierungslauf: - Common.Log.AddMessage(Common.Log.levels.error, ex.Message) + 'Globale Fehlerbehandlung für Optimierungslauf: + Log.AddMessage(Log.levels.error, ex.Message) MsgBox(ex.Message, MsgBoxStyle.Critical, "Error") Finally @@ -1119,7 +1103,7 @@ Partial Public Class Form1 ''' Private Sub PAUSE() - 'nur wenn Optimierung läuft + 'nur wenn Optimierung läuft If (Me.isRun) Then If (Not Me.isPause) Then @@ -1135,7 +1119,7 @@ Partial Public Class Form1 'Pausen Magic :-) Do While (Me.isPause) - System.Threading.Thread.Sleep(20) + Threading.Thread.Sleep(20) Application.DoEvents() Loop @@ -1176,7 +1160,7 @@ Partial Public Class Form1 res = MsgBox("Are you sure you want to abort the optimization?", MsgBoxStyle.YesNo) If (res = MsgBoxResult.Yes) Then - 'Pause ausschalten, sonst läuft die immer weiter + 'Pause ausschalten, sonst läuft die immer weiter Me.isPause = False 'Controller stoppen Call Me.controller.Stoppen() @@ -1204,7 +1188,7 @@ Partial Public Class Form1 'Diagrammfunktionen '################### - 'Diagramm-Button hat selbst keine funktionalität -> nur DropDown + 'Diagramm-Button hat selbst keine funktionalität -> nur DropDown '*************************************************************** Private Sub Button_Diagramm_ButtonClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripSplitButton_Diagramm.ButtonClick Call Me.ToolStripSplitButton_Diagramm.ShowDropDown() @@ -1222,7 +1206,7 @@ Partial Public Class Form1 SaveFileDialog1.DefaultExt = Me.Hauptdiagramm1.Export.Data.Excel.FileExtension SaveFileDialog1.FileName = Me.Hauptdiagramm1.Name + "." + SaveFileDialog1.DefaultExt SaveFileDialog1.Filter = "Excel files (*.xls)|*.xls" - If (Me.SaveFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK) Then + If (Me.SaveFileDialog1.ShowDialog() = DialogResult.OK) Then Me.Hauptdiagramm1.Export.Data.Excel.Series = Nothing 'export all series Me.Hauptdiagramm1.Export.Data.Excel.IncludeLabels = True Me.Hauptdiagramm1.Export.Data.Excel.IncludeIndex = True @@ -1238,7 +1222,7 @@ Partial Public Class Form1 SaveFileDialog1.DefaultExt = Me.Hauptdiagramm1.Export.Image.PNG.FileExtension SaveFileDialog1.FileName = Me.Hauptdiagramm1.Name + "." + SaveFileDialog1.DefaultExt SaveFileDialog1.Filter = "PNG files (*.png)|*.png" - If (Me.SaveFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK) Then + If (Me.SaveFileDialog1.ShowDialog() = DialogResult.OK) Then Me.Hauptdiagramm1.Export.Image.PNG.GrayScale = False Me.Hauptdiagramm1.Export.Image.PNG.Save(Me.SaveFileDialog1.FileName) End If @@ -1250,7 +1234,7 @@ Partial Public Class Form1 SaveFileDialog1.DefaultExt = Me.Hauptdiagramm1.Export.Template.FileExtension SaveFileDialog1.FileName = Me.Hauptdiagramm1.Name + "." + SaveFileDialog1.DefaultExt SaveFileDialog1.Filter = "TeeChart files (*.ten)|*.ten" - If (Me.SaveFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK) Then + If (Me.SaveFileDialog1.ShowDialog() = DialogResult.OK) Then Me.Hauptdiagramm1.Export.Template.IncludeData = True Me.Hauptdiagramm1.Export.Template.Save(Me.SaveFileDialog1.FileName) End If @@ -1265,7 +1249,7 @@ Partial Public Class Form1 Dim Achsen As New Collection ReDim tmpZielindex(2) 'Maximal 3 Achsen - 'Zunächst keine Achsenzuordnung (-1) + 'Zunächst keine Achsenzuordnung (-1) For i = 0 To tmpZielindex.GetUpperBound(0) tmpZielindex(i) = -1 Next @@ -1279,7 +1263,7 @@ Partial Public Class Form1 Call Testprobleme1.DiagInitialise(Me.Hauptdiagramm1) - Case ANW_BLUEM, ANW_SMUSI, ANW_SWMM, ANW_TALSIM, ANW_TALSIM5 + Case ANW_BLUEM, ANW_TALSIM, ANW_TALSIM5 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Select Case Me.mProblem.Method @@ -1405,7 +1389,7 @@ Partial Public Class Form1 'Multi-Objective '=============== - 'für jedes OptZiel eine Achse hinzufügen + 'für jedes OptZiel eine Achse hinzufügen j = 0 For i = 0 To Me.mProblem.NumObjectives - 1 If (Me.mProblem.List_ObjectiveFunctions(i).isPrimObjective) Then @@ -1427,7 +1411,7 @@ Partial Public Class Form1 'Warnung bei mehr als 3 OptZielen If (Me.mProblem.NumPrimObjective > 3) Then - MsgBox("The number of primary objectives is more than 3!" & eol _ + MsgBox("The number of primary objectives is more than 3!" & Constants.eol _ & "Only the first three primary objectives will be displayed in the main chart!", MsgBoxStyle.Information) End If @@ -1461,7 +1445,7 @@ Partial Public Class Form1 Me.scatterplot2 = New BlueM.Opt.Diagramm.Scatterplot(Me.mProblem, Sim1.OptResult, Sim1.OptResultRef) Else Cursor = Cursors.Default - MsgBox($"There are already two scatterplot matrices open!{eol}Please close at least one of them first!", MsgBoxStyle.Information) + MsgBox($"There are already two scatterplot matrices open!{Constants.eol}Please close at least one of them first!", MsgBoxStyle.Information) End If Cursor = Cursors.Default @@ -1489,7 +1473,7 @@ Partial Public Class Form1 End Sub -#Region "Lösungsauswahl" +#Region "Lösungsauswahl" ''' ''' Button to show selected Solutions clicked @@ -1498,12 +1482,12 @@ Partial Public Class Form1 ''' ''' Private Sub ToolStripButton_SelectedSolutions_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton_SelectedSolutions.Click - 'Lösungsdialog initialisieren + 'Lösungsdialog initialisieren If (IsNothing(Me.solutionDialog)) Then Me.solutionDialog = New SolutionDialog(Me.mProblem) End If - 'Lösungsdialog anzeigen + 'Lösungsdialog anzeigen Call Me.solutionDialog.Show() Call Me.solutionDialog.BringToFront() End Sub @@ -1513,7 +1497,7 @@ Partial Public Class Form1 '*************************** Public Sub seriesClick(ByVal sender As Object, ByVal s As Steema.TeeChart.Styles.Series, ByVal valueIndex As Integer, ByVal e As System.Windows.Forms.MouseEventArgs) - 'Notwendige Bedingungen überprüfen + 'Notwendige Bedingungen überprüfen '--------------------------------- If (IsNothing(Sim1)) Then 'Anwendung != Sim @@ -1522,21 +1506,21 @@ Partial Public Class Form1 Else Dim indID_clicked As Integer - Dim ind As Common.Individuum + Dim ind As Individuum Try 'Solution-ID indID_clicked = s.Labels(valueIndex) - 'Lösung holen + 'Lösung holen ind = Sim1.OptResult.getSolution(indID_clicked) - 'Lösung auswählen + 'Lösung auswählen Call Me.selectSolution(ind) Catch ex As Exception - Common.Log.AddMessage(Common.Log.levels.error, ex.Message) - MsgBox($"Solution is not selectable!{Common.Constants.eol}{ex.Message}", MsgBoxStyle.Information) + Log.AddMessage(Log.levels.error, ex.Message) + MsgBox($"Solution is not selectable!{Constants.eol}{ex.Message}", MsgBoxStyle.Information) End Try End If @@ -1548,7 +1532,7 @@ Partial Public Class Form1 ''' ''' the solution ID to select Private Overloads Sub selectSolution(id As Integer) Handles solutionDialog.SelectedSolutionsIDRequested - Dim ind As Common.Individuum + Dim ind As Individuum Try ind = Sim1.OptResult.getSolution(id) Call Me.selectSolution(ind) @@ -1561,30 +1545,30 @@ Partial Public Class Form1 ''' Selects a solution ''' ''' the individual to select - Private Overloads Sub selectSolution(ByVal ind As Common.Individuum) Handles scatterplot1.pointSelected, scatterplot2.pointSelected, customPlot.pointSelected + Private Overloads Sub selectSolution(ByVal ind As Individuum) Handles scatterplot1.pointSelected, scatterplot2.pointSelected, customPlot.pointSelected Dim isOK As Boolean - 'Lösung zu ausgewählten Lösungen hinzufügen + 'Lösung zu ausgewählten Lösungen hinzufügen isOK = Sim1.OptResult.selectSolution(ind.ID) If (isOK) Then - 'Lösungsdialog initialisieren + 'Lösungsdialog initialisieren If (IsNothing(Me.solutionDialog)) Then Me.solutionDialog = New SolutionDialog(Me.mProblem) End If - 'Lösungsdialog anzeigen + 'Lösungsdialog anzeigen Call Me.solutionDialog.Show() - 'Lösung zum Lösungsdialog hinzufügen + 'Lösung zum Lösungsdialog hinzufügen Call Me.solutionDialog.addSolution(ind) - 'Lösung im Hauptdiagramm anzeigen + 'Lösung im Hauptdiagramm anzeigen Call Me.Hauptdiagramm1.DrawSelectedSolution(ind) - 'Lösung in den Scatterplots anzeigen + 'Lösung in den Scatterplots anzeigen If (Not IsNothing(Me.scatterplot1)) Then Call Me.scatterplot1.showSelectedSolution(ind) End If @@ -1598,21 +1582,21 @@ Partial Public Class Form1 End If End If - 'Lösungsdialog nach vorne bringen + 'Lösungsdialog nach vorne bringen Call Me.solutionDialog.BringToFront() End Sub - 'Lösungsauswahl zurücksetzen + 'Lösungsauswahl zurücksetzen '*************************** Public Sub clearSelectedSolutions() - 'Serie der ausgewählten Lösungen löschen + 'Serie der ausgewählten Lösungen löschen '======================================= 'Im Hauptdiagramm '---------------- - Call Me.Hauptdiagramm1.LöscheAusgewählteLösungen() + Call Me.Hauptdiagramm1.LöscheAusgewählteLösungen() 'In den Scatterplot-Matrizen '--------------------------- @@ -1629,42 +1613,42 @@ Partial Public Class Form1 Call Me.customPlot.clearSelection() End If - 'Auswahl intern zurücksetzen + 'Auswahl intern zurücksetzen '=========================== Call Sim1.OptResult.clearSelectedSolutions() End Sub ''' - ''' Lösungsauswahl aktualisieren + ''' Lösungsauswahl aktualisieren ''' - ''' Array von Lösungs-IDs + ''' Array von Lösungs-IDs ''' Public Sub updateSelectedSolutions(ByVal selectedSolution_IDs() As Integer) - 'Selektierte Lösungen neu setzen + 'Selektierte Lösungen neu setzen Call Sim1.OptResult.clearSelectedSolutions() For Each id As Integer In selectedSolution_IDs Call Sim1.OptResult.selectSolution(id) Next 'Im Hauptdiagramm neu zeichnen - Call Me.Hauptdiagramm1.LöscheAusgewählteLösungen() - For Each ind As Common.Individuum In Me.Sim1.OptResult.getSelectedSolutions + Call Me.Hauptdiagramm1.LöscheAusgewählteLösungen() + For Each ind As Individuum In Me.Sim1.OptResult.getSelectedSolutions Call Me.Hauptdiagramm1.DrawSelectedSolution(ind) Next 'In den Scatterplot-Matrizen neu zeichnen If (Not IsNothing(Me.scatterplot1)) Then Call scatterplot1.clearSelection() - For Each ind As Common.Individuum In Me.Sim1.OptResult.getSelectedSolutions + For Each ind As Individuum In Me.Sim1.OptResult.getSelectedSolutions Call Me.scatterplot1.showSelectedSolution(ind) Next End If If (Not IsNothing(Me.scatterplot2)) Then Call scatterplot2.clearSelection() - For Each ind As Common.Individuum In Me.Sim1.OptResult.getSelectedSolutions + For Each ind As Individuum In Me.Sim1.OptResult.getSelectedSolutions Call Me.scatterplot2.showSelectedSolution(ind) Next End If @@ -1672,19 +1656,18 @@ Partial Public Class Form1 'Im CustomPlot neu zeichnen If (Not IsNothing(Me.customPlot)) Then Call Me.customPlot.clearSelection() - For Each ind As Common.Individuum In Me.Sim1.OptResult.getSelectedSolutions + For Each ind As Individuum In Me.Sim1.OptResult.getSelectedSolutions Call Me.customPlot.showSelectedSolution(ind) Next End If End Sub - 'ausgewählte Lösungen simulieren und in Wave anzeigen + 'ausgewählte Lösungen simulieren und in Wave anzeigen '**************************************************** Public Sub simulateSelectedSolutions(ByVal checkedSolution_IDs() As Integer) Dim isOK As Boolean - Dim isSWMM As Boolean Dim WorkDir_Prev, WorkDir As String Dim zre As Wave.TimeSeries @@ -1700,18 +1683,18 @@ Partial Public Class Form1 'Wait cursor Cursor = Cursors.WaitCursor - 'Simulationen in eigenen Unterverzeichnissen ausführen (ohne Threads), - 'WorDir_Current aber merken, und am Ende wieder zurücksetzen! + 'Simulationen in eigenen Unterverzeichnissen ausführen (ohne Threads), + 'WorDir_Current aber merken, und am Ende wieder zurücksetzen! WorkDir_Prev = Sim1.WorkDir_Current 'Wave instanzieren Dim Wave1 As New Wave.Wave() - 'Alle ausgewählten Lösungen durchlaufen + 'Alle ausgewählten Lösungen durchlaufen '====================================== - For Each ind As Common.Individuum In Sim1.OptResult.getSelectedSolutions() + For Each ind As Individuum In Sim1.OptResult.getSelectedSolutions() - 'Lösung per Checkbox ausgewählt? + 'Lösung per Checkbox ausgewählt? '------------------------------- If (Not checkedSolution_IDs.Contains(ind.ID)) Then Continue For @@ -1734,31 +1717,25 @@ Partial Public Class Form1 'TODO: Simulationsfehler abfangen! - 'Sonderfall SWMM-Bechnung: keine Ganglinie anzuzeigen - If (TypeOf Me.Sim1 Is BlueM.Opt.Apps.SWMM) Then - isSWMM = True - Exit Sub - End If - - 'Zu zeichnenden Simulationsreihen zurücksetzen + 'Zu zeichnenden Simulationsreihen zurücksetzen SimSeries.Clear() 'zu zeichnenden Reihen aus Liste der Ziele raussuchen '---------------------------------------------------- - For Each objective As Common.ObjectiveFunction In Me.mProblem.List_ObjectiveFunctions + For Each objective As ObjectiveFunction In Me.mProblem.List_ObjectiveFunctions - If (objective.GetObjType = Common.ObjectiveFunction.ObjectiveType.Series _ - Or objective.GetObjType = Common.ObjectiveFunction.ObjectiveType.ValueFromSeries) Then + If (objective.GetObjType = ObjectiveFunction.ObjectiveType.Series _ + Or objective.GetObjType = ObjectiveFunction.ObjectiveType.ValueFromSeries) Then With objective 'Referenzreihe in Wave laden '--------------------------- - If (objective.GetObjType = Common.ObjectiveFunction.ObjectiveType.Series) Then - With CType(objective, Common.ObjectiveFunction_Series) + If (objective.GetObjType = ObjectiveFunction.ObjectiveType.Series) Then + With CType(objective, ObjectiveFunction_Series) 'Referenzreihen nur jeweils ein Mal zeichnen - 'TODO: Dieselbe Referenzreihe könnte aber mehrfach mit jeweils - ' unterschiedlichen Evaluierungszeiträumen definiert sein. + 'TODO: Dieselbe Referenzreihe könnte aber mehrfach mit jeweils + ' unterschiedlichen Evaluierungszeiträumen definiert sein. ' Dann sollte sie auch mehrfach gezeichnet werden. If (Not RefSeries.Contains(.RefSeriesFile & .RefName)) Then RefSeries.Add(.RefName, .RefSeriesFile & .RefName) @@ -1774,7 +1751,7 @@ Partial Public Class Form1 If (Not SimSeries.Contains(.SimResultName)) Then Call SimSeries.Add(.SimResultName, .SimResultName) zre = Sim1.SimResult.Series(.SimResultName).Clone() - 'Lösungsnummer an Titel anhängen + 'Lösungsnummer an Titel anhängen zre.Title &= $" (Solution {ind.ID})" 'Simreihe in Wave laden Call Wave1.Import_Series(zre) @@ -1790,7 +1767,7 @@ Partial Public Class Form1 '------------- Dim app As New BlueM.Wave.App(Wave1) - 'Simulationsverzeichnis zurücksetzen + 'Simulationsverzeichnis zurücksetzen Sim1.WorkDir_Current = WorkDir_Prev 'Cursor @@ -1798,13 +1775,13 @@ Partial Public Class Form1 End Sub -#End Region 'Lösungsauswahl +#End Region 'Lösungsauswahl #End Region 'Diagrammfunktionen #Region "Ergebnisdatenbank" - 'Ergebnis-Button hat selbst keine funktionalität -> nur DropDown + 'Ergebnis-Button hat selbst keine funktionalität -> nur DropDown '*************************************************************** Private Sub Button_ErgebnisDB_ButtonClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripSplitButton_ErgebnisDB.ButtonClick Call Me.ToolStripSplitButton_ErgebnisDB.ShowDropDown() @@ -1819,7 +1796,7 @@ Partial Public Class Form1 Try - 'Datei-öffnen Dialog anzeigen + 'Datei-öffnen Dialog anzeigen Me.OpenFileDialog1.Filter = "Access databases (*.mdb)|*.mdb" Me.OpenFileDialog1.Title = "Select result DB" Me.OpenFileDialog1.FileName = "" @@ -1900,16 +1877,16 @@ Partial Public Class Form1 Dim serie As Steema.TeeChart.Styles.Series Dim serie3D As Steema.TeeChart.Styles.Points3D - 'Lösungen + 'Lösungen '======== If (importDialog.ComboBox_SekPop.SelectedItem <> "exclusively") Then - For Each ind As Common.Individuum In Sim1.OptResult.Solutions + For Each ind As Individuum In Sim1.OptResult.Solutions If (Me.Hauptdiagramm1.ZielIndexZ = -1 And Me.Hauptdiagramm1.ZielIndexY = -1) Then '1D '-- - 'Constraintverletzung prüfen + 'Constraintverletzung prüfen If (ind.Is_Feasible) Then serie = Me.Hauptdiagramm1.getSeriesPoint("Population", "red") Else @@ -1920,7 +1897,7 @@ Partial Public Class Form1 ElseIf (Me.Hauptdiagramm1.ZielIndexZ = -1) Then '2D '-- - 'Constraintverletzung prüfen + 'Constraintverletzung prüfen If (ind.Is_Feasible) Then serie = Me.Hauptdiagramm1.getSeriesPoint("Population", "Orange") Else @@ -1931,7 +1908,7 @@ Partial Public Class Form1 Else '3D '-- - 'Constraintverletzung prüfen + 'Constraintverletzung prüfen If (ind.Is_Feasible) Then serie3D = Me.Hauptdiagramm1.getSeries3DPoint("Population", "Orange") Else @@ -1947,11 +1924,11 @@ Partial Public Class Form1 Call My.Application.DoEvents() - 'Sekundärpopulation + 'Sekundärpopulation '================== If (importDialog.ComboBox_SekPop.SelectedItem <> "none") Then - For Each sekpopind As Common.Individuum In Sim1.OptResult.getSekPop() + For Each sekpopind As Individuum In Sim1.OptResult.getSekPop() If (Me.Hauptdiagramm1.ZielIndexZ = -1) Then '2D '-- @@ -2023,7 +2000,7 @@ Partial Public Class Form1 'Start-Button deaktivieren Me.Button_Start.Enabled = False - 'Simulationen vorbereiten (weil möglicherweise vorher noch nicht geschehen!) + 'Simulationen vorbereiten (weil möglicherweise vorher noch nicht geschehen!) Call Me.Sim1.prepareSimulation() End If @@ -2031,7 +2008,7 @@ Partial Public Class Form1 End If Catch ex As Exception - MsgBox("Error while loading result database:" & eol & ex.Message, MsgBoxStyle.Critical) + MsgBox("Error while loading result database:" & Constants.eol & ex.Message, MsgBoxStyle.Critical) Finally @@ -2052,7 +2029,7 @@ Partial Public Class Form1 Try - 'Datei-öffnen Dialog anzeigen + 'Datei-öffnen Dialog anzeigen Me.OpenFileDialog1.Filter = "Access-Database (*.mdb)|*.mdb" Me.OpenFileDialog1.Title = "Result comparison: select optimization result" Me.OpenFileDialog1.FileName = "" @@ -2064,7 +2041,7 @@ Partial Public Class Form1 sourceFile = Me.OpenFileDialog1.FileName 'Abfrage - diagresult = MsgBox("Should the optimization parameters of the comparison result be loaded as well?" & eol _ + diagresult = MsgBox("Should the optimization parameters of the comparison result be loaded as well?" & Constants.eol _ & "(This requires that the optimization parameter definition of both results are identical!)", MsgBoxStyle.YesNo) If (diagresult = Windows.Forms.DialogResult.Yes) Then @@ -2086,7 +2063,7 @@ Partial Public Class Form1 Dim serie As Steema.TeeChart.Styles.Points Dim serie3D As Steema.TeeChart.Styles.Points3D - For Each sekpopind As Common.Individuum In Sim1.OptResultRef.getSekPop() + For Each sekpopind As Individuum In Sim1.OptResultRef.getSekPop() If (Me.Hauptdiagramm1.ZielIndexZ = -1) Then '2D '-- @@ -2129,15 +2106,15 @@ Partial Public Class Form1 'Berechnung indicatorDiff = -HypervolumeDiff.calc_indicator() - 'Nadir-Punkt holen (für spätere Verwendung bei Referenz-Hypervolumen) + 'Nadir-Punkt holen (für spätere Verwendung bei Referenz-Hypervolumen) nadir = HypervolumeDiff.nadir 'In Zwischenablage kopieren Call Clipboard.SetDataObject(indicatorDiff, True) 'Anzeige in Messagebox - MsgBox("Hypervolume difference to comparison result:" & eol _ - & indicatorDiff.ToString() & eol _ + MsgBox("Hypervolume difference to comparison result:" & Constants.eol _ + & indicatorDiff.ToString() & Constants.eol _ & "(Value was copied to the clipboard)", MsgBoxStyle.Information, "Hypervolume") End If @@ -2150,7 +2127,7 @@ Partial Public Class Form1 'Im Monitor anzeigen Dim colorline1 As New Steema.TeeChart.Tools.ColorLine(Me.Monitor1.Diag.Chart) - colorline1.Pen.Color = System.Drawing.Color.Red + colorline1.Pen.Color = Color.Red colorline1.Pen.Width = 2 colorline1.AllowDrag = False colorline1.Axis = Me.Monitor1.Diag.Axes.Right @@ -2159,7 +2136,7 @@ Partial Public Class Form1 End If Catch ex As Exception - MsgBox("Error while loading reference result database:" & eol & ex.Message, MsgBoxStyle.Critical) + MsgBox("Error while loading reference result database:" & Constants.eol & ex.Message, MsgBoxStyle.Critical) Finally @@ -2175,11 +2152,11 @@ Partial Public Class Form1 ''' Die Startwerte der Optparameter evaluieren ''' ''' boolean success - ''' nur für Sim-Anwendungen! + ''' nur für Sim-Anwendungen! Private Function evaluateStartwerte() As Boolean Dim isOK As Boolean - Dim startind As BlueM.Opt.Common.Individuum + Dim startind As Individuum startind = Me.mProblem.getIndividuumStart() diff --git a/BlueM.Opt/Main/My Project/AssemblyInfo.vb b/BlueM.Opt/Main/My Project/AssemblyInfo.vb index 753416fd..f7bc4249 100644 --- a/BlueM.Opt/Main/My Project/AssemblyInfo.vb +++ b/BlueM.Opt/Main/My Project/AssemblyInfo.vb @@ -1,34 +1,33 @@ Imports System.Reflection Imports System.Runtime.CompilerServices Imports System.Runtime.InteropServices -Imports BlueM.Opt.Common.Constants +Imports BlueM.Opt.Common -' Allgemeine Informationen über eine Assembly werden über die folgende -' Attributgruppe gesteuert. Ändern Sie diese Attributwerte, um die -' Assemblyinformationen zu ändern +' Allgemeine Informationen über eine Assembly werden über die folgende +' Attributgruppe gesteuert. Ändern Sie diese Attributwerte, um die +' Assemblyinformationen zu ändern - - + -' Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +' Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: ' Hauptversion ' Nebenversion ' Revision ' Buildnummer -' Sie können alle Werte festlegen, oder für Revision und Buildnummer den Standard +' Sie können alle Werte festlegen, oder für Revision und Buildnummer den Standard ' mit '*' verwenden. Siehe unten diff --git a/BlueM.Opt/Main/SolutionDialog.vb b/BlueM.Opt/Main/SolutionDialog.vb index da17cf50..1bcea771 100644 --- a/BlueM.Opt/Main/SolutionDialog.vb +++ b/BlueM.Opt/Main/SolutionDialog.vb @@ -15,14 +15,16 @@ 'You should have received a copy of the GNU General Public License 'along with this program. If not, see . ' +Imports BlueM.Opt.Common + ''' -''' Zeigt die ausgewählten Lösungen an +''' Zeigt die ausgewählten Lösungen an ''' Partial Public Class SolutionDialog Inherits System.Windows.Forms.Form 'Das Problem - Private mProblem As BlueM.Opt.Common.Problem + Private mProblem As Problem 'Properties '********** @@ -52,12 +54,12 @@ Partial Public Class SolutionDialog ''' Konstruktor ''' ''' Das Problem - Public Sub New(ByRef prob As BlueM.Opt.Common.Problem) + Public Sub New(ByRef prob As Problem) - ' Dieser Aufruf ist für den Windows Form-Designer erforderlich. + ' Dieser Aufruf ist für den Windows Form-Designer erforderlich. InitializeComponent() - ' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu. + ' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu. 'Problem speichern Me.mProblem = prob @@ -75,8 +77,12 @@ Partial Public Class SolutionDialog 'Ziele '-------- - For Each feature As Common.ObjectiveFunction In Me.mProblem.List_ObjectiveFunctions - column = New DataGridViewTextBoxColumn() + For Each feature As ObjectiveFunction In Me.mProblem.List_ObjectiveFunctions + column = New DataGridViewTextBoxColumn With { + .Name = feature.Description, + .ReadOnly = True, + .DefaultCellStyle = cellstyle.Clone() + } If (feature.isPrimObjective) Then cellstyle.BackColor = Color.LightGreen column.HeaderText = feature.Description & " (*)" @@ -86,9 +92,6 @@ Partial Public Class SolutionDialog column.HeaderText = feature.Description column.HeaderCell.ToolTipText = "Secondary objective function" End If - column.ReadOnly = True - column.Name = feature.Description - column.DefaultCellStyle = cellstyle.Clone() Me.DataGridView1.Columns.Add(column) Next @@ -96,13 +99,14 @@ Partial Public Class SolutionDialog '----------- cellstyle.BackColor = Color.LightCoral - For Each Constraint As Common.Constraintfunction In Me.mProblem.List_Constraintfunctions - column = New DataGridViewTextBoxColumn() - column.ReadOnly = True - column.HeaderText = Constraint.Bezeichnung + For Each Constraint As Constraintfunction In Me.mProblem.List_Constraintfunctions + column = New DataGridViewTextBoxColumn With { + .Name = Constraint.Bezeichnung, + .DefaultCellStyle = cellstyle.Clone(), + .ReadOnly = True, + .HeaderText = Constraint.Bezeichnung + } column.HeaderCell.ToolTipText = "Constraint" - column.Name = Constraint.Bezeichnung - column.DefaultCellStyle = cellstyle.Clone() Me.DataGridView1.Columns.Add(column) Next @@ -110,13 +114,14 @@ Partial Public Class SolutionDialog '------------ cellstyle.BackColor = Color.LightGray - For Each OptPara As BlueM.Opt.Common.OptParameter In Me.mProblem.List_OptParameter - column = New DataGridViewTextBoxColumn() - column.ReadOnly = True - column.HeaderText = OptPara.Bezeichnung + For Each OptPara As OptParameter In Me.mProblem.List_OptParameter + column = New DataGridViewTextBoxColumn With { + .Name = OptPara.Bezeichnung, + .DefaultCellStyle = cellstyle.Clone(), + .ReadOnly = True, + .HeaderText = OptPara.Bezeichnung + } column.HeaderCell.ToolTipText = "Optimization parameter" - column.Name = OptPara.Bezeichnung - column.DefaultCellStyle = cellstyle.Clone() Me.DataGridView1.Columns.Add(column) Next @@ -129,10 +134,10 @@ Partial Public Class SolutionDialog End Sub ''' - ''' Ein Individuum zur Lösungsauswahl hinzufügen + ''' Ein Individuum zur Lösungsauswahl hinzufügen ''' - ''' das ausgewählte Individuum - Public Sub addSolution(ByVal ind As Common.Individuum) + ''' das ausgewählte Individuum + Public Sub addSolution(ByVal ind As Individuum) Dim i As Integer Dim cellvalues() As Object @@ -169,7 +174,7 @@ Partial Public Class SolutionDialog row.CreateCells(Me.DataGridView1, cellvalues) row.HeaderCell.Value = ind.ID.ToString() - 'Zeile hinzufügen + 'Zeile hinzufügen Me.DataGridView1.Rows.Add(row) 'Spalten anpassen @@ -177,7 +182,7 @@ Partial Public Class SolutionDialog End Sub - 'Automatisches speichern von Zellenänderungen + 'Automatisches speichern von Zellenänderungen '******************************************** Private Sub dataGridView1_CurrentCellDirtyStateChanged(ByVal sender As Object, ByVal e As EventArgs) Handles DataGridView1.CurrentCellDirtyStateChanged @@ -187,45 +192,45 @@ Partial Public Class SolutionDialog End Sub - 'Nicht angehakte Lösungen aus Lösungsauwahl entfernen + 'Nicht angehakte Lösungen aus Lösungsauwahl entfernen '**************************************************** Private Sub ToolStripButton_unselect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton_unselect.Click - 'Zeilen löschen + 'Zeilen löschen For Each row As DataGridViewRow In Me.DataGridView1.Rows If (row.Cells(0).Value = "False") Then Me.DataGridView1.Rows.Remove(row) End If Next - 'Event auslösen + 'Event auslösen RaiseEvent SelectedSolutionsChanged(Me.checkedSolutions) End Sub - 'Lösungsauswahl zurücksetzen + 'Lösungsauswahl zurücksetzen '*************************** Private Sub ToolStripButton_Clear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton_Clear.Click - 'Alle Zeilen löschen + 'Alle Zeilen löschen Call Me.DataGridView1.Rows.Clear() - 'Lösungsdialog verstecken + 'Lösungsdialog verstecken Call Me.Hide() - 'Event auslösen + 'Event auslösen RaiseEvent SelectedSolutionsCleared() End Sub - 'Ausgewählte Lösungen simulieren + 'Ausgewählte Lösungen simulieren '******************************* Private Sub ToolStripButton_Simulate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton_Wave.Click 'Cursor Cursor = Cursors.WaitCursor - 'Event auslösen + 'Event auslösen RaiseEvent SelectedSolutionsSimulationRequested(Me.checkedSolutions) 'Cursor @@ -264,11 +269,11 @@ Partial Public Class SolutionDialog RaiseEvent SelectedSolutionsIDRequested(id) End Sub - 'Form schließen + 'Form schließen '************** Private Sub SolutionDialog_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing - 'verhindern, dass das Formular komplett gelöscht wird + 'verhindern, dass das Formular komplett gelöscht wird e.Cancel = True 'Formular verstecken diff --git a/BlueM.Opt/OptResult/MDBImportDialog.vb b/BlueM.Opt/OptResult/MDBImportDialog.vb index 4f963aa4..828958a3 100644 --- a/BlueM.Opt/OptResult/MDBImportDialog.vb +++ b/BlueM.Opt/OptResult/MDBImportDialog.vb @@ -15,11 +15,13 @@ 'You should have received a copy of the GNU General Public License 'along with this program. If not, see . ' +Imports BlueM.Opt.Common + Public Class MDBImportDialog - Private mProblem As BlueM.Opt.Common.Problem + Private mProblem As Problem - Public Sub New(ByRef prob As BlueM.Opt.Common.Problem) + Public Sub New(ByRef prob As Problem) ' This call is required by the Windows Form Designer. InitializeComponent() @@ -33,9 +35,9 @@ Public Class MDBImportDialog '********* Private Sub MDBImportDialog_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load - 'Listboxen füllen + 'Listboxen füllen Dim bezeichnung As String - For Each feature As Common.ObjectiveFunction In Me.mProblem.List_ObjectiveFunctions + For Each feature As ObjectiveFunction In Me.mProblem.List_ObjectiveFunctions bezeichnung = feature.Description 'Penalty-Funktionen mit Sternchen markieren If (feature.isPrimObjective) Then bezeichnung &= " (*)" @@ -62,11 +64,11 @@ Public Class MDBImportDialog End If End Sub - 'Überprüfung der Benutzereingabe + 'Überprüfung der Benutzereingabe '******************************* Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click If (Me.ListBox_ZieleY.Enabled) Then - 'Mindestens eine X- und Y-Achse ausgewählt? + 'Mindestens eine X- und Y-Achse ausgewählt? If (Me.ListBox_ZieleX.SelectedIndex = -1 Or Me.ListBox_ZieleY.SelectedIndex = -1) Then MsgBox("Please select at least one X and Y axis!", MsgBoxStyle.Exclamation) Me.DialogResult = Windows.Forms.DialogResult.None @@ -74,11 +76,11 @@ Public Class MDBImportDialog End If End If - 'Unterschiedliche Achsen ausgewählt? + 'Unterschiedliche Achsen ausgewählt? If (Me.ListBox_ZieleY.Enabled) Then - If (Me.ListBox_ZieleX.SelectedIndex = Me.ListBox_ZieleY.SelectedIndex Or _ - (Not Me.ListBox_ZieleZ.SelectedIndex = -1 And _ - (Me.ListBox_ZieleX.SelectedIndex = Me.ListBox_ZieleZ.SelectedIndex Or _ + If (Me.ListBox_ZieleX.SelectedIndex = Me.ListBox_ZieleY.SelectedIndex Or + (Not Me.ListBox_ZieleZ.SelectedIndex = -1 And + (Me.ListBox_ZieleX.SelectedIndex = Me.ListBox_ZieleZ.SelectedIndex Or Me.ListBox_ZieleY.SelectedIndex = Me.ListBox_ZieleZ.SelectedIndex))) Then MsgBox("Please select different axes for each objective function!", MsgBoxStyle.Exclamation) Me.DialogResult = Windows.Forms.DialogResult.None diff --git a/BlueM.Opt/OptResult/OptResult.vb b/BlueM.Opt/OptResult/OptResult.vb index 3ff1d799..e0292f51 100644 --- a/BlueM.Opt/OptResult/OptResult.vb +++ b/BlueM.Opt/OptResult/OptResult.vb @@ -16,6 +16,7 @@ 'along with this program. If not, see . ' Imports System.Data.OleDb +Imports BlueM.Opt.Common ''' ''' Speichert und verwaltet die Ergebnisse eines Optimierungslaufs, @@ -27,26 +28,26 @@ Public Class OptResult Private Datensatz As String 'Das Problem - Private mProblem As Common.Problem + Private mProblem As Problem 'Ergebnisdatenbank Public Ergebnisdb As Boolean = True 'Gibt an, ob die Ergebnisdatenbank geschrieben werden soll Private db_path As String 'Pfad zur Ergebnisdatenbank Private db As OleDb.OleDbConnection - 'Array von Lösungen - Public Solutions() As Common.Individuum + 'Array von Lösungen + Public Solutions() As Individuum - 'Structure für Sekundäre Population + 'Structure für Sekundäre Population Public Structure Struct_SekPop Public iGen As Integer 'Generationsnummer Public SolutionIDs() As Integer 'Array von Solution-IDs End Structure - 'Array von Sekundären Populationen + 'Array von Sekundären Populationen Public SekPops() As Struct_SekPop - 'Array von ausgewählten Lösungen + 'Array von ausgewählten Lösungen Private selSolutionIDs() As Integer ''' @@ -61,9 +62,9 @@ Public Class OptResult ''' ''' ''' optional start time to use for the database filename - Public Sub New(ByVal Datensatzname As String, ByRef prob As Common.Problem, Optional ByVal createNewMdb As Boolean = True, Optional starttime As DateTime = Nothing) + Public Sub New(ByVal Datensatzname As String, ByRef prob As Problem, Optional ByVal createNewMdb As Boolean = True, Optional starttime As DateTime = Nothing) - 'Standardmäßig mit Optparametern + 'Standardmäßig mit Optparametern Me.holdsOptparameters = True 'Datensatzname speichern @@ -88,18 +89,18 @@ Public Class OptResult #Region "Ergebnisspeicher" - 'Eine Lösung auswählen + 'Eine Lösung auswählen '********************* Public Function selectSolution(ByVal ID As Integer) As Boolean - 'Überprüfen, ob Lösung bereits ausgewählt ist + 'Überprüfen, ob Lösung bereits ausgewählt ist For Each _id As Integer In Me.selSolutionIDs If (_id = ID) Then Return False End If Next - 'Lösung zu Auswahl hinzufügen + 'Lösung zu Auswahl hinzufügen ReDim Preserve Me.selSolutionIDs(Me.selSolutionIDs.GetUpperBound(0) + 1) Me.selSolutionIDs(Me.selSolutionIDs.GetUpperBound(0)) = ID @@ -107,11 +108,11 @@ Public Class OptResult End Function - 'Ausgewählte Lösungen holen + 'Ausgewählte Lösungen holen '************************** - Public ReadOnly Property getSelectedSolutions() As Common.Individuum() + Public ReadOnly Property getSelectedSolutions() As Individuum() Get - Dim solutions() As Common.Individuum + Dim solutions() As Individuum solutions = getSolutions(Me.selSolutionIDs) @@ -119,7 +120,7 @@ Public Class OptResult End Get End Property - 'Lösungsauswahl zurücksetzen + 'Lösungsauswahl zurücksetzen '*************************** Public Sub clearSelectedSolutions() @@ -127,11 +128,11 @@ Public Class OptResult End Sub - 'Eine Lösung zum Optimierungsergebnis hinzufügen + 'Eine Lösung zum Optimierungsergebnis hinzufügen '*********************************************** - Public Sub addSolution(ByVal Ind As Common.Individuum) + Public Sub addSolution(ByVal Ind As Individuum) - 'Lösung zu OptResult hinzufügen + 'Lösung zu OptResult hinzufügen ReDim Preserve Me.Solutions(Me.Solutions.GetUpperBound(0) + 1) Me.Solutions(Me.Solutions.GetUpperBound(0)) = Ind.Clone() @@ -140,9 +141,9 @@ Public Class OptResult End Sub - 'Eine Lösung identifizieren + 'Eine Lösung identifizieren '************************** - Public Function getSolution(ByVal ID As Integer) As Common.Individuum + Public Function getSolution(ByVal ID As Integer) As Individuum Dim i As Integer @@ -156,15 +157,15 @@ Public Class OptResult End Function - 'Sekundäre Population hinzufügen + 'Sekundäre Population hinzufügen '******************************* - Public Sub setSekPop(ByVal pop() As Common.Individuum, ByVal _igen As Integer) + Public Sub setSekPop(ByVal pop() As Individuum, ByVal _igen As Integer) Dim SekPop As Struct_SekPop Dim sekpopvalues(,) As Double 'Population in Array von Penalty-Werten transformieren - sekpopvalues = Common.Individuum.Get_All_Penalty_of_Array(pop) + sekpopvalues = Individuum.Get_All_Penalty_of_Array(pop) 'SekPop in DB speichern Call Me.db_setSekPop(sekpopvalues, _igen) @@ -172,27 +173,27 @@ Public Class OptResult 'SekPop aus DB lesen SekPop = Me.db_getSekPop(_igen) - 'SekPop zu OptResult hinzufügen + 'SekPop zu OptResult hinzufügen Call Me.addSekPop(SekPop) End Sub - 'Sekundäre Population zu OptResult hinzufügen + 'Sekundäre Population zu OptResult hinzufügen '******************************************** Private Sub addSekPop(ByVal _sekpop As Struct_SekPop) - 'Array von Sekundären Populationen um eins erweitern + 'Array von Sekundären Populationen um eins erweitern ReDim Preserve Me.SekPops(Me.SekPops.GetUpperBound(0) + 1) - 'SekPop hinzufügen + 'SekPop hinzufügen Me.SekPops(Me.SekPops.GetUpperBound(0)) = _sekpop End Sub - 'Sekundäre Population holen + 'Sekundäre Population holen '************************** - Public Function getSekPop(Optional ByVal _igen As Integer = -1) As Common.Individuum() + Public Function getSekPop(Optional ByVal _igen As Integer = -1) As Individuum() - Dim sekpopsolutions() As Common.Individuum + Dim sekpopsolutions() As Individuum 'Wenn keine Generation angegeben, dann letzte SekPop ausgeben If (_igen = -1) Then @@ -203,10 +204,10 @@ Public Class OptResult ReDim sekpopsolutions(-1) - 'Alle Sekundären Populationen durchlaufen + 'Alle Sekundären Populationen durchlaufen For Each sekpop As Struct_SekPop In Me.SekPops If (sekpop.iGen = _igen) Then - 'SekPop gefunden, Lösungen holen + 'SekPop gefunden, Lösungen holen sekpopsolutions = getSolutions(sekpop.SolutionIDs) End If Next @@ -215,11 +216,11 @@ Public Class OptResult End Function - 'Gibt die Penalty-Werte einer Sekundären Population zurück + 'Gibt die Penalty-Werte einer Sekundären Population zurück '********************************************************* Public Function getSekPopValues(Optional ByVal igen As Integer = -1) As Double(,) - Dim inds() As Common.Individuum + Dim inds() As Individuum Dim values(,) As Double Dim i, j As Integer @@ -228,7 +229,7 @@ Public Class OptResult igen = Me.db_getLastGenNo() End If - 'Wenn es keine Sekundäre Population in der DB gibt, abbrechen + 'Wenn es keine Sekundäre Population in der DB gibt, abbrechen If (igen = -1) Then ReDim values(-1, -1) Return values @@ -248,12 +249,12 @@ Public Class OptResult End Function - 'Lösungen anhand von IDs holen + 'Lösungen anhand von IDs holen '***************************** - Private Function getSolutions(ByVal IDs() As Integer) As Common.Individuum() + Private Function getSolutions(ByVal IDs() As Integer) As Individuum() Dim i As Integer - Dim solutions() As Common.Individuum + Dim solutions() As Individuum ReDim solutions(IDs.GetUpperBound(0)) @@ -265,12 +266,12 @@ Public Class OptResult End Function - 'Beste Lösung zurückgeben + 'Beste Lösung zurückgeben '************************ - Public Function getBestSolution() As Common.Individuum + Public Function getBestSolution() As Individuum Dim i As Integer - Dim bestInd As Common.Individuum + Dim bestInd As Individuum bestInd = Solutions(0) @@ -288,7 +289,7 @@ Public Class OptResult #Region "Ergebnisdatenbank" - 'Methoden für die Ergebnisdatenbank + 'Methoden für die Ergebnisdatenbank '################################## ''' @@ -307,7 +308,7 @@ Public Class OptResult Me.db_path = IO.Path.Combine(workdir, filename) 'Pfad zur Vorlage - Dim db_source_path As String = IO.Path.Combine(System.Windows.Forms.Application.StartupPath(), "EVO.mdb") + Dim db_source_path As String = IO.Path.Combine(Windows.Forms.Application.StartupPath(), "EVO.mdb") 'Datei kopieren My.Computer.FileSystem.CopyFile(db_source_path, Me.db_path, True) @@ -320,13 +321,13 @@ Public Class OptResult 'Methodenspezifische Anpassungen Select Case Me.mProblem.Method - Case Common.METH_PES, Common.METH_METAEVO, Common.METH_SENSIPLOT, Common.METH_HOOKEJEEVES, Common.METH_DDS + Case Constants.METH_PES, Constants.METH_METAEVO, Constants.METH_SENSIPLOT, Constants.METH_HOOKEJEEVES, Constants.METH_DDS Call Me.db_prepare_PES() Case Else Throw New NotImplementedException($"Method '{Me.mProblem.Method}' not implemented in OptResult.db_init()!") End Select - Common.Log.AddMessage(Common.Log.levels.info, $"Initialized result database {filename}") + Log.AddMessage(Log.levels.info, $"Initialized result database {filename}") End Sub @@ -339,13 +340,13 @@ Public Class OptResult Dim fieldnames As List(Of String) Call db_connect() - Dim command As OleDbCommand = New OleDbCommand("", db) + Dim command As New OleDbCommand("", db) 'Tabelle 'QWerte' '---------------- 'Spalten festlegen: fieldnames = New List(Of String) - For Each objfun As Common.ObjectiveFunction In Me.mProblem.List_ObjectiveFunctions + For Each objfun As ObjectiveFunction In Me.mProblem.List_ObjectiveFunctions fieldnames.Add($"[{objfun.Description}] DOUBLE") Next 'Tabelle anpassen @@ -357,7 +358,7 @@ Public Class OptResult If (Me.mProblem.NumConstraints > 0) Then 'Spalten festlegen: fieldnames = New List(Of String) - For Each constraint As Common.Constraintfunction In Me.mProblem.List_Constraintfunctions + For Each constraint As Constraintfunction In Me.mProblem.List_Constraintfunctions fieldnames.Add($"[{constraint.Bezeichnung}] DOUBLE") Next 'Tabelle anpassen @@ -369,18 +370,18 @@ Public Class OptResult End Sub - 'Ergebnisdatenbank für PES vorbereiten + 'Ergebnisdatenbank für PES vorbereiten '************************************* Private Sub db_prepare_PES() Call db_connect() - Dim command As OleDbCommand = New OleDbCommand("", db) + Dim command As New OleDbCommand("", db) 'Tabelle 'OptParameter' '---------------------- 'Spalten festlegen: Dim fieldnames As New List(Of String) - For Each optpara As Common.OptParameter In Me.mProblem.List_OptParameter + For Each optpara As OptParameter In Me.mProblem.List_OptParameter fieldnames.Add($"[{optpara.Bezeichnung}] DOUBLE") Next 'Tabelle anpassen @@ -413,15 +414,15 @@ Public Class OptResult End Try End Sub - 'Verbindung zu Ergebnisdatenbank schließen + 'Verbindung zu Ergebnisdatenbank schließen '***************************************** Private Sub db_disconnect() db.Close() End Sub - 'Eine PES-Lösung in die ErgebnisDB schreiben + 'Eine PES-Lösung in die ErgebnisDB schreiben '******************************************* - Private Overloads Function db_insert(ByVal ind As Common.Individuum) As Boolean + Private Overloads Function db_insert(ByVal ind As Individuum) As Boolean Call db_connect() @@ -429,7 +430,7 @@ Public Class OptResult Dim fieldnames As List(Of String) Dim fieldvalues As List(Of String) - Dim command As OleDbCommand = New OleDbCommand("", db) + Dim command As New OleDbCommand("", db) 'Sim schreiben '------------- @@ -442,7 +443,7 @@ Public Class OptResult fieldvalues = New List(Of String) For i = 0 To Me.mProblem.NumObjectives - 1 fieldnames.Add($"[{Me.mProblem.List_ObjectiveFunctions(i).Description}]") - fieldvalues.Add(ind.Objectives(i).ToString(Common.Provider.FortranProvider)) + fieldvalues.Add(ind.Objectives(i).ToString(Provider.FortranProvider)) Next command.CommandText = "INSERT INTO QWerte (Sim_ID, " & String.Join(", ", fieldnames) & $") VALUES ({ind.ID}, " & String.Join(", ", fieldvalues) & ");" command.ExecuteNonQuery() @@ -454,7 +455,7 @@ Public Class OptResult fieldvalues = New List(Of String) For i = 0 To Me.mProblem.NumConstraints - 1 fieldnames.Add($"[{Me.mProblem.List_Constraintfunctions(i).Bezeichnung}]") - fieldvalues.Add(ind.Constraints(i).ToString(Common.Provider.FortranProvider)) + fieldvalues.Add(ind.Constraints(i).ToString(Provider.FortranProvider)) Next command.CommandText = "INSERT INTO [Constraints] (Sim_ID, " & String.Join(", ", fieldnames) & $") VALUES ({ind.ID}, " & String.Join(", ", fieldvalues) & ");" command.ExecuteNonQuery() @@ -466,7 +467,7 @@ Public Class OptResult fieldvalues = New List(Of String) For i = 0 To Me.mProblem.List_OptParameter.GetUpperBound(0) fieldnames.Add($"[{Me.mProblem.List_OptParameter(i).Bezeichnung}]") - fieldvalues.Add(ind.OptParameter(i).RWert.ToString(Common.Provider.FortranProvider)) + fieldvalues.Add(ind.OptParameter(i).RWert.ToString(Provider.FortranProvider)) Next command.CommandText = "INSERT INTO OptParameter (Sim_ID, " & String.Join(", ", fieldnames) & $") VALUES ({ind.ID}, " & String.Join(", ", fieldvalues) & ");" command.ExecuteNonQuery() @@ -475,15 +476,15 @@ Public Class OptResult End Function - 'Sekundäre Population in DB speichern + 'Sekundäre Population in DB speichern '************************************ Private Sub db_setSekPop(ByVal SekPop(,) As Double, ByVal igen As Integer) Call db_connect() - Dim command As OleDbCommand = New OleDbCommand("", db) + Dim command As New OleDbCommand("", db) - ''Alte SekPop löschen + ''Alte SekPop löschen 'command.CommandText = "DELETE FROM SekPop" 'command.ExecuteNonQuery() @@ -493,10 +494,10 @@ Public Class OptResult Dim Sim_ID As Integer For i = 0 To SekPop.GetUpperBound(0) - 'zugehörige Sim_ID bestimmen + 'zugehörige Sim_ID bestimmen bedingung = "" For j = 0 To Me.mProblem.NumPrimObjective - 1 - bedingung &= $" AND QWerte.[{Me.mProblem.List_PrimObjectiveFunctions(j).Description}] = " & SekPop(i, j).ToString(Common.Provider.FortranProvider) + bedingung &= $" AND QWerte.[{Me.mProblem.List_PrimObjectiveFunctions(j).Description}] = " & SekPop(i, j).ToString(Provider.FortranProvider) Next command.CommandText = $"SELECT Sim.ID FROM Sim INNER JOIN QWerte ON Sim.ID = QWerte.Sim_ID WHERE (1=1{bedingung});" Sim_ID = command.ExecuteScalar() @@ -562,8 +563,9 @@ Public Class OptResult Call db_connect() Try - command = New OleDbCommand("", db) - command.CommandText = "SELECT MAX(Generation) FROM SekPop" + command = New OleDbCommand("", db) With { + .CommandText = "SELECT MAX(Generation) FROM SekPop" + } igen = command.ExecuteScalar() Catch ex As Exception 'Keine SekPop vorhanden @@ -584,11 +586,11 @@ Public Class OptResult ''' Ob auch die OptParameter-Werte eingelesen werden sollen ''' ''' Das Optimierungsproblem (d.h. ObjectiveFunctions, OptParameter, Constraints), - ''' ebenso wie die Methode, müssen mit der DB übereinstimmen! + ''' ebenso wie die Methode, müssen mit der DB übereinstimmen! ''' Public Sub db_load(ByVal sourceFile As String, Optional ByVal loadOptParameters As Boolean = True) - 'Optparameter gewünscht? + 'Optparameter gewünscht? Me.holdsOptparameters = loadOptParameters Try @@ -597,12 +599,12 @@ Public Class OptResult Me.db_path = sourceFile Select Case Me.mProblem.Method - Case Common.METH_PES, Common.METH_HOOKEJEEVES, Common.METH_METAEVO + Case Constants.METH_PES, Constants.METH_HOOKEJEEVES, Constants.METH_METAEVO 'Individuen laden Call Me.db_getIndividuen_PES() - 'Sekundärpopulationen laden + 'Sekundärpopulationen laden Call Me.db_loadSekPops() - Case Common.METH_SENSIPLOT + Case Constants.METH_SENSIPLOT 'Nur Individuen laden Call Me.db_getIndividuen_PES() Case Else @@ -610,12 +612,12 @@ Public Class OptResult End Select Catch ex As Exception - Throw New Exception("Failed to load optimization result!" & Common.eol & ex.Message) + Throw New Exception("Failed to load optimization result!" & Constants.eol & ex.Message) End Try End Sub - 'Alle Lösungen aus der DB als PES-Individuen einlesen + 'Alle Lösungen aus der DB als PES-Individuen einlesen '**************************************************** Private Sub db_getIndividuen_PES() @@ -628,7 +630,7 @@ Public Class OptResult 'Connect Call db_connect() - 'Alle Lösungen aus DB lesen + 'Alle Lösungen aus DB lesen '-------------------------- If (Me.holdsOptparameters) Then 'mit OptParameter @@ -646,15 +648,15 @@ Public Class OptResult 'Disconnect Call db_disconnect() - 'Alle Lösungen als Individuen übernehmen + 'Alle Lösungen als Individuen übernehmen '--------------------------------------- ReDim Me.Solutions(numSolutions - 1) For i = 0 To numSolutions - 1 - Me.Solutions(i) = New Common.Individuum_PES("Solution", i) + Me.Solutions(i) = New Individuum_PES("Solution", i) - With CType(Me.Solutions(i), Common.Individuum_PES) + With CType(Me.Solutions(i), Individuum_PES) 'ID '-- .ID = ds.Tables(0).Rows(i).Item("Sim.ID") @@ -685,7 +687,7 @@ Public Class OptResult End Sub - 'Sekundärpopulationen aus DB laden + 'Sekundärpopulationen aus DB laden '********************************* Private Sub db_loadSekPops() diff --git a/BlueM.Opt/Tests/SensiPlot_ParameterSampling/ParameterSampling.vb b/BlueM.Opt/Tests/SensiPlot_ParameterSampling/ParameterSampling.vb index 76796f38..97d898c0 100644 --- a/BlueM.Opt/Tests/SensiPlot_ParameterSampling/ParameterSampling.vb +++ b/BlueM.Opt/Tests/SensiPlot_ParameterSampling/ParameterSampling.vb @@ -1,4 +1,4 @@ -'BlueM.Opt +'BlueM.Opt 'Copyright (C) BlueM Dev Group 'Website: ' @@ -16,6 +16,7 @@ 'along with this program. If not, see . ' Imports System.Windows.Forms +Imports BlueM.Opt.Common ''' ''' Form with diagram for testing SensiPlot ParameterSampling @@ -45,15 +46,15 @@ Public Class ParameterSampling 'sample optparameters Dim parameterCombinations As List(Of Double()) - Dim sampler As New BlueM.Opt.Algos.SensiPlot.ParameterSampler() + Dim sampler As New Algos.SensiPlot.ParameterSampler() - parameterCombinations = sampler.Sample(NumParams, NumSteps, BlueM.Opt.Common.Settings_Sensiplot.SensiType.evenDistribution) + parameterCombinations = sampler.Sample(NumParams, NumSteps, Settings_Sensiplot.SensiType.evenDistribution) plotParameterCombinations(parameterCombinations, "even distribution") - parameterCombinations = sampler.Sample(NumParams, NumSteps, BlueM.Opt.Common.Settings_Sensiplot.SensiType.randomDistribution) + parameterCombinations = sampler.Sample(NumParams, NumSteps, Settings_Sensiplot.SensiType.randomDistribution) plotParameterCombinations(parameterCombinations, "random distribution") - parameterCombinations = sampler.Sample(NumParams, NumSteps, BlueM.Opt.Common.Settings_Sensiplot.SensiType.latinHypercube) + parameterCombinations = sampler.Sample(NumParams, NumSteps, Settings_Sensiplot.SensiType.latinHypercube) plotParameterCombinations(parameterCombinations, "latin hypercube sampling") End Sub