start of simplification

This commit is contained in:
Rowan Torbitzky-Lane 2025-03-05 00:55:18 -06:00
parent d1d36eb3aa
commit bac7751a83
2 changed files with 20 additions and 0 deletions

View File

@ -68,6 +68,7 @@ library
, HushGP.GP.PushData
, HushGP.GP.Selection
, HushGP.GP.Individual
, HushGP.GP.Simplification
, HushGP.Problems.IntegerRegression
, HushGP.Tools.Metrics

View File

@ -0,0 +1,19 @@
module HushGP.GP.Simplification where
import Control.Monad
import HushGP.State
import HushGP.GP.PushArgs
-- | Simplifies a Plushy by randomly deleting instructions and seeing how it impacts
-- performance. Removes genes that have zero to negative performance impact.
autoSimplifyPlushy :: PushArgs -> [Gene] -> IO [Gene]
autoSimplifyPlushy pushArgs@PushArgs{simplificationVerbose = simpVerbose, errorFunction = eFunc, trainingData = tData} plushy = do
when simpVerbose (print ("simplification start plushy length: " <> show (length plushy)))
autoSimplifyPlushy' pushArgs (eFunc pushArgs tData plushy) 0 plushy
autoSimplifyPlushy' :: PushArgs -> [Double] -> Int -> [Gene] -> IO [Gene]
autoSimplifyPlushy' pushArgs@PushArgs{simplificationSteps = simpSteps} initialErrors step plushy
| step < simpSteps = do
newPlushy <- undefined
undefined
| otherwise = undefined