{"action":"created","comment":{"url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/pulls/comments/68225542","id":68225542,"diff_hunk":"@@ -348,108 +185,78 @@ Returns :\n     of the system at each time step\n \n \"\"\"\n-function sdp_solve_HD(model::StochDynProgModel,\n-                  param::SDPparameters,\n-                  display=0::Int64)\n+function sdp_compute_value_functions(model::StochDynProgModel,\n+                                        param::SDPparameters,\n+                                        display=0::Int64)\n \n     TF = model.stageNumber\n     next_state = zeros(Float64, model.dimStates)\n-    law = model.noises\n \n     u_bounds = model.ulim\n     x_bounds = model.xlim\n     x_steps = param.stateSteps\n+    x_dim = model.dimStates\n+\n+    dynamics = model.dynamics\n+    constraints = model.constraints\n+    cost = model.costFunctions\n+\n+    law = model.noises\n \n     #Compute cartesian product spaces\n     product_states, product_controls = generate_grid(model, param)\n \n+    product_states = collect(product_states)\n     product_controls = collect(product_controls)\n \n-    V = zeros(Float64, param.stateVariablesSizes..., TF)\n+    V = SharedArray{Float64}(zeros(Float64, param.stateVariablesSizes..., TF))\n \n     #Compute final value functions\n     for x in product_states\n-        ind_x = index_from_variable(x, x_bounds, x_steps)\n+        ind_x = SDPutils.index_from_variable(x, x_bounds, x_steps)\n         V[ind_x..., TF] = model.finalCostFunction(x)\n     end\n \n+    if param.expectation_computation!=\"MonteCarlo\" && param.expectation_computation!=\"Exact\"\n+        warn(\"param.expectation_computation should be 'MonteCarlo' or 'Exact'. Defaulted to 'exact'\")\n+        param.expectation_computation=\"Exact\"\n+    end\n+\n     #Construct a progress meter\n+    p = 0\n     if display > 0\n-        p = Progress((TF-1)*param.totalStateSpaceSize, 1)\n-        println(\"Starting stochastic dynamic programming hazard decision computation\")\n+        p = Progress((TF-1), 1)","path":"src/SDPoptimize.jl","position":332,"original_position":332,"commit_id":"fcf2d8090441b6c9b053ca9aa410721d4550b2ac","original_commit_id":"fcf2d8090441b6c9b053ca9aa410721d4550b2ac","user":{"login":"trigaut","id":7863528,"avatar_url":"https://avatars.githubusercontent.com/u/7863528?v=3","gravatar_id":"","url":"https://api.github.com/users/trigaut","html_url":"https://github.com/trigaut","followers_url":"https://api.github.com/users/trigaut/followers","following_url":"https://api.github.com/users/trigaut/following{/other_user}","gists_url":"https://api.github.com/users/trigaut/gists{/gist_id}","starred_url":"https://api.github.com/users/trigaut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trigaut/subscriptions","organizations_url":"https://api.github.com/users/trigaut/orgs","repos_url":"https://api.github.com/users/trigaut/repos","events_url":"https://api.github.com/users/trigaut/events{/privacy}","received_events_url":"https://api.github.com/users/trigaut/received_events","type":"User","site_admin":false},"body":"Not sure if there is anything interesting to display during the computation of value functions. I really like the ProgressMeter package ^^","created_at":"2016-06-23T12:32:56Z","updated_at":"2016-06-23T12:32:56Z","html_url":"https://github.com/JuliaOpt/StochDynamicProgramming.jl/pull/102#discussion_r68225542","pull_request_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/pulls/102","_links":{"self":{"href":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/pulls/comments/68225542"},"html":{"href":"https://github.com/JuliaOpt/StochDynamicProgramming.jl/pull/102#discussion_r68225542"},"pull_request":{"href":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/pulls/102"}}},"pull_request":{"url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/pulls/102","id":74801632,"html_url":"https://github.com/JuliaOpt/StochDynamicProgramming.jl/pull/102","diff_url":"https://github.com/JuliaOpt/StochDynamicProgramming.jl/pull/102.diff","patch_url":"https://github.com/JuliaOpt/StochDynamicProgramming.jl/pull/102.patch","issue_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/issues/102","number":102,"state":"open","locked":false,"title":"Dev sdp parallel","user":{"login":"trigaut","id":7863528,"avatar_url":"https://avatars.githubusercontent.com/u/7863528?v=3","gravatar_id":"","url":"https://api.github.com/users/trigaut","html_url":"https://github.com/trigaut","followers_url":"https://api.github.com/users/trigaut/followers","following_url":"https://api.github.com/users/trigaut/following{/other_user}","gists_url":"https://api.github.com/users/trigaut/gists{/gist_id}","starred_url":"https://api.github.com/users/trigaut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trigaut/subscriptions","organizations_url":"https://api.github.com/users/trigaut/orgs","repos_url":"https://api.github.com/users/trigaut/repos","events_url":"https://api.github.com/users/trigaut/events{/privacy}","received_events_url":"https://api.github.com/users/trigaut/received_events","type":"User","site_admin":false},"body":"closes #75 with PR #100 \r\nAdd working implementation of parallelized SDP using multiprocessing\r\n\r\nsmall benchmark:\r\n- the computation might be a bit slower on very small instances\r\n- the computational gain in the other cases (discretized state and control spaces size > 100) is between 30 to 50% with 2 processes\r\n- there is a small computational gain even with 1 process for \"regular\" and large instances\r\n\r\nTODO: update doc with frapac help","created_at":"2016-06-22T15:10:03Z","updated_at":"2016-06-23T12:32:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/pulls/102/commits","review_comments_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/pulls/102/comments","review_comment_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/issues/102/comments","statuses_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/statuses/fcf2d8090441b6c9b053ca9aa410721d4550b2ac","head":{"label":"JuliaOpt:dev_sdp_parallel","ref":"dev_sdp_parallel","sha":"fcf2d8090441b6c9b053ca9aa410721d4550b2ac","user":{"login":"JuliaOpt","id":5667382,"avatar_url":"https://avatars.githubusercontent.com/u/5667382?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaOpt","html_url":"https://github.com/JuliaOpt","followers_url":"https://api.github.com/users/JuliaOpt/followers","following_url":"https://api.github.com/users/JuliaOpt/following{/other_user}","gists_url":"https://api.github.com/users/JuliaOpt/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaOpt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaOpt/subscriptions","organizations_url":"https://api.github.com/users/JuliaOpt/orgs","repos_url":"https://api.github.com/users/JuliaOpt/repos","events_url":"https://api.github.com/users/JuliaOpt/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaOpt/received_events","type":"Organization","site_admin":false},"repo":{"id":45924942,"name":"StochDynamicProgramming.jl","full_name":"JuliaOpt/StochDynamicProgramming.jl","owner":{"login":"JuliaOpt","id":5667382,"avatar_url":"https://avatars.githubusercontent.com/u/5667382?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaOpt","html_url":"https://github.com/JuliaOpt","followers_url":"https://api.github.com/users/JuliaOpt/followers","following_url":"https://api.github.com/users/JuliaOpt/following{/other_user}","gists_url":"https://api.github.com/users/JuliaOpt/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaOpt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaOpt/subscriptions","organizations_url":"https://api.github.com/users/JuliaOpt/orgs","repos_url":"https://api.github.com/users/JuliaOpt/repos","events_url":"https://api.github.com/users/JuliaOpt/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaOpt/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/JuliaOpt/StochDynamicProgramming.jl","description":"A package for discrete-time optimal stochastic control","fork":false,"url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl","forks_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/forks","keys_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/teams","hooks_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/hooks","issue_events_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/issues/events{/number}","events_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/events","assignees_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/assignees{/user}","branches_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/branches{/branch}","tags_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/tags","blobs_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/git/refs{/sha}","trees_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/statuses/{sha}","languages_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/languages","stargazers_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/stargazers","contributors_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/contributors","subscribers_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/subscribers","subscription_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/subscription","commits_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/commits{/sha}","git_commits_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/git/commits{/sha}","comments_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/comments{/number}","issue_comment_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/issues/comments{/number}","contents_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/contents/{+path}","compare_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/merges","archive_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/downloads","issues_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/issues{/number}","pulls_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/pulls{/number}","milestones_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/milestones{/number}","notifications_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/labels{/name}","releases_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/releases{/id}","deployments_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/deployments","created_at":"2015-11-10T16:31:14Z","updated_at":"2016-06-16T19:31:59Z","pushed_at":"2016-06-22T15:10:03Z","git_url":"git://github.com/JuliaOpt/StochDynamicProgramming.jl.git","ssh_url":"git@github.com:JuliaOpt/StochDynamicProgramming.jl.git","clone_url":"https://github.com/JuliaOpt/StochDynamicProgramming.jl.git","svn_url":"https://github.com/JuliaOpt/StochDynamicProgramming.jl","homepage":"","size":1207,"stargazers_count":9,"watchers_count":9,"language":"Julia","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":18,"forks":4,"open_issues":18,"watchers":9,"default_branch":"master"}},"base":{"label":"JuliaOpt:dev-nightly","ref":"dev-nightly","sha":"cec0e42a3340ca4fe4c59fc1c651b675111c5e94","user":{"login":"JuliaOpt","id":5667382,"avatar_url":"https://avatars.githubusercontent.com/u/5667382?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaOpt","html_url":"https://github.com/JuliaOpt","followers_url":"https://api.github.com/users/JuliaOpt/followers","following_url":"https://api.github.com/users/JuliaOpt/following{/other_user}","gists_url":"https://api.github.com/users/JuliaOpt/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaOpt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaOpt/subscriptions","organizations_url":"https://api.github.com/users/JuliaOpt/orgs","repos_url":"https://api.github.com/users/JuliaOpt/repos","events_url":"https://api.github.com/users/JuliaOpt/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaOpt/received_events","type":"Organization","site_admin":false},"repo":{"id":45924942,"name":"StochDynamicProgramming.jl","full_name":"JuliaOpt/StochDynamicProgramming.jl","owner":{"login":"JuliaOpt","id":5667382,"avatar_url":"https://avatars.githubusercontent.com/u/5667382?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaOpt","html_url":"https://github.com/JuliaOpt","followers_url":"https://api.github.com/users/JuliaOpt/followers","following_url":"https://api.github.com/users/JuliaOpt/following{/other_user}","gists_url":"https://api.github.com/users/JuliaOpt/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaOpt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaOpt/subscriptions","organizations_url":"https://api.github.com/users/JuliaOpt/orgs","repos_url":"https://api.github.com/users/JuliaOpt/repos","events_url":"https://api.github.com/users/JuliaOpt/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaOpt/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/JuliaOpt/StochDynamicProgramming.jl","description":"A package for discrete-time optimal stochastic control","fork":false,"url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl","forks_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/forks","keys_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/teams","hooks_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/hooks","issue_events_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/issues/events{/number}","events_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/events","assignees_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/assignees{/user}","branches_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/branches{/branch}","tags_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/tags","blobs_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/git/refs{/sha}","trees_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/statuses/{sha}","languages_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/languages","stargazers_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/stargazers","contributors_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/contributors","subscribers_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/subscribers","subscription_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/subscription","commits_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/commits{/sha}","git_commits_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/git/commits{/sha}","comments_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/comments{/number}","issue_comment_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/issues/comments{/number}","contents_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/contents/{+path}","compare_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/merges","archive_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/downloads","issues_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/issues{/number}","pulls_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/pulls{/number}","milestones_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/milestones{/number}","notifications_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/labels{/name}","releases_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/releases{/id}","deployments_url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/deployments","created_at":"2015-11-10T16:31:14Z","updated_at":"2016-06-16T19:31:59Z","pushed_at":"2016-06-22T15:10:03Z","git_url":"git://github.com/JuliaOpt/StochDynamicProgramming.jl.git","ssh_url":"git@github.com:JuliaOpt/StochDynamicProgramming.jl.git","clone_url":"https://github.com/JuliaOpt/StochDynamicProgramming.jl.git","svn_url":"https://github.com/JuliaOpt/StochDynamicProgramming.jl","homepage":"","size":1207,"stargazers_count":9,"watchers_count":9,"language":"Julia","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":18,"forks":4,"open_issues":18,"watchers":9,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/pulls/102"},"html":{"href":"https://github.com/JuliaOpt/StochDynamicProgramming.jl/pull/102"},"issue":{"href":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/issues/102"},"comments":{"href":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/issues/102/comments"},"review_comments":{"href":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/pulls/102/comments"},"review_comment":{"href":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/pulls/102/commits"},"statuses":{"href":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/statuses/fcf2d8090441b6c9b053ca9aa410721d4550b2ac"}}}}
{"actor":{"display_login":"trigaut"}}