Skip to content

Tidy functions.jl and improve docstrings #2108

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

Merged
merged 4 commits into from
Mar 2, 2023
Merged

Tidy functions.jl and improve docstrings #2108

merged 4 commits into from
Mar 2, 2023

Conversation

odow
Copy link
Member

@odow odow commented Mar 1, 2023

];

julia> f = MOI.VectorQuadraticFunction(quad_terms, affine_terms, constants)
MathOptInterface.VectorQuadraticFunction{Float64}(MathOptInterface.VectorQuadraticTerm{Float64}[MathOptInterface.VectorQuadraticTerm{Float64}(1, MathOptInterface.ScalarQuadraticTerm{Float64}(2.0, MathOptInterface.VariableIndex(1), MathOptInterface.VariableIndex(1))), MathOptInterface.VectorQuadraticTerm{Float64}(2, MathOptInterface.ScalarQuadraticTerm{Float64}(3.0, MathOptInterface.VariableIndex(1), MathOptInterface.VariableIndex(2)))], MathOptInterface.VectorAffineTerm{Float64}[MathOptInterface.VectorAffineTerm{Float64}(1, MathOptInterface.ScalarAffineTerm{Float64}(2.0, MathOptInterface.VariableIndex(1))), MathOptInterface.VectorAffineTerm{Float64}(2, MathOptInterface.ScalarAffineTerm{Float64}(3.0, MathOptInterface.VariableIndex(1)))], [4.0, 5.0])
Copy link
Member

Choose a reason for hiding this comment

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

We should really improve the printing of functions, debugging it awful atm

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. But that can be a separate PR.

I even wonder about something like:

ScalarAffineFunction:
    constant: 1.0
    terms:
      VariableIndex(1) => 2.0
      VariableIndex(2) => 2.0
      VariableIndex(3) => 2.0
      VariableIndex(4) => 2.0

Rather than trying to pretty-print it all.

Copy link
Member

Choose a reason for hiding this comment

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

I would prefer pretty printing for the oneline version as it is sometimes coefficients of a multivariate polynomials that is trying to print itself in oneline.

Copy link
Member

Choose a reason for hiding this comment

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

For the long version, your suggestion seems nice

Copy link
Member Author

Choose a reason for hiding this comment

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

Open an issue? What is the "long version"?

Co-authored-by: Benoît Legat <[email protected]>
@odow odow merged commit 363b277 into master Mar 2, 2023
@odow odow deleted the od/tidy-functions branch March 2, 2023 20:46
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