Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion BlueM.Opt/Apps/BlueM.Opt.Apps.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{2DCFE99E-CBFE-4CCC-93E7-A6D628B16DEC}</ProjectGuid>
<OutputType>Library</OutputType>
Expand Down Expand Up @@ -95,6 +95,7 @@
<ItemGroup>
<Compile Include="BlueM\BlueM.vb" />
<Compile Include="BlueM\BlueMThread.vb" />
<Compile Include="Generic.vb" />
<Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
Expand Down
109 changes: 109 additions & 0 deletions BlueM.Opt/Apps/Generic.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
'BlueM.Opt
'Copyright (C) BlueM Dev Group
'Website: <https://www.bluemodel.org>
'
'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 <https://www.gnu.org/licenses/>.
'
Public Class Generic
Inherits Sim

''' <summary>
''' Eine StringCollection mit allen Dateiendungen (ohne Punkt), die in einem Datensatz vorkommen können
''' </summary>
''' <remarks>Die erste Dateiendung in dieser Collection repräsentiert den Datensatz (wird z.B. als Filter für OpenFile-Dialoge verwendet)</remarks>
Public Overrides ReadOnly Property DatensatzDateiendungen() As Collections.Specialized.StringCollection
Get
Dim extensions As New Collections.Specialized.StringCollection()
extensions.Add("bat")
Return extensions
End Get
End Property

''' <summary>
''' Multithreading support flag
''' </summary>
''' <returns>False</returns>
Public Overrides ReadOnly Property MultithreadingSupported() As Boolean
Get
'TODO: enable multithreading
Return False
End Get
End Property

''' <summary>
''' Die Sim-Anwendung für die Simulation vorbereiten
''' </summary>
Public Overrides Sub prepareSimulation()

'TODO: Immer im Originalverzeichnis des Datensatzes simulieren?
Me.WorkDir_Current = Me.WorkDir_Original

End Sub

''' <summary>
''' Simulationsparameter einlesen
''' </summary>
Protected Overrides Sub Read_SimParameter()
'TODO
End Sub

''' <summary>
''' Launch simulation
''' </summary>
''' <remarks>launches the batch file named launchSim.bat in the dataset directory</remarks>
Protected Overloads Overrides Function launchSim() As Boolean

Dim proc As Process
Dim startInfo As New ProcessStartInfo()
Dim isFinished As Boolean = False

startInfo.FileName = Me.Datensatz & Me.DatensatzExtension
'startInfo.Arguments = ""
startInfo.UseShellExecute = True
startInfo.WindowStyle = ProcessWindowStyle.Normal
startInfo.WorkingDirectory = IO.Path.GetDirectoryName(Me.WorkDir_Current)
'start
proc = Process.Start(startInfo)
'wait until finished
Do
isFinished = proc.WaitForExit(100)
System.Windows.Forms.Application.DoEvents()
Loop Until isFinished

'close the process
proc.Close()

End Function

'For Multithreading
Protected Overloads Overrides Function launchSim(ByVal Thread_ID As Integer, ByVal Child_ID As Integer) As Boolean
'pass
End Function
Protected Overloads Overrides Function ThreadFree(ByRef Thread_ID As Integer) As Boolean
'pass
End Function
Protected Overloads Overrides Function ThreadReady(ByRef Thread_ID As Integer, ByRef SimIsOK As Boolean, ByVal Child_ID As Integer) As Boolean
'pass
End Function

''' <summary>
''' Simulationsergebnis einlesen
''' </summary>
''' <remarks></remarks>
Protected Overrides Sub SIM_Ergebnis_Lesen()
'TODO:

End Sub

End Class
1 change: 1 addition & 0 deletions BlueM.Opt/Common/Constants.vb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Public Module Constants
Public Const ANW_TALSIM5 As String = "TALSIM5"
Public Const ANW_TESTPROBLEMS As String = "Testproblems"
Public Const ANW_TSP As String = "Traveling Salesman"
Public Const ANW_GENERIC As String = "Generic"

'Optimierungsmethoden
Public Const METH_PES As String = "PES"
Expand Down
Loading
Loading