Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

memory issue in evaluation #230

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/scala/symsim/examples/concrete/simplemaze/Maze.scala
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ object Maze
Agent[MazeState, MazeObservableState, MazeAction, MazeReward, Randomized],
Episodic:

val TimeHorizon: Int = 2000
val TimeHorizon: Int = 200000

def isFinal (s: MazeState): Boolean =
(s._1, s._2) == (4, 3) || (s._1, s._2) == (4, 2) || s._3 == TimeHorizon
(s._1, s._2) == (4, 3) || (s._1, s._2) == (4, 2) || s._3 >= TimeHorizon

// Maze is discrete
def observe (s: MazeState): MazeObservableState = (s._1, s._2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package symsim
package examples.concrete.simplemaze

import Maze.instances.given
import symsim.concrete.Randomized

class SarsaExperiments
extends ExperimentSpec[MazeState, MazeObservableState, MazeAction]:
Expand All @@ -11,16 +12,16 @@ class SarsaExperiments
alpha = 0.1,
gamma = 1,
epsilon0 = 0.1,
episodes = 60000,
episodes = 10000,
)

s"SimpleMaze experiment with ${sarsa}" in {

val policies = learnAndLog(sarsa)
.grouped (100)
.take (100)
.flatMap { _.headOption }
.toList
// .grouped (100)
// .take (100)
// .flatMap { _.headOption }
// .toList

val policy = policies.head

Expand All @@ -47,6 +48,7 @@ class SarsaExperiments
// Left is faster, down is safer
withClue ("4,1") { policy (4, 1) should (be (Down) or be (Left)) }

val results = eval (sarsa, policies)
val evalInitial = Randomized.const ((1, 1, 0))
val results = eval (sarsa, policies, Some (evalInitial))
results.save ("simplemaze.csv")
}
Loading