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

[docs] add design patterns tutorial #2812

Merged
merged 10 commits into from
Nov 28, 2021
Merged

[docs] add design patterns tutorial #2812

merged 10 commits into from
Nov 28, 2021

Conversation

odow
Copy link
Member

@odow odow commented Nov 25, 2021

Motivated by this discussion on Discourse: https://discourse.julialang.org/t/integrating-mathoptinterface-into-an-industry-scale-project-e-g-constraint-management/71943

I think this should be pretty helpful for people wanting to create larger JuMP models. It was definitely a gap in our documentation.

Preview link: https://jump.dev/JuMP.jl/previews/PR2812/tutorials/getting_started/design_patterns_for_larger_models/

Part of #2348

@codecov
Copy link

codecov bot commented Nov 25, 2021

Codecov Report

Merging #2812 (cd3e929) into master (fea6787) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2812   +/-   ##
=======================================
  Coverage   94.26%   94.26%           
=======================================
  Files          43       43           
  Lines        5532     5532           
=======================================
  Hits         5215     5215           
  Misses        317      317           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fea6787...cd3e929. Read the comment docs.

@jd-foster

This comment has been minimized.

@jd-foster

This comment has been minimized.

@jd-foster
Copy link
Collaborator

This is great overall. I think it takes the documentation offering to the next level.

@odow
Copy link
Member Author

odow commented Nov 26, 2021

Yeah I'm massively in favor of more involved tutorials like this. I think we can slim-down the number of existing ones in favor of fewer, more in-depth tutorials.

@jd-foster

This comment has been minimized.

@pboes
Copy link

pboes commented Nov 26, 2021

Overall this is really fantastic, I'm very glad I asked this innocuous question and am completely blown away by the fact that within two days this should have generated a tutorial on the docs that I personally have already found super helpful. So thanks @odow, @jd-foster, @rschwarz.

One additional section that I would probably try to add is how to use variable and constraint names (in terms of the base_name/String representation) to generate useful printouts of models. I guess those names aren't used a lot in practice and helping get a quick overview of which constraints are in action in a given model would seem like a place for them to shine. I'm happy to try and provide an example of what I have in mind when I have more time over the weekend. But since there is an example of custom printing for the data already, seeing how a model could be printed informatively would seem to be on-topic as well...

@dourouc05
Copy link
Contributor

That's a great addition to the docs! It's not the only way to implement large-scale models, but it's a very good way to do it.

I think we can slim-down the number of existing ones in favor of fewer, more in-depth tutorials.

I wouldn't go into that direction, at least from the point of view of a user: I prefer to have specific tutorials instead of large ones that present many topics that are not necessarily that related and could be dealt with separately.

@odow
Copy link
Member Author

odow commented Nov 27, 2021

I'm very glad I asked this innocuous question and am completely blown away by the fact that within two days this should have generated a tutorial on the docs that I personally have already found super helpful

Great! I've known that this has been a stumbling block for a while, so you finally motivated me to write it.

If you have other suggestions or questions, please fire away. We're very receptive of constructive criticism.

to generate useful printouts of models

This is covered in various parts:

For larger models, however, printing is almost uniformly a bad idea because the printouts become huge. (For various reasons, we don't print the concise algebraic form of the model.)

You could potentially do something with the Names registered in the model: part of the print-out, which you can programmatically access with keys(object_dictionary(model)). I'm not sure there is a good way to provide general advice though. It's probably up to you to perform some book-keeping in an external data-structure about what constraints have been added to the model, rather than querying the JuMP model directly.

@odow odow closed this Nov 28, 2021
@odow odow reopened this Nov 28, 2021
@odow
Copy link
Member Author

odow commented Nov 28, 2021

Just re-firing the CI. Looks like it got caught in the recent outage of GitHub.

@odow odow merged commit a6d0e24 into master Nov 28, 2021
@odow odow deleted the od/knapsack-docs branch November 28, 2021 19:54
@odow
Copy link
Member Author

odow commented Nov 28, 2021

Thanks for the feedback.

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

Successfully merging this pull request may close these issues.

6 participants