Description Structure corresponding to entries on the Optimization Variables Tab of the Optimization dialog.
Definition Type T_MZRVARIABLE currentvalue As Double entity As Long End Type
Members currentvalue Current value of variable.
initialvalue Corresponds to the "Previous Value" column as displayed in the Define/Edit Optimization dialog in the GUI. Indicates the variable value at the beginning of the previous optimization. FRED retrieves and displays this value after an optimization cycle is completed.
upperlimit Variable upper limit.
lowerlimit Variable lower limit.
fracstep Fraction of the variable's upper-to-lower limit distance applied to variables when setting the initial simplex at the beginning an optimization execution.
entity Node number of entity related to variable.
index Index of variable. See Optimization Variables.
subindex Sub-Index of variable. See Optimization Variables.
fractionvar Index of variable to which current variable is a fraction. Use -1 for "not fraction".
description Text description of variable.
type Specifies the variable type. Options are:
script String containing complete user-defined script, if the variable type requires it.
active Flag to enable/disable variable.
Example The following example loops over the optimization results list and writes out the data for each result to a text file using a custom subroutine.
Sub Main
'File where optimization results are being written Dim outFile As String outFile = "C:\temp\optimizationResults.txt" Open outFile For Output As #1
'Number of results in the current list Dim numResults As Long numResults = GetMzrResultCount()
'Loop over results, write to file Dim res As T_MZRRESULT Dim curResult As Long For curResult = numResults-1 To 0 Step -1 GetMzrResult( curResult, res ) printResultToFile( res ) Next curResult
'Close output file Close #1
End Sub
Sub printResultToFile( ByVal res As Variant )
'Print result generic info Print #1, "BEGIN RESULT INFO" Print #1, Chr(9) & "Comment: " & res.comment Print #1, Chr(9) & "Merit Function: " & res.meritfunc Print #1, ""
'Print result variable information Dim curVar As Long For curVar = 0 To UBound( res.variables, 1 ) Print #1, Chr(9) & "Variable " & curVar & ":" Print #1, Chr(9) & Chr(9) & "Active: " & res.variables(curVar).active Print #1, Chr(9) & Chr(9) & "Value: " & res.variables(curVar).currentvalue Print #1, Chr(9) & Chr(9) & "Description: " & res.variables(curVar).Description Print #1, Chr(9) & Chr(9) & "Entity: " & res.variables(curVar).entity Print #1, Chr(9) & Chr(9) & "Fraction Step: " & res.variables(curVar).fracstep Print #1, Chr(9) & Chr(9) & "Fraction Variable: " & res.variables(curVar).fractionvar Print #1, Chr(9) & Chr(9) & "Index: " & res.variables(curVar).index Print #1, Chr(9) & Chr(9) & "Previous Value: " & res.variables(curVar).initialvalue Print #1, Chr(9) & Chr(9) & "Lower Limit: " & res.variables(curVar).lowerlimit Print #1, Chr(9) & Chr(9) & "Script: " & res.variables(curVar).Script Print #1, Chr(9) & Chr(9) & "Sub-index: " & res.variables(curVar).subindex Print #1, Chr(9) & Chr(9) & "Type: " & res.variables(curVar).Type Print #1, Chr(9) & Chr(9) & "Upper Limit: " & res.variables(curVar).upperlimit Print #1, "" Next curVar
End Sub
See Also
|