-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathVBAF.psm1
More file actions
170 lines (134 loc) · 5.26 KB
/
VBAF.psm1
File metadata and controls
170 lines (134 loc) · 5.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
#Requires -Version 5.1
<#
.SYNOPSIS
VBAF (Visual Business Automation Framework) Module Loader
.DESCRIPTION
Loads all VBAF components using existing VBAF.LoadAll.ps1 and adds public API functions.
This module provides a complete AI/RL framework built from scratch in PowerShell 5.1:
- Neural networks with backpropagation
- Q-Learning agents with experience replay
- Multi-agent reinforcement learning
- Real-time visualization dashboards
- Business simulation environments
- Generative art with aesthetic rewards
.NOTES
Author: Henning
Version: 1.0.0
PowerShell: 5.1+
.EXAMPLE
Import-Module VBAF
$nn = New-VBAFNeuralNetwork -Architecture @(2,3,1) -LearningRate 0.1
.EXAMPLE
Import-Module VBAF
$agent = New-VBAFAgent -Type QLearning -Actions @("up","down","left","right")
#>
# Get module root path
$script:ModuleRoot = $PSScriptRoot
Write-Verbose "Loading VBAF Module from: $script:ModuleRoot"
# ==================== LOAD ASSEMBLIES ====================
Add-Type -AssemblyName System.Windows.Forms -ErrorAction SilentlyContinue
Add-Type -AssemblyName System.Drawing -ErrorAction SilentlyContinue
# ==================== LOAD ALL CLASSES USING EXISTING LOADER ====================
Write-Verbose " Loading all VBAF classes via VBAF.LoadAll.ps1..."
# Use the existing, working VBAF.LoadAll.ps1
$loadAllPath = Join-Path $PSScriptRoot "VBAF.LoadAll.ps1"
if (Test-Path $loadAllPath) {
# Suppress the welcome messages from LoadAll
$originalVerbose = $VerbosePreference
$VerbosePreference = 'SilentlyContinue'
# Load all classes
. $loadAllPath
$VerbosePreference = $originalVerbose
Write-Verbose " ? All classes loaded via VBAF.LoadAll.ps1"
} else {
Write-Warning "VBAF.LoadAll.ps1 not found at: $loadAllPath"
Write-Warning "Classes may not be available. Expected location: $loadAllPath"
}
# ==================== LOAD ART CLASSES (New ones not in LoadAll) ====================
Write-Verbose " Loading new Art classes..."
# AestheticReward (created in this session)
if (Test-Path "$script:ModuleRoot\VBAF.Art.AestheticReward.ps1") {
. "$script:ModuleRoot\VBAF.Art.AestheticReward.ps1"
Write-Verbose " ? Loaded: AestheticReward"
}
# CastleCompetition (created in this session)
if (Test-Path "$script:ModuleRoot\VBAF.Art.CastleCompetition.ps1") {
. "$script:ModuleRoot\VBAF.Art.CastleCompetition.ps1"
Write-Verbose " ? Loaded: CastleCompetition"
}
Write-Verbose " ? Art classes loaded"
# ==================== LOAD PUBLIC FUNCTIONS ====================
Write-Verbose " Loading Public API functions..."
# Get all public function files
$PublicFunctions = @(Get-ChildItem -Path "$script:ModuleRoot\VBAF.Public.*.ps1" -ErrorAction SilentlyContinue)
# Dot source each function
foreach ($Function in $PublicFunctions) {
try {
. $Function.FullName
Write-Verbose " ? Loaded: $($Function.BaseName)"
} catch {
Write-Error "Failed to import function $($Function.FullName): $_"
}
}
Write-Verbose " ? Public API functions loaded ($($PublicFunctions.Count) functions)"
# ==================== MODULE INITIALIZATION ====================
# Module version
$script:VBAFVersion = '1.0.0'
# Module startup message
$script:ShowWelcomeMessage = $true
if ($script:ShowWelcomeMessage) {
Write-Host ""
Write-Host " - oo00oo - " -ForegroundColor Yellow
Write-Host " VBAF v$script:VBAFVersion Loaded" -ForegroundColor Cyan
Write-Host " Visual Business Automation Framework" -ForegroundColor Cyan
Write-Host " - oo00oo - " -ForegroundColor Yellow
Write-Host ""
Write-Host " Quick Start:" -ForegroundColor Green
Write-Host " Get-VBAFExamples # View available examples" -ForegroundColor White
Write-Host " Get-VBAFVersion # Show module info" -ForegroundColor White
Write-Host " Get-Command -Module VBAF # List all commands" -ForegroundColor White
Write-Host ""
}
# ==================== EXPORTED MEMBERS ====================
# Export functions (defined in manifest, but we can also export here for safety)
Export-ModuleMember -Function @(
# Neural Network Functions
'New-VBAFNeuralNetwork',
'Train-VBAFNeuralNetwork',
'Test-VBAFNeuralNetwork',
'Export-VBAFNeuralNetwork',
'Import-VBAFNeuralNetwork',
# RL Agent Functions
'New-VBAFAgent',
'Train-VBAFAgent',
'Get-VBAFAgentStats',
'Export-VBAFAgent',
'Import-VBAFAgent',
# Market/Business Functions
'New-VBAFMarket',
'Start-VBAFMarketSimulation',
'Get-VBAFMarketStats',
# Visualization Functions
'New-VBAFDashboard',
'Show-VBAFLearningCurve',
'Show-VBAFNetworkStructure',
# Competition Functions
'Start-VBAFCastleCompetition',
'New-VBAFAestheticReward',
# Utility Functions
'Get-VBAFVersion',
'Get-VBAFExamples',
'Test-VBAF'
)
# Export module variables (if any)
Export-ModuleMember -Variable @(
'ModuleRoot',
'VBAFVersion'
)
# ==================== MODULE CLEANUP ====================
# Register cleanup on module removal
$ExecutionContext.SessionState.Module.OnRemove = {
Write-Verbose "Unloading VBAF module..."
# Cleanup code here if needed (e.g., close open dashboards, save state)
}
Write-Verbose "VBAF Module loaded successfully!"