' DWSIM Interface definitions
' Copyright 2020-2022 Daniel Wagner O. de Medeiros
'
' This file is part of DWSIM.
'
' DWSIM 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.
'
' DWSIM 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 DWSIM. If not, see .
Public Interface IExternalSolverIdentification
ReadOnly Property ID As String
ReadOnly Property Description As String
ReadOnly Property DisplayText As String
ReadOnly Property Category As Enums.ExternalSolverCategory
ReadOnly Property SupportsMultiThreading As Boolean
End Interface
Public Interface IExternalSolverConfiguration
Function Edit(jsonstring As String) As String
End Interface
Public Interface IExternalLinearSystemSolver
'''
''' Solves a system of linear equations.
'''
''' Left-side matrix
''' Right-side vector
''' The solution vector.
Function Solve(A As Double(,), B As Double()) As Double()
End Interface
Public Interface IExternalNonLinearSystemSolver
'''
''' Solves a system of non-linear equations.
'''
''' Function which gets the current x values and returns the function values.
''' Optional. Function which gets the current x values and returns the gradient values.
''' Function called n each iteration step. First argument is the x-vector, second argument is f-vector. Return true to stop the iterations or false to continue.
''' Initial value of the variables.
''' Maximum iterations.
''' Tolerance for solution.
''' The solution vector.
Function Solve(functionbody As Func(Of Double(), Double()),
functiongradient As Func(Of Double(), Double(,)),
iterationcallback As Func(Of Double(), Double(), Boolean),
vars As Double(),
maxits As Integer,
tolerance As Double) As Double()
End Interface
Public Interface IExternalNonLinearMinimizationSolver
ReadOnly Property SupportsBoundedVariables As Boolean
ReadOnly Property IterationsTaken As Integer
ReadOnly Property FinalValue As Double
'''
''' Minimizes a black-box non-linear equation.
'''
''' Function which gets the current x values and returns the function value.
''' Optional. Function which gets the current x values and returns the gradient values.
''' Function called n each iteration step. First argument is the x-vector, second argument is function value. Return true to stop the iterations or false to continue.
''' Initial value of the variables.
''' Optional. Lower bounds for variables.
''' Optional. Upper bounds for variables.
''' Maximum iterations.
''' Tolerance for solution.
''' The solution vector corresponding to the function minimum.
Function Solve(functionbody As Func(Of Double(), Double),
functiongradient As Func(Of Double(), Double()),
iterationcallback As Func(Of Double(), Double, Boolean),
vars As Double(),
lbounds As Double(),
ubounds As Double(),
maxits As Integer,
tolerance As Double) As Double()
End Interface
Public Interface IExternalODESolver
'''
''' Method that initializes the ODE to solve.
'''
''' A function that evaluates the right side of the differential equations.
''' The number of differential equations.
''' The initial value for the independent variable.
''' A vector of size N containing the initial conditions. N is the number of differential equations.
Sub InitializeODEs(odefunc As Func(Of Double, Double(), Double()), n As Integer, x0 As Double, y0 As Double())
'''
''' Computes the solution of the ordinary differential equations.
'''
''' A vector of size N containing the initial conditions. N is the number of differential equations.
''' The initial independent variable value.
''' The step for the interval of integration (x0, x0+deltax, x0+2*deltax,...,xf).
''' The final independent variable value.
''' A delegate where to return the solution.
''' Tolerance for solution.
Sub Solve(y0 As Double(), x0 As Double, deltax As Double, xf As Double, odesolution As Action(Of Double, Double()), tolerance As Double)
End Interface