Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/19/19 05:05:24 (5 years ago)
Author:
hmaislin
Message:

#2929: Fixed result bug, added multitest C / Powershell, passed pagie_1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2929_PrioritizedGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.PGE/3.3/TestResults.ps1

    r16533 r16614  
    1 param(
    2     [switch] $GenerateNew = $true,
    3     [int] $WaitToStep = 200
     1[cmdletbinding()]
     2param(
     3    [int] $WaitToStep = 200,
     4    [string] $BenchName = "Pagie_1",
     5    [int] $PeelCnt = 3,
     6    [int] $EvalCnt = 3,
     7    [ValidateSet("method1","method2", "method3")][string] $InitMethod = "method1",
     8    [ValidateSet("method1","method2", "method3")][string] $GrowMethod = "method1",
     9    [bool] $Clear
    410)
    511
     12$GenerateNew = $true
    613
    7 $CLog = Join-Path -Path $(Resolve-Path $PSScriptRoot) -ChildPath 'CGen.log'
    8 $GoLog = Join-Path -Path $(Resolve-Path $PSScriptRoot) -ChildPath 'GoOut.log'
     14$CLog = Join-Path -Path $(Resolve-Path $PSScriptRoot) -ChildPath "CGen_$($BenchName).log"
     15$GoLog = Join-Path -Path $(Resolve-Path $PSScriptRoot) -ChildPath "GoOut_$($BenchName).log"
    916
    10 $CExecutable = Join-Path -Path $(Resolve-Path $PSScriptRoot) -ChildPath 'a.exe'
     17$CLogError = Join-Path -Path $(Resolve-Path $PSScriptRoot) -ChildPath "CGen_$($BenchName).err"
     18$GoLogError = Join-Path -Path $(Resolve-Path $PSScriptRoot) -ChildPath "GoOut_$($BenchName).err"
     19
     20$CExecutable = Join-Path -Path $(Resolve-Path $PSScriptRoot) -ChildPath 'testmulti.exe'
    1121$GoExecutable = Join-Path -Path $(Resolve-Path $PSScriptRoot) -ChildPath 'go-code\go-pge\go-pge.exe'
    1222
    13 
    1423if($GenerateNew) {
    15     $CGenProc = Start-Process -FilePath $CExecutable -RedirectStandardOutput $CLog -WorkingDirectory $PSScriptRoot -PassThru
     24  if(Test-Path $GoLog -Type Leaf) {
     25    Remove-Item -Path $GoLog
     26  }
     27  if(Test-Path $CLog -Type Leaf) {
     28    Remove-Item -Path $CLog
     29    }
     30    if(Test-Path $GoLogError -Type Leaf) {
     31        Remove-Item -Path $GoLogError
     32    }
     33    if(Test-Path $CLogError -Type Leaf) {
     34        Remove-Item -Path $CLogError
     35    }
     36 
     37    $CGenProc = Start-Process -FilePath $CExecutable -ArgumentList "$BenchName -evals=$($EvalCnt) -peel=$($PeelCnt) -iter=$($WaitToStep) -init=$($InitMethod) -grow=$($GrowMethod)" -RedirectStandardOutput $CLog -RedirectStandardError $CLogError -WorkingDirectory $PSScriptRoot -PassThru
    1638    $StepReached = $false
    1739    while(-not $StepReached) {
     
    2547    $CGenProc  | Stop-Process -ErrorAction SilentlyContinue
    2648
    27 
    28     $GoGenProc = Start-Process -FilePath $GoExecutable -ArgumentList "-pcfg=prob/bench/Pagie_1.cfg -evals=3 -peel=3 -iter=$WaitToStep -init=method1 -grow=method1"  -RedirectStandardOutput $GoLog -WorkingDirectory $(Join-Path -Path $PSScriptRoot -ChildPath 'go-code\go-pge') -PassThru
     49  $env:GOGC="off"
     50  $env:GODEBUG="cgocheck=0"
     51  $env:CGO_ENABLED=1
     52    $GoGenProc = Start-Process -FilePath $GoExecutable -ArgumentList "-pcfg=prob/bench/$($BenchName).cfg -evals=$($EvalCnt) -peel=$($PeelCnt) -iter=$($WaitToStep) -init=$($InitMethod) -grow=$($GrowMethod)"  -RedirectStandardOutput $GoLog -RedirectStandardError $GoLogError -WorkingDirectory $(Split-Path -Path $GoExecutable -Parent) -PassThru
    2953    $StepReached = $false
    3054    while(-not $StepReached) {
     
    4872            [int]$CurrentStep = $Matches[1]
    4973            $ValueList[$CurrentStep] = $(New-Object -TypeName System.Collections.ArrayList)
    50         } elseif($Line -match "push\/pop \(\d+\,\d+\) \((.+)\)") {
    51             $ValueList[$CurrentStep].Add($Matches[1].Trim().Replace(' ', '')) | Out-Null
     74        } elseif($Line -match "push\/pop \(\d+\,\d+\) (.+)") {
     75            $ValueList[$CurrentStep].Add($Matches[1].Trim().Replace('(', '').Replace(')', '').Replace(' ', '')) | Out-Null
    5276        }
    5377    }
     
    6488            $ValueList[$CurrentStep] = $(New-Object -TypeName System.Collections.ArrayList)
    6589        } elseif($Line -match "pop\/push\(\d+\,\d+\)\: (.+)") {
    66             $ValueList[$CurrentStep].Add($Matches[1].Trim().Trim('(').Trim(')').Replace(' ', '')) | Out-Null
     90            $ValueList[$CurrentStep].Add($Matches[1].Trim().Replace('(', '').Replace(')', '').Replace(' ', '')) | Out-Null
    6791        }
    6892    }
     
    7599        [string]$Second
    76100    )
    77     $FirstChars = $First.Trim().ToUpper().ToCharArray() | Sort
    78     $SecondChars = $Second.Trim().ToUpper().ToCharArray() | Sort
     101    $FirstChars = $First.Trim().ToUpper().ToCharArray() | Sort-Object
     102    $SecondChars = $Second.Trim().ToUpper().ToCharArray() | Sort-Object
    79103
    80104    [System.Collections.ArrayList]$LeftChars = $SecondChars.Clone()
     
    98122$ParseGo = Get-GoSteps -Content $GoContent
    99123
    100 foreach($StepNr in $($ParseGo.Keys | Sort)) {
     124foreach($StepNr in $($ParseGo.Keys | Sort-Object | Where-Object { $_ -ne 0 -and $_ -le $WaitToStep})) {
    101125    $GoResult = $ParseGo[$StepNr]
    102     [System.Collections.ArrayList]$CResult = $ParseC[$StepNr + 1]
     126    [System.Collections.ArrayList]$CResult = $ParseC[$StepNr]
    103127
    104     if($CResult -eq $null -or $CResult.Count -lt 1) {
    105         Write-Information "Missing CStep nr. $StepNr"
     128    if($null -eq $CResult -or $CResult.Count -lt 1) {
     129        Write-Warning "Missing CStep nr. $StepNr"
    106130        continue
    107131    }
    108     if($GoResult -eq $null -or $GoResult.Count -lt 1) {
    109         Write-Information "Missing GoStep nr. $StepNr"
     132    if($null -eq $GoResult -or $GoResult.Count -lt 1) {
     133        Write-Warning "Missing GoStep nr. $StepNr"
    110134        continue
    111135    }
     
    115139        $State = $false
    116140        foreach($CRes in $CResult.Clone()) {  # Compare every Result with every Step Result
    117             Write-Debug "$($GoRes) with $($CRes)"
     141            Write-Output "$($GoRes) with $($CRes)"
    118142            if(Compare-Results -First $GoRes -Second $CRes) {
    119143                $State = $true
     
    128152
    129153    if($StepResult) {
    130         Write-Host "$StepNr OK"
     154        Write-Output "$StepNr OK"
    131155    } else {
    132156        Write-Warning "$StepNr failed!"
    133157    }
    134158}
     159
     160if($Clear) {
     161    if(Test-Path $GoLog -Type Leaf) {
     162        Remove-Item -Path $GoLog
     163    }
     164    if(Test-Path $CLog -Type Leaf) {
     165        Remove-Item -Path $CLog
     166    }
     167    if(Test-Path $GoLogError -Type Leaf) {
     168        Remove-Item -Path $GoLogError
     169    }
     170    if(Test-Path $CLogError -Type Leaf) {
     171        Remove-Item -Path $CLogError
     172    }
     173}
Note: See TracChangeset for help on using the changeset viewer.