Current section

3 Versions

Jump to

Compare versions

4 files changed
+14 additions
-11 deletions
  @@ -1,19 +1,19 @@
1 1 # Markovian
2 + [![Build Status](https://travis-ci.org/mjs2600/Markovian.svg?branch=master)](https://travis-ci.org/mjs2600/Markovian)
3 + [![Coverage Status](https://coveralls.io/repos/github/mjs2600/Markovian/badge.svg?branch=master)](https://coveralls.io/github/mjs2600/Markovian?branch=master)
2 4
3 - **TODO: Add description**
5 + A Q-learner for the BEAM.
4 6
5 7 ## Installation
6 8
7 - If [available in Hex](https://hex.pm/docs/publish), the package can be installed
9 + The package can be installed
8 10 by adding `markovian` to your list of dependencies in `mix.exs`:
9 11
10 12 ```elixir
11 13 def deps do
12 - [{:markovian, "~> 0.1.0"}]
14 + [{:markovian, "~> 0.1.1"}]
13 15 end
14 16 ```
15 17
16 - Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
17 - and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
18 - be found at [https://hexdocs.pm/markovian](https://hexdocs.pm/markovian).
18 + The docs can be found at [https://hexdocs.pm/markovian](https://hexdocs.pm/markovian).
  @@ -9,4 +9,4 @@
9 9 {<<"maintainers">>,[<<"Michael Simpson">>]}.
10 10 {<<"name">>,<<"markovian">>}.
11 11 {<<"requirements">>,[]}.
12 - {<<"version">>,<<"0.1.1">>}.
12 + {<<"version">>,<<"0.1.2">>}.
  @@ -18,7 +18,7 @@ defmodule Markovian do
18 18 def new(states, actions, initial_state) do
19 19 state_space = for state <- states, into: %{} do
20 20 action_space = for action <- actions, into: %{} do
21 - {action, 2 * :rand.uniform - 1}
21 + {action, 2 * :rand.uniform() - 1}
22 22 end
23 23
24 24 {state, action_space}
  @@ -47,9 +47,9 @@ defmodule Markovian do
47 47 end
48 48
49 49 defp generate_action(mdp) do
50 - random? = mdp.random_action_rate > :rand.uniform
50 + random? = mdp.random_action_rate > :rand.uniform()
51 51 action = do_generate_action(mdp.q_table[mdp.current_state], random?)
52 - Map.put(mdp, :current_action, action)
52 + %{mdp | current_action: action}
53 53 end
54 54
55 55 defp do_generate_action(current_state_actions, random?)
  @@ -4,12 +4,14 @@ defmodule Markovian.Mixfile do
4 4 def project do
5 5 [
6 6 app: :markovian,
7 - version: "0.1.1",
7 + version: "0.1.2",
8 8 elixir: "~> 1.4",
9 9 build_embedded: Mix.env == :prod,
10 10 start_permanent: Mix.env == :prod,
11 11 deps: deps(),
12 12 package: package(),
13 + test_coverage: [tool: ExCoveralls],
14 + preferred_cli_env: ["coveralls": :test, "coveralls.detail": :test, "coveralls.post": :test, "coveralls.html": :test],
13 15 dialyzer: [
14 16 plt_add_deps: :transitive,
15 17 flags: ["-Wunmatched_returns", "-Werror_handling", "-Wrace_conditions", "-Wunderspecs"],
  @@ -37,6 +39,7 @@ defmodule Markovian.Mixfile do
37 39 {:ex_doc, ">= 0.0.0", only: :dev},
38 40 {:dialyxir, "~> 0.5", only: [:dev], runtime: false},
39 41 {:credo, "~> 0.5", only: [:dev, :test]},
42 + {:excoveralls, "~> 0.6", only: :test},
40 43 ]
41 44 end
42 45 end