Closed mcanigueral closed 4 years ago
I've seen now in file /R/quadratic-expression-methods.R
the function:
ensure_quadratic_expression <- function(expr) {
if ("RMPKQuadraticExpression" %in% class(expr)) {
return(expr)
}
if ("RMPKQuadraticVariableTuple" %in% class(expr)) {
return(expr + 0)
}
stop("expr is not well-formed", call. = FALSE)
}
And the error message comes from:
class(expr)
So, I see that it's not a matter of the solver. Let me reformulate the question:
Is it possible to square any arithmetic operation in rmpk
?
Thanks again!
Ah thanks. It's a bug. Will look into it.
Thanks for the report. I think it is fixed now. Let me know if you find any other issues (which there probably are :))
Hi, it works now, thanks! I have another problem but I'll open another issue since it's not related to the error of this one.
Hi Dirk, Last week I discovered
ompr
andrmpk
packages. Excellent work! I was testingrmpk
with a quadratic optimization usingquadprog
as a solver.My random environment variables are:
Where
v
could be an electricity demand profile andpv
a solar generation profile. I want an optimalv
(i.e.v_opt
) that consumes the most as possible solar energy, so as example, my desired objective function would be:where I need to square the difference between demand-generation in order to only obtain positive values and point out the corresponding difference.
Then, when I configure my model I obtain the following error:
I guess that
quadprog
can't handle the square of a subtraction, since the square of just one variable is possible, but I have not found any other solver (from ROI plugins) that allows this objective function. Is it a problem of the solver? Is this objective function possible withrmpk
?Thanks in advance!