-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add multi-dimensional random variables #732
Comments
See https://sddp.dev/stable/guides/add_multidimensional_noise/ You must pass a single vector of the sample space, and an (optional) single vector of the associated probabilities. There is no direct support for multi-variate random variables. Given the size (there is something like 6^30 possibilities), you obviously can't add the every possible realization of |
Thank you for the reply! I'm reading the Sampling section on the page, and there's something I feel confused about.
Does it mean this is a 3-d random variable, with the marginal distributions being Binomial, Geometric, and Poisson? So, if I have a 90-d random variable, do I have to add 90 lines between square brackets? |
Moreover, is it possible to generate them in a structured form as implied by the indices? |
If you want to use the 0-indexed indices: using JuMP
d = Containers.@container([i in 1:10, j in 0:2, k in 0:2], rand(k:2)) Create a list of samples: N = 20
Ω = [
Containers.@container([i in 1:10, j in 0:2, k in 0:2], rand(k:2))
for _ in 1:N
]
P = fill(1 / N, N) |
Thank you for the reply! I think I get it! |
Here You probably want: @variable(subproblem, d[i in 1:10, j in 0:2, k in 0:2])
N = 20
Ω = [
Containers.@container([i in 1:10, j in 0:2, k in 0:2], rand(k:2))
for _ in 1:N
]
P = fill(1 / N, N)
SDDP.parameterize(subproblem, Ω, P) do ω
JuMP.fix.(d, ω) # Note the fix.(
return
end
This is not really another set of random variables, but a transformation. Perhaps something like: @variable(subproblem, d[i in 1:10, j in 0:2, k in 0:2])
@variable(subproblem, r[i in 1:10, j in 0:2, k in 0:2, kp in 0:2])
N = 20
Ω = [
Containers.@container([i in 1:10, j in 0:2, k in 0:2], rand(k:2))
for _ in 1:N
]
P = fill(1 / N, N)
SDDP.parameterize(subproblem, Ω, P) do ω
JuMP.fix.(d, ω) # Note the fix.(
for i in 1:10, j in 0:2, k in 0:2, kp in 0:2
r[i, j, k, kp] = d[i, j, k] == k' ? 1 : 0
end
return
end |
In my problem, I have a series of random variables$d_{i,j,k}$ , where $i\in{1,\dots,10}$ , $j\in{0,\dots,2}$ and $k\in{0,\dots,2}$ . $d_{i,j,k}$ has a discrete uniform distribution with support ${k\dots,2}$ . How can I define such 90 random variables?
The text was updated successfully, but these errors were encountered: