Open jmcastro2109 opened 2 years ago
From the error text I would not assume that this is a StochasticPrograms
related error. Does it work if you formulate a deterministic version of the problem in JuMP directly?
Yes, it does!
Here is the code that is giving me the error
`
using JuMP, LinearAlgebra, Random, Distributions, BenchmarkTools, MosekTools, NLopt
using StochasticPrograms
@sampler SimpleSampler = begin N::MvNormal
SimpleSampler(μ, Σ) = new(MvNormal(μ, Σ))
@sample Scenario begin
x = rand(sampler.N)
return Scenario(z₁ = exp(x[1]), z₂ = exp(x[2]))
end
end
μ = [-0.5, -0.5] Σ = [1.0 0.0 0.0 1]
sampler = SimpleSampler(μ, Σ)
@stochastic_model simple_model begin @stage 1 begin @decision(simple_model, x₁ >= 0) @decision(simple_model, x₂ >= 0) @objective(simple_model, Max, -1x₁ - 1x₂) end @stage 2 begin @uncertain z₁ z₂ @recourse(simple_model, 0 <= ν₁ ) @recourse(simple_model, 0 <= ν₂ ) @recourse(simple_model, y[1:J]>= 0) @recourse(simple_model, t[1:J]>= 0) @objective(simple_model, Min, ν₁x₁+ ν₂x₂ + (((σ-1)/σ)^(σ-1)/(σ).β.^(σ))'y) for j=1:J @constraint(simple_model, τ[j,1]/z₁ + τ[j,1]ν₁ - t[j] >= 0) @constraint(simple_model, τ[j,2]/z₂ + τ[j,2]ν₂ - t[j] >= 0) end
for j = 1 : J
@constraint(simple_model, [y[j],t[j],1] in MOI.PowerCone(1/σ))
end
end
end
import Ipopt
sampled_sp = instantiate(simple_model, sampler, 5, optimizer = Mosek.Optimizer)
print(sampled_sp)
StochasticPrograms.optimize!(sampled_sp) `
Parameter values are missing.
It looks like the objective is not being bridged properly. Quadratic support is not thoroughly tested, and conic stuff are not tested at all, so it is not unlikely that this is the issue.
Hi,
My second stage problem has a linear objective and the constraint is a power cone. Currently I am solving this second stage problem with Mosek. Can I use Stochastic Programs to solve the first stage?
edit:
Looks like it does not work :(