Skip to content

Commit

Permalink
added testfiles in root
Browse files Browse the repository at this point in the history
  • Loading branch information
perceptualrobots committed Oct 12, 2024
1 parent df1b2eb commit 50de3aa
Show file tree
Hide file tree
Showing 4 changed files with 253 additions and 1 deletion.
5 changes: 5 additions & 0 deletions nbs/18_applications.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
},
{
"cell_type": "code",
"execution_count": null,
Expand Down
2 changes: 1 addition & 1 deletion pct/applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def run_wind_turbine(target, drive, filepath):



# %% ../nbs/18_applications.ipynb 5
# %% ../nbs/18_applications.ipynb 6
# controller trained on steady dataset applied to steady dataset
run_wind_turbine('steady', "testfiles\\", "ga--1362.401-s003-4x3-m005-WT0538-bddf277b0f729cc630efacf91b9f494f.properties")
# controller trained on steady dataset applied to variable dataset
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# Date 2024-02-23 17:08:59.068611
# Result
# Best individual
raw = grid: [1, 2, 3, 2]
env: [['WindTurbine'], [1], [2], [4]] act: [[0.324], 0.556, 3.113, 10.526]
level0
col: 0 ref: [[0.536, -0.302], 0.376] per: [[-1.558, -0.12, 0.604], 0.448] out: [[-0.11], 0.443]
level1
col: 0 ref: [[0.033, 0.872, 0.369], 0.698] per: [[0.715], 0.389] out: [[-0.141], 0.94]
col: 1 ref: [[-0.818, -0.179, -0.915], 0.78] per: [[-0.559], 0.34] out: [[0.16], 0.544]
level2
col: 0 ref: [[0.779, 0.307], 0.351] per: [[-0.261, 0.032], 0.832] out: [[0.479], 0.814]
col: 1 ref: [[-0.463, 0.923], 0.494] per: [[-1.414, -0.447], 0.733] out: [[1.594], 0.517]
col: 2 ref: [[0.732, 0.457], 0.265] per: [[0.222, -0.028], 0.829] out: [[0.256], 0.081]
level3
col: 0 ref: [[-0.263]] per: [[0.014, 0.259, 0.967], 0.977] out: [[0.941], 0.96]col: 1 ref: [[0.741]] per: [[-0.587, 0.133, -0.436], 0.969] out: [[1.582], 0.522]

config = {'type': 'Individual', 'name': 'pcthierarchy', 'pre': {'pre0': {'type': 'WindTurbine', 'name': 'WindTurbine', 'value': [0.0, -0.0, 0.0, -0.0, 0.0, 0.0, 0.0], 'links': {0: 'Action1sgsm'}, 'env_name': 'YawEnv'}, 'pre1': {'type': 'IndexedParameter', 'name': 'IYE', 'value': -0.0, 'links': {0: 'WindTurbine'}, 'index': 1}, 'pre2': {'type': 'IndexedParameter', 'name': 'IWD', 'value': 0.0, 'links': {0: 'WindTurbine'}, 'index': 2}, 'pre3': {'type': 'IndexedParameter', 'name': 'IWS', 'value': 0.0, 'links': {0: 'WindTurbine'}, 'index': 4}}, 'levels': {'level0': {'level': 0, 'nodes': {'col0': {'col': 0, 'node': {'type': 'PCTNode', 'name': 'L0C0', 'refcoll': {'0': {'type': 'EASmoothWeightedSum', 'name': 'RL0C0sm', 'value': -0.0, 'links': {0: 'OL1C0sm', 1: 'OL1C1sm'}, 'weights': [0.5363283431225842, -0.3020876246108368], 'smooth_factor': 0.37626808573352905}}, 'percoll': {'0': {'type': 'EASmoothWeightedSum', 'name': 'PL0C0sm', 'value': 0.0, 'links': {0: 'IYE', 1: 'IWD', 2: 'IWS'}, 'weights': [-1.558107094645247, -0.12006569048610073, 0.6039925484415403], 'smooth_factor': 0.447644445087388}}, 'comcoll': {'0': {'type': 'Subtract', 'name': 'CL0C0', 'value': -0.0, 'links': {0: 'RL0C0sm', 1: 'PL0C0sm'}}}, 'outcoll': {'0': {'type': 'EASmoothWeightedSum', 'name': 'OL0C0sm', 'value': 0.0, 'links': {0: 'CL0C0'}, 'weights': [-0.11032634192252495], 'smooth_factor': 0.4432600555050679}}}}}}, 'level1': {'level': 1, 'nodes': {'col0': {'col': 0, 'node': {'type': 'PCTNode', 'name': 'L1C0', 'refcoll': {'0': {'type': 'EASmoothWeightedSum', 'name': 'RL1C0sm', 'value': 0.0, 'links': {0: 'OL3C0sm', 1: 'OL3C1sm', 2: 'OL2C2sm'}, 'weights': [0.03342461926527114, 0.8716030856155681, 0.368760690878422], 'smooth_factor': 0.6982397795546179}}, 'percoll': {'0': {'type': 'EASmoothWeightedSum', 'name': 'PL1C0sm', 'value': 0.0, 'links': {0: 'PL0C0sm'}, 'weights': [0.7145668630555149], 'smooth_factor': 0.389132815098737}}, 'comcoll': {'0': {'type': 'Subtract', 'name': 'CL1C0', 'value': -0.0, 'links': {0: 'RL1C0sm', 1: 'PL1C0sm'}}}, 'outcoll': {'0': {'type': 'EASmoothWeightedSum', 'name': 'OL1C0sm', 'value': 0.0, 'links': {0: 'CL1C0'}, 'weights': [-0.14090033152754525], 'smooth_factor': 0.9395346113510177}}}}, 'col1': {'col': 1, 'node': {'type': 'PCTNode', 'name': 'L1C1', 'refcoll': {'0': {'type': 'EASmoothWeightedSum', 'name': 'RL1C1sm', 'value': 0.0, 'links': {0: 'OL3C0sm', 1: 'OL3C1sm', 2: 'OL2C2sm'}, 'weights': [-0.817545889491226, -0.1794117608370509, -0.9152587743035161], 'smooth_factor': 0.7802394727937287}}, 'percoll': {'0': {'type': 'EASmoothWeightedSum', 'name': 'PL1C1sm', 'value': -0.0, 'links': {0: 'PL0C0sm'}, 'weights': [-0.5594095205000766], 'smooth_factor': 0.3396145514762595}}, 'comcoll': {'0': {'type': 'Subtract', 'name': 'CL1C1', 'value': 0.0, 'links': {0: 'RL1C1sm', 1: 'PL1C1sm'}}}, 'outcoll': {'0': {'type': 'EASmoothWeightedSum', 'name': 'OL1C1sm', 'value': 0.0, 'links': {0: 'CL1C1'}, 'weights': [0.1597689123312396], 'smooth_factor': 0.5441298527436246}}}}}}, 'level2': {'level': 2, 'nodes': {'col0': {'col': 0, 'node': {'type': 'PCTNode', 'name': 'L2C01', 'refcoll': {'0': {'type': 'EASmoothWeightedSum', 'name': 'RL2C0sm', 'value': 0.0, 'links': {0: 'OL3C0sm', 1: 'OL3C1sm'}, 'weights': [0.7794309545691012, 0.30655984453012763], 'smooth_factor': 0.35100372423554105}}, 'percoll': {'0': {'type': 'EASmoothWeightedSum', 'name': 'PL2C0sm', 'value': -0.0, 'links': {0: 'PL1C0sm', 1: 'PL1C1sm'}, 'weights': [-0.2608923910197565, 0.03241143536343023], 'smooth_factor': 0.8316554600284902}}, 'comcoll': {'0': {'type': 'Subtract', 'name': 'CL2C0', 'value': 0.0, 'links': {0: 'RL2C0sm', 1: 'PL2C0sm'}}}, 'outcoll': {'0': {'type': 'EASmoothWeightedSum', 'name': 'OL2C0sm', 'value': 0.0, 'links': {0: 'CL2C0'}, 'weights': [0.47923235551870413], 'smooth_factor': 0.8142967728955316}}}}, 'col1': {'col': 1, 'node': {'type': 'PCTNode', 'name': 'L2C11', 'refcoll': {'0': {'type': 'EASmoothWeightedSum', 'name': 'RL2C1sm', 'value': 0.0, 'links': {0: 'OL3C0sm', 1: 'OL3C1sm'}, 'weights': [-0.4626689327121205, 0.923021022955252], 'smooth_factor': 0.49446943756748596}}, 'percoll': {'0': {'type': 'EASmoothWeightedSum', 'name': 'PL2C1sm', 'value': -0.0, 'links': {0: 'PL1C0sm', 1: 'PL1C1sm'}, 'weights': [-1.4141771552560118, -0.44722788263550833], 'smooth_factor': 0.7329289542663316}}, 'comcoll': {'0': {'type': 'Subtract', 'name': 'CL2C1', 'value': 0.0, 'links': {0: 'RL2C1sm', 1: 'PL2C1sm'}}}, 'outcoll': {'0': {'type': 'EASmoothWeightedSum', 'name': 'OL2C1sm', 'value': 0.0, 'links': {0: 'CL2C1'}, 'weights': [1.5937222695846318], 'smooth_factor': 0.5170907286001206}}}}, 'col2': {'col': 2, 'node': {'type': 'PCTNode', 'name': 'L2C2', 'refcoll': {'0': {'type': 'EASmoothWeightedSum', 'name': 'RL2C2sm', 'value': 0.0, 'links': {0: 'OL3C0sm', 1: 'OL3C1sm'}, 'weights': [0.7319247445836443, 0.4565144821856246], 'smooth_factor': 0.26519574223408493}}, 'percoll': {'0': {'type': 'EASmoothWeightedSum', 'name': 'PL2C2sm', 'value': 0.0, 'links': {0: 'PL1C0sm', 1: 'PL1C1sm'}, 'weights': [0.22177756590119446, -0.028450834296690486], 'smooth_factor': 0.8288556433078511}}, 'comcoll': {'0': {'type': 'Subtract', 'name': 'CL2C2', 'value': -0.0, 'links': {0: 'RL2C2sm', 1: 'PL2C2sm'}}}, 'outcoll': {'0': {'type': 'EASmoothWeightedSum', 'name': 'OL2C2sm', 'value': -0.0, 'links': {0: 'CL2C2'}, 'weights': [0.2560116707412241], 'smooth_factor': 0.080754960161875}}}}}}, 'level3': {'level': 3, 'nodes': {'col0': {'col': 0, 'node': {'type': 'PCTNode', 'name': 'L3C0', 'refcoll': {'0': {'type': 'EAVariable', 'name': 'RL3C0v', 'value': -0.2629598007970895, 'links': {}}}, 'percoll': {'0': {'type': 'EASmoothWeightedSum', 'name': 'PL3C0sm', 'value': -0.0, 'links': {0: 'PL2C0sm', 1: 'PL2C1sm', 2: 'PL2C2sm'}, 'weights': [0.014127194348241112, 0.25880838603740736, 0.9667309962355382], 'smooth_factor': 0.9765002553969074}}, 'comcoll': {'0': {'type': 'Subtract', 'name': 'CL3C0', 'value': -0.0, 'links': {0: 'RL3C0v', 1: 'PL3C0sm'}}}, 'outcoll': {'0': {'type': 'EASmoothWeightedSum', 'name': 'OL3C0sm', 'value': -0.0, 'links': {0: 'CL3C0'}, 'weights': [0.9413255437600909], 'smooth_factor': 0.9600776044794335}}}}, 'col1': {'col': 1, 'node': {'type': 'PCTNode', 'name': 'L3C1', 'refcoll': {'0': {'type': 'EAVariable', 'name': 'RL3C1v', 'value': 0.740559685914173, 'links': {}}}, 'percoll': {'0': {'type': 'EASmoothWeightedSum', 'name': 'PL3C1sm', 'value': -0.0, 'links': {0: 'PL2C0sm', 1: 'PL2C1sm', 2: 'PL2C2sm'}, 'weights': [-0.5866590200441408, 0.13308212374784328, -0.4364789547389667], 'smooth_factor': 0.9690583303072999}}, 'comcoll': {'0': {'type': 'Subtract', 'name': 'CL3C1', 'value': 0.0, 'links': {0: 'RL3C1v', 1: 'PL3C1sm'}}}, 'outcoll': {'0': {'type': 'EASmoothWeightedSum', 'name': 'OL3C1sm', 'value': 0.0, 'links': {0: 'CL3C1'}, 'weights': [1.5815798270415076], 'smooth_factor': 0.5223941213718245}}}}}}}, 'post': {'post0': {'type': 'EASigmoidSmoothWeightedSum', 'name': 'Action1sgsm', 'value': 0.0, 'links': {0: 'OL0C0sm'}, 'weights': [0.3242848335373043], 'smooth_factor': 0.5557635679321964, 'range': 3.112778680400676, 'slope': 10.526381208137458}}}
score = -1362.40147
# Time 0.8706

### Description:

desc = RewardError-SummedError-Mode05
arch_name = WT0538

### Environment parameters

# Full list of input indexes from environment
# List of input indexes from environment for zero level if not full
# List of input indexes from environment for top level# List of reference values
# Number of actions
# Display names for environment inputs

env_name = WindTurbine
env_inputs_indexes = [1, 2, 4]
zerolevel_inputs_indexes = None
toplevel_inputs_indexes = None
references = [0, 0]
num_actions = 1
env_inputs_names = [IYE,IWD,IWS,IPW]
environment_properties={'series': 'steady', 'zero_threshold': 1, 'reward_type': 'power'}

### Configurable parameters

# Randomisation seed to reproduce results
# Size of population
# Number of generations
# Probability that an attribute will be mutated
# Probability that the structure will be mutated
# Number of runs of environment
# Lower limit of float values
# Upper limit of float values
# Initial limit of levels
# Initial limit of columns
# Lower limit of levels
# Lower limit of columns
# Limit of error on which to terminate individual evaluation
# Probability for crossover
# Probability for mutating an individual
# Number of times the evaulation is run (with different random seeds)
# Type of errors collected
# Error function

seed = 3
pop_size = 100
gens = 10
attr_mut_pb = 1
structurepb = 0.9
runs = 1000
lower_float = -1
upper_float = 1
min_levels_limit = 2
min_columns_limit = 2
max_levels_limit = 5
max_columns_limit = 5
early_termination = False
error_limit = None
p_crossover = 0.9
p_mutation = 0.75
nevals = 1
error_collector_type = RewardError
error_response_type = SummedError


### Structure

# modes - pattern of nodes at particular levels, zero, n, top and zerotop
# the mode numbers refer to:
# 0 - per:bin-ws, ref:flt-ws, com:sub, out:flt-ws

mode = 5
type1 = HPCTLEVEL.ZEROTOP^HPCTFUNCTION.REFERENCE^HPCTVARIABLE.TYPE^Float
type2 = HPCTLEVEL.ZEROTOP^HPCTFUNCTION.REFERENCE^HPCTVARIABLE.FUNCTION_CLASS^EAVariable
type3 = HPCTLEVEL.ZEROTOP^HPCTFUNCTION.REFERENCE^HPCTVARIABLE.PROPERTIES^{'lower_float': -1, 'upper_float': 1}
type4 = HPCTLEVEL.TOP^HPCTFUNCTION.REFERENCE^HPCTVARIABLE.TYPE^Float
type5 = HPCTLEVEL.TOP^HPCTFUNCTION.REFERENCE^HPCTVARIABLE.FUNCTION_CLASS^EAVariable
type6 = HPCTLEVEL.TOP^HPCTFUNCTION.REFERENCE^HPCTVARIABLE.PROPERTIES^{'lower_float': -1, 'upper_float': 1}





### gen pop min mean max mut muts timing
### 0 100 -1329.244 -1329.244 -1329.244
### 1 100 -1335.192 -776.890 -14.466 76% 49% 1.570
### 2 100 -1356.544 -897.118 -14.466 74% 51% 0.765
### 3 100 -1356.544 -865.212 -15.490 73% 50% 0.732
### 4 100 -1356.544 -901.502 -16.525 73% 43% 0.657
### 5 100 -1359.990 -1053.609 -14.466 80% 51% 0.810
### 6 100 -1359.990 -1119.561 -14.466 73% 46% 0.925
### 7 100 -1361.388 -956.733 -14.466 76% 52% 0.865
### 8 100 -1361.388 -1052.702 -15.490 79% 60% 0.801
### 9 100 -1361.388 -977.938 -16.525 76% 53% 0.810
### 10 100 -1362.401 -890.665 -14.466 74% 53% 0.772
# Best Score: -1362.40147
# Best Ind: [[[['WindTurbine'], [1], [2], [4]], [[[0.3242848335373043], 0.5557635679321964, 3.112778680400676, 10.526381208137458]]], [[[[[0.5363283431225842, -0.3020876246108368], 0.37626808573352905]], [[[-1.558107094645247, -0.12006569048610073, 0.6039925484415403], 0.447644445087388]], [[[-0.11032634192252495], 0.4432600555050679]]]], [[[[[0.03342461926527114, 0.8716030856155681, 0.368760690878422], 0.6982397795546179]], [[[0.7145668630555149], 0.389132815098737]], [[[-0.14090033152754525], 0.9395346113510177]]], [[[[-0.817545889491226, -0.1794117608370509, -0.9152587743035161], 0.7802394727937287]], [[[-0.5594095205000766], 0.3396145514762595]], [[[0.1597689123312396], 0.5441298527436246]]]], [[[[[0.7794309545691012, 0.30655984453012763], 0.35100372423554105]], [[[-0.2608923910197565, 0.03241143536343023], 0.8316554600284902]], [[[0.47923235551870413], 0.8142967728955316]]], [[[[-0.4626689327121205, 0.923021022955252], 0.49446943756748596]], [[[-1.4141771552560118, -0.44722788263550833], 0.7329289542663316]], [[[1.5937222695846318], 0.5170907286001206]]], [[[[0.7319247445836443, 0.4565144821856246], 0.26519574223408493]], [[[0.22177756590119446, -0.028450834296690486], 0.8288556433078511]], [[[0.2560116707412241], 0.080754960161875]]]], [[[[-0.2629598007970895]], [[[0.014127194348241112, 0.25880838603740736, 0.9667309962355382], 0.9765002553969074]], [[[0.9413255437600909], 0.9600776044794335]]], [[[0.740559685914173]], [[[-0.5866590200441408, 0.13308212374784328, -0.4364789547389667], 0.9690583303072999]], [[[1.5815798270415076], 0.5223941213718245]]]]]
# Mean time: 0.871
Loading

0 comments on commit 50de3aa

Please sign in to comment.