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

Implement model printing #1646

Merged
merged 5 commits into from Dec 6, 2018
Merged

Implement model printing #1646

merged 5 commits into from Dec 6, 2018

Conversation

blegat
Copy link
Member

@blegat blegat commented Nov 26, 2018

I have left two features as future work:

Closes #1180

@odow
Copy link
Member

odow commented Nov 26, 2018

You've seen #1602 right?

@blegat
Copy link
Member Author

blegat commented Nov 26, 2018

You've seen #1602 right?

No I missed that. Fortunately, there is not too much intersection, most of the work of this PR was implementing model_string and testing it and it does not implement solver name. #1602 implements show(::IO, ::Model), we can replace the implementation of this PR by the one in #1602.

@blegat blegat mentioned this pull request Nov 28, 2018
@codecov
Copy link

codecov bot commented Nov 28, 2018

Codecov Report

Merging #1646 into master will increase coverage by 0.45%.
The diff coverage is 88.88%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1646      +/-   ##
==========================================
+ Coverage   90.51%   90.96%   +0.45%     
==========================================
  Files          28       28              
  Lines        3805     4239     +434     
==========================================
+ Hits         3444     3856     +412     
- Misses        361      383      +22
Impacted Files Coverage Δ
src/objective.jl 93.33% <ø> (ø) ⬆️
src/macros.jl 89.05% <100%> (-0.85%) ⬇️
src/print.jl 89.13% <88.7%> (+16.05%) ⬆️
src/JuMP.jl 78.85% <0%> (+3.85%) ⬆️

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 e5264e7...2fc482e. Read the comment docs.

io_test(REPLMode, model_1, """
Max a - b + 2 a1 - 10 x
Subject to
x $inset MathOptInterface.ZeroOne()
Copy link
Member

Choose a reason for hiding this comment

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

I think this should be printed as x binary or something similar. Could be added now or left as a TODO.

Copy link
Member Author

Choose a reason for hiding this comment

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

Moved to #1662

src/print.jl Show resolved Hide resolved
Solver name: No optimizer attached.
Names registered in the model: b, c, c1, b1, a1, x, fi, z, u, a, y""", repl=:show)

io_test(IJuliaMode, model_1, """
Copy link
Member

Choose a reason for hiding this comment

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

Does this address #957? We don't want the detailed form to be the default printout in IJulia or at the repl.

Copy link
Member Author

Choose a reason for hiding this comment

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

No, this can be done in a separate PR

test/print.jl Outdated
@constraint(model_2, x*y <= 1)

names_in_scope = Set([:x, :y])
# The order in which they appear varies between 32-bit and 64-bit
Copy link
Member

Choose a reason for hiding this comment

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

This is weird. What about sorting the list of names in the print function?

@blegat blegat merged commit 567097a into master Dec 6, 2018
@mlubin mlubin deleted the bl/print branch December 7, 2018 01:23
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.

None yet

3 participants