Dual Variable Example
btaute opened this issue · comments
Can you please provide an example for retrieving optimal dual variables? I see a dual_value method was added, but I can't find any examples on its use and am having no luck interpreting the documentation.
Here is an example problem I'm trying to work through:
Q <- rbind(c(1, -1/2), c(-1/2, 2))
f <- cbind(-1, 0)
A <- rbind(c(1, 2), c(1, -4), c(5, 76))
b <- rbind(-2, -3, 1)
x <- Variable(2)
constraints <- list(A %% x <= b)
objective <- Minimize(quad_form(x, Q) + f %% x)
problem <- Problem(objective, constraints)
solution <- solve(problem)
Thank you!
Thank you. This seems unsatisfactory at the moment. A fix is forthcoming shortly.
CORRECTION: I misspoke.
The following should do it.
solution$getDualValue(constraints[[1]])