Skip to content
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

Problem in get WS'values #21

Closed
bigadolfo opened this issue Nov 12, 2020 · 5 comments
Closed

Problem in get WS'values #21

bigadolfo opened this issue Nov 12, 2020 · 5 comments

Comments

@bigadolfo
Copy link

Hello everyone:

In the example of: https://martinbiel.github.io/StochasticPrograms.jl/dev/manual/quickstart/
there are 2 scenarios (ξ₁ and ξ₂), for each I can obtain the formulation:
ws1 = WS(sp, ξ₁)
print(ws1)
and
ws2 = WS(sp, ξ₂)
print(ws2)
all is ok

Using print (ws1) and print (ws2) and later of coding them in Julia by my own, I can obtain the EWS. So value of ws1 is 37.5 and ws2 -2556.25 , all ok.

But to take advantage of wait_and_see_decision, I can obtain values of x₁ and x₂ correctly using
x₁ = wait_and_see_decision(sp, ξ₁)
x₂ = wait_and_see_decision(sp, ξ₂)
However, value of ws1 and value of ws2 are not correct when I use:
ws1 = evaluate_decision(sp, x₁) #---the result is -762.5
ws2 = evaluate_decision(sp, x₂) #---the result is -626.25
and these are not the correct values....

What's going on? , Can you help me?

Thanks in advance,
Adolfo

@martinbiel
Copy link
Owner

The optimal value of a given wait-and-see problem is not the same as the expected value of the corresponding wait-and-see decision. For example, 37.5 is the optimal value if ξ₁ is the actual scenario AND the actor knows it is before taking the decision. This yields the decision x₁. Now, if you evaluate this decision, you measure the expected result of taking this decision across ALL scenarios (both ξ₁ and ξ₂). This means solving both subproblems with the first-stage decisions fixed to x₁, which does not yield the same value as the wait-and-see value for only ξ₁.

@bigadolfo
Copy link
Author

bigadolfo commented Nov 12, 2020 via email

@martinbiel
Copy link
Owner

ws = WS(sp, ξ₁, optimizer = GLPK.Optimizer)
optimize!(ws)
objective_value(ws)

should give 37.5 in this case. evaluate_decision(sp, x₁, ξ₁) should actually give the same thing, but I just noticed that this function does not properly factor in the first-stage cost. I will fix this in a future release.

@martinbiel martinbiel reopened this Nov 12, 2020
@bigadolfo
Copy link
Author

Ok. Thanks, all is correct.

@martinbiel
Copy link
Owner

The first-stage cost is used correctly in the evaluation now, so evaluate_decision(sp, x₁, ξ₁) gives 37.5 in this case as expected. Closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants