This commit is contained in:
Johannes Merl 2024-04-21 13:22:14 +02:00
parent 8432103a18
commit 0862943ebc
4 changed files with 27 additions and 26 deletions

View File

@ -2,17 +2,17 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1655624069,
"narHash": "sha256-7g1zwTdp35GMTERnSzZMWJ7PG3QdDE8VOX3WsnOkAtM=",
"lastModified": 1713145326,
"narHash": "sha256-m7+IWM6mkWOg22EC5kRUFCycXsXLSU7hWmHdmBfmC3s=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "0d68d7c857fe301d49cdcd56130e0beea4ecd5aa",
"rev": "53a2c32bc66f5ae41a28d7a9a49d321172af621e",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "0d68d7c857fe301d49cdcd56130e0beea4ecd5aa",
"rev": "53a2c32bc66f5ae41a28d7a9a49d321172af621e",
"type": "github"
}
},

View File

@ -2,8 +2,7 @@
description = "Flake for haga";
inputs = {
nixpkgs.url =
# 2022-06-22
"github:NixOS/nixpkgs/0d68d7c857fe301d49cdcd56130e0beea4ecd5aa";
"github:NixOS/nixpkgs/53a2c32bc66f5ae41a28d7a9a49d321172af621e";
};
@ -14,10 +13,12 @@
# defaultPackage.${system} = haskellPackages.callPackage ./default.nix { };
devShell.${system} = mkShell {
buildInputs = [
haskell.compiler.ghc981
git
gcc
gmp
feedgnuplot
haskellPackages.cabal-install
haskellPackages.ormolu
haskell.compiler.ghc8107
stack
];
};
};

View File

@ -49,8 +49,8 @@ library
, Pretty
, Szenario191
, LambdaCalculus
, GermanDataset
, GermanData
, NurseryDataset
, NurseryData
, Utils
executable haga
build-depends: base
@ -83,8 +83,8 @@ executable haga
, Pretty
, Szenario191
, LambdaCalculus
, GermanDataset
, GermanData
, NurseryDataset
, NurseryData
, Utils
executable haga-test
@ -119,6 +119,6 @@ executable haga-test
, Pretty
, Szenario191
, LambdaCalculus
, GermanDataset
, GermanData
, NurseryDataset
, NurseryData
, Utils

View File

@ -9,7 +9,7 @@ import Protolude hiding (for)
import System.IO
-- import Szenario212Pun
-- import Szenario191
import GermanDataset
import NurseryDataset
import Debug.Trace as DB
import qualified Data.Map.Strict as Map
@ -51,19 +51,19 @@ main :: IO ()
main =
execParser optionsWithHelp >>= \opts -> do
hSetBuffering stdout NoBuffering
germanLEE <- shuffledGermanLEE
let env = germanLE
nurseryLEE <- shuffledNurseryLEE
let env = nurseryLE
let selType = Tournament 3
let run' = run germanLEE env selType 80 (5 / 100) (populationSize opts) (steps (iterations opts))
let run' = run nurseryLEE env selType 80 (5 / 100) (populationSize opts) (steps (iterations opts))
pop' <- runEffect (for run' logCsv)
germanLEE' <- calc germanLEE pop'
let (res, _) = bests germanLEE' 5 pop'
let germanLEE' = germanLEE {training = False}
germanLEE' <- calc germanLEE' res
mapM_ (format germanLEE') res
nurseryLEE' <- calc nurseryLEE pop'
let (res, _) = bests nurseryLEE' 5 pop'
let nurseryLEE' = nurseryLEE {training = False}
nurseryLEE' <- calc nurseryLEE' res
mapM_ (format nurseryLEE') res
where
format germanL s = do
let f = fitness' germanL s
format nurseryL s = do
let f = fitness' nurseryL s
putErrText $ show f <> "\n" <> pretty s
logCsv = putText . csv
csv (t, f) = show t <> " " <> show f