Commit 346f925d authored by Steven Cordwell's avatar Steven Cordwell
Browse files

QLearning unittest fix and LP verbosity problem

New issue
Summary: It is not possible to switch verbose to False in the LP class
Status: Started
Labels: Type-Defect Priority-Medium Usability
The LP class uses the module cvxopt for linear programming functionality. When
LP.verbose is set to False then the cvxopt.solvers.options['show_progress']
should also be False. Need to find a way to integrate the options component into
the LP class, or find another way around it.
parent 77dce9f8
......@@ -693,6 +693,10 @@ class LP(MDP):
MDP.__init__(self, transitions, reward, discount, None, None)
# this doesn't do what I want it to do
if not self.verbose:
solvers.options['show_progress'] = False
# The objective is to resolve : min V / V >= PR + discount*P*V
# The function linprog of the optimisation Toolbox of Mathworks resolves :
# min f'* x / M * x <= b
......
......@@ -9,6 +9,7 @@ from mdp import check, checkSquareStochastic, exampleForest, exampleRand, LP
from mdp import MDP, PolicyIteration, QLearning, RelativeValueIteration
from mdp import ValueIteration, ValueIterationGS
from random import seed as randseed
from numpy import absolute, array, eye, matrix, zeros
from numpy.random import rand
from scipy.sparse import eye as speye
......@@ -290,11 +291,11 @@ def test_PolicyIteration_matrix_exampleForest():
# QLearning
def test_QLearning():
# rand('seed', 0)
randseed(0)
a = QLearning(P, R, 0.9)
q = matrix('39.8617259890454 42.4106450981318; ' \
'36.1624367068471 34.6832177136245')
v = matrix('42.4106450981318 36.1624367068471')
q = matrix('36.63245946346517 42.24434307022128; ' \
'35.96582807367007 32.70456417451635')
v = matrix('42.24434307022128 35.96582807367007')
p = matrix('1 0')
a.iterate()
assert (absolute(a.Q - q) < SMALLNUM).all()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment