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

Parametrize GenericModel with objective type #1470

Closed
blegat opened this issue Jul 15, 2021 · 2 comments · Fixed by #1521
Closed

Parametrize GenericModel with objective type #1470

blegat opened this issue Jul 15, 2021 · 2 comments · Fixed by #1521

Comments

@blegat
Copy link
Member

blegat commented Jul 15, 2021

We could have GenericModel parametrized by the objective type so that a solver can set it to MOI.ScalarAffineFunction{Float64} in its OptimizerCache type so that it won't have to worry about other cases.
For instance,
https://github.com/jump-dev/Clp.jl/pull/114/files#diff-18c6af231f3facc5ba10dd45231da349efda22ecd8d68a4661dee8027bc413a7R296-R297
is incorrect as it will throw a convert error if the objective is quadratic instead of an UnsupportedAttribute error.

@odow
Copy link
Member

odow commented Jul 15, 2021

I also wondered about just storing three fields for the three objective types, or having a separate Objective structure.

@odow
Copy link
Member

odow commented Jul 16, 2021

I also just noticed that the current approach leads to inference errors, because of this:

isempty(model.objective.terms) &&
iszero(model.objective.constant) &&

I'll have a go after I finish #1468

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

Successfully merging a pull request may close this issue.

2 participants