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

Add _CONSTRAINT_LIMIT_FOR_PRINTING to control printing of many constraints #3686

Merged
merged 2 commits into from
Mar 29, 2024

Conversation

odow
Copy link
Member

@odow odow commented Feb 28, 2024

Closes #3651

We need to decide whether this is okay. It is conceivably breaking for people who rely on printing the model to a string, even if they really shouldn't be doing that.

One justification for doing this is that we added #3575 and I haven't heard any complaints, and it is pretty easy to suddenly spam a lot of content to stdout if your model is large.

Copy link

codecov bot commented Feb 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.33%. Comparing base (4be967c) to head (675c444).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3686   +/-   ##
=======================================
  Coverage   98.33%   98.33%           
=======================================
  Files          43       43           
  Lines        5696     5711   +15     
=======================================
+ Hits         5601     5616   +15     
  Misses         95       95           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@odow
Copy link
Member Author

odow commented Feb 28, 2024

An alternative might be to print at most N constraints of each function-set type. That would give a more representative print of the model.

@odow odow requested a review from blegat March 10, 2024 20:05
@odow odow mentioned this pull request Mar 27, 2024
13 tasks
src/print.jl Show resolved Hide resolved
src/print.jl Show resolved Hide resolved
@blegat
Copy link
Member

blegat commented Mar 28, 2024

I like MOI's _PrintOptions. I think we unify MOI and JuMP printing and we should start by having the same option struct.

@odow
Copy link
Member Author

odow commented Mar 28, 2024

Developer call agrees that we could do something different in the longer term, but that this is sufficient for now. We can merge and then wait to see if anyone complains.

@odow odow merged commit dff144b into master Mar 29, 2024
11 checks passed
@odow odow deleted the od/skip-printing-constraints branch March 29, 2024 21:55
@LebedevRI
Copy link
Contributor

It would be nice if these kind of knobs be mentioned in the docs,
otherwise they are kind-of hard to find.

@odow
Copy link
Member Author

odow commented May 25, 2024

We have purposefully chosen not to mention these in the docs. They are currently part of the internal API.

Is there an issue with the current defaults? Why do you want to change them?

@LebedevRI
Copy link
Contributor

LebedevRI commented May 25, 2024

We have purposefully chosen not to mention these in the docs. They are currently part of the internal API.

Is there an issue with the current defaults? Why do you want to change them?

(I agree that the current default is better than nothing, as discussed.)
I wanted to view some of the constraints that got omitted from the output.

@odow
Copy link
Member Author

odow commented May 25, 2024

There are probably better tools for viewing a subset of constraints. For example, you could loop through all_constraints(model).

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.

Model printing is rather verbose
4 participants