Repository navigation
Add evaluate(): Evaluate a policy (without improving it) - #18
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
model.evaluate(), which evaluates a given policy (by default the one from the last run) without improving it. It returns the policy's value vector, and undercriterion="average"its gain and bias, through the existing output methods.Changes
evaluate(policy, tolerance, update, criterion, SORrelaxation, initValueVector, verbose, postProcessing, makeFinalCheck, parallel)runs the evaluation sweeps of policy iteration until the tolerance is reached. Under the discounted criterion with standard updates and post-processing, the values lie less than the tolerance below the policy's values.getIterations()returns 0 afterevaluate(), since no policy improvement step is made.solve()andevaluate()use. The results ofsolve()are bit-identical, and PI/MPI speed is unchanged.solve()'sinitPolicy/initValueVectorandevaluate()'spolicygo to C++ as NumPy arrays without a copy, and are checked in a single C++ pass. With 5×10⁶ states,solve(initPolicy=array)drops from 7.6 s to 0.17 s. Results and error messages are unchanged.Tests
New
test_evaluate.py(added to CI) checksevaluate()against the results ofsolve()and against exact values from linear equations, under both criteria.test_order.pynow countsevaluate()as a step method. All 14 tests pass locally.Documentation is on the wiki (Classes-and-methods, Contribution-guidelines, Validating-MDPSolver).