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 model_from #2245

Closed
wants to merge 1 commit into from
Closed

Add model_from #2245

wants to merge 1 commit into from

Conversation

blegat
Copy link
Member

@blegat blegat commented Jun 1, 2020

One target use case would be to allow to easily create JuMP from matrix input with https://github.com/JuliaOpt/MatrixOptInterface.jl/tree/master/src, e.g. to replace MathProgBase's linprog.
For instance:

using JuMP, MatrixOptInterface
model = model_from(LPStandardForm(MOI.MAX_SENSE, c, A, b))
set_optimizer(model, GLPK.Optimizer)
optimize!(model)
sol = value.(all_variables(model))

@codecov
Copy link

codecov bot commented Jun 1, 2020

Codecov Report

Merging #2245 into master will increase coverage by 0.36%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2245      +/-   ##
==========================================
+ Coverage   91.27%   91.63%   +0.36%     
==========================================
  Files          42       42              
  Lines        4184     4425     +241     
==========================================
+ Hits         3819     4055     +236     
- Misses        365      370       +5     
Impacted Files Coverage Δ
src/file_formats.jl 100.00% <100.00%> (ø)
src/macros.jl 94.47% <0.00%> (+1.95%) ⬆️

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 90e28ce...d0ae1b2. Read the comment docs.

Copy link
Member

@odow odow left a comment

Choose a reason for hiding this comment

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

I don't understand the need for this?

It's a function to save two lines. Shouldn't this be something copy_to, if it exists at all?

@blegat
Copy link
Member Author

blegat commented Jun 2, 2020

I thought it would be more complicated when I started this. It might obscure things more than help. Still I thought it might be worth discussing whether we want something like this as it might be a quite common operation.

@odow
Copy link
Member

odow commented Jun 2, 2020

This is either a documentation issue if MOI.copy_to, or a possible need for an exported JuMP.copy_to.

@odow
Copy link
Member

odow commented Jul 1, 2020

Can this be closed? I don't see the value in adding an extra function to save two lines.

@blegat blegat closed this Jul 1, 2020
@odow odow deleted the bl/model_from branch September 14, 2020 02:04
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

2 participants