Closed hongkai-dai closed 7 years ago
@soonho-tri and @RussTedrake for discussion.
I agree with all of the above. My sense is that this is very similar to what is happening in AddLinearConstraint
right now. I agree that we will be throwing away return type information, but if the caller is being non-specific with the call, then presumably it will be ok being non-specific with the return type, too.
Agree, I will first work on AddCost(symbolic::Expression)
to handle both linear and quadratic costs.
Goal
Currently we support
We want to use
AddCost(symbolic::Expression)
andAddConstraint(symbolic::Formula)
to handle all of these different forms, namely all costs and constraints in the supported convex optimization.Approach
We will handle constraints and costs separately.
To handle both linear and quadratic cost, throw a runtime error if the input is not a linear or quadratic expression.
Question: what is the return type for this function? I think
Binding<Constraint>
can work, but we lost information specific to the derived class likeLinearConstraint
andQuadraticConstraint
.Question: What is a good way to write a conic constraint, such as Lorentz cone or semidefinite matrix cone? Shall we create a type of
symbolic::Formula
forA*x+b is in K
, whereK
is a type of the cone?