{"action":"created","comment":{"url":"https://api.github.com/repos/JuliaOpt/StochDynamicProgramming.jl/pulls/comments/68594053","id":68594053,"diff_hunk":"@@ -193,150 +134,99 @@ function solve_DP(model::SPModel,\n \n     SDPmodel = build_sdpmodel_from_spmodel(model::SPModel)\n \n-    #Display start of the algorithm in DH and HD cases\n-    if (param.infoStructure == \"DH\")\n-        V = sdp_solve_DH(SDPmodel, param, display)\n-    elseif (param.infoStructure == \"HD\")\n-        V = sdp_solve_HD(SDPmodel, param, display)\n-    else\n-        error(\"param.infoStructure is neither 'DH' nor 'HD'\")\n-    end\n+    #Start of the algorithm\n+    V = sdp_compute_value_functions(SDPmodel, param, display)\n \n     return V\n end\n \n-\n \"\"\"\n-Value iteration algorithm to compute optimal value functions in\n-the Decision Hazard (DH) case\n+Compute the value function at time t\n \n Parameters:\n-- model (StochDynProgModel)\n-    the DPSPmodel of our problem\n-\n-- param (SDPparameters)\n-    the parameters for the SDP algorithm\n+- sampling size (Int)\n+    number of randomness samples\n \n-- display (Int)\n-    the output display or verbosity parameter\n-\n-\n-Returns :\n-- value_functions (Array)\n-    the vector representing the value functions as functions of the state\n-    of the system at each time step\n-\n-\"\"\"\n-function sdp_solve_DH(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+- samples (Array{Float64})\n+    list of random samples\n \n-    u_bounds = model.ulim\n-    x_bounds = model.xlim\n-    x_steps = param.stateSteps\n+- probas (Array{Float64})\n+    array of probabilities of samples\n \n-    #Compute cartesian product spaces\n-    product_states, product_controls = generate_grid(model, param)\n+- u_bounds (Array{Tuple{Float64}})\n+    array of lower and upper bounds of controls\n \n-    product_controls = collect(product_controls)\n+- x_bounds (Array{Tuple{Float64}})\n+    array of lower and upper bounds of states\n \n-    V = zeros(Float64, param.stateVariablesSizes..., TF)\n+- x_steps (Array{Float64})\n+    array discretization steps for states space\n \n-    #Compute final value functions\n-    for x in product_states\n-        ind_x = index_from_variable(x, x_bounds, x_steps)\n-        V[ind_x..., TF] = model.finalCostFunction(x)\n-    end\n+- x_dim (Int)\n+    number of state variables\n \n-    #Construct a progress meter\n-    if display > 0\n-        p = Progress((TF-1)*param.totalStateSpaceSize, 1)\n-        println(\"Starting stochastic dynamic programming decision hazard computation\")\n-    end\n+- product_states (Array{Float64})\n+    discretized state space\n \n-    # Loop over time:\n-    for t = (TF-1):-1:1\n-        Vitp = value_function_interpolation(model, V, t+1)\n+- product_controls (Array{Float64})\n+    discretized control space\n \n-            #Loop over states\n-        for x in product_states\n+- dynamics (Function)\n+    dynamics function of the time step, state, control and randomness returning next state\n \n-            if display > 0\n-                next!(p)\n-            end\n+- contraints (Function)\n+    constraints function of the time step, state, control and randomness returning boolean\n \n-            expected_V = Inf\n-            optimal_u = tuple()\n-            current_cost = 0\n+- cost (Function)\n+    cost function of the time step, state, control and randomness returning the instantaneous cost\n \n-            #Loop over controls\n-            for u = product_controls\n+- V (Array of SharedArray)\n+    the array containing the discretized value functions at each time step\n \n-                expected_V_u = 0.\n-                count_admissible_w = 0\n+- Vitp (Interpolations)","path":"src/SDPoptimize.jl","position":221,"original_position":221,"commit_id":"fdd92546843738471a671db9373d6d04d4fd409c","original_commit_id":"fdd92546843738471a671db9373d6d04d4fd409c","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":"This is a type. This type of object is like a array indexed by floats","created_at":"2016-06-27T15:11:49Z","updated_at":"2016-06-27T15:11:49Z","html_url":"https://github.com/JuliaOpt/StochDynamicProgramming.jl/pull/102#discussion_r68594053","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/68594053"},"html":{"href":"https://github.com/JuliaOpt/StochDynamicProgramming.jl/pull/102#discussion_r68594053"},"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-27T15:11:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"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/fdd92546843738471a671db9373d6d04d4fd409c","head":{"label":"JuliaOpt:dev_sdp_parallel","ref":"dev_sdp_parallel","sha":"fdd92546843738471a671db9373d6d04d4fd409c","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-27T14:25: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":1101,"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":19,"forks":4,"open_issues":19,"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-27T14:25: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":1101,"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":19,"forks":4,"open_issues":19,"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/fdd92546843738471a671db9373d6d04d4fd409c"}}}}
{"actor":{"display_login":"trigaut"}}