Skip to content

Refactor filenames and move some code around #36

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

odow
Copy link
Member

@odow odow commented May 28, 2025

I should probably split this up, but let me comment in-line

import JuMP
import MathOptInterface as MOI
import ModelAnalyzer
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like alphabetical imports

model::JuMP.GenericModel;
kwargs...,
) where {T<:ModelAnalyzer.AbstractAnalyzer}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use where unless:

  • it is needed in the body of the function
  • its needed across multiple input arguments
  • it's hard/impossible to write the method without it

return Interval(a.lo * x, a.hi * x)
end
return Interval(a.hi * x, a.lo * x)
end
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's questionable that a very simple type like this and a few methods need a license attribution. Since both packages are MIT, we're in the clear, so I just moved into this file.

for t in f.terms
out += _eval_variables(value_fn, t)
end
return out
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto here: why is this _eval_variales needed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because MOI assumes the output type is the same as the ScalarAffineFunction (Float64), but we need the output to be an interval. JuMP does is correctly: #19 (comment)

@joaquimg
Copy link
Member

I was thining about code organization.

The printing stuff is very verbose so I was considering splitting the analysis files in two:

  • algorithm.jl
  • printing.jl
    (names open to bikeshed)
    So the structure could also be:
src
  ModelAnalyzer.jl
  Numerical
    algorithm.jl
    printing.jl
...

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

Successfully merging this pull request may close these issues.

2 participants