Skip to content

FileFormats.NL: add reader #1811

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

Closed
odow opened this issue Apr 22, 2022 · 8 comments
Closed

FileFormats.NL: add reader #1811

odow opened this issue Apr 22, 2022 · 8 comments
Assignees
Labels
Project: next-gen nonlinear support Issues relating to nonlinear support Submodule: FileFormats About the FileFormats submodule

Comments

@odow
Copy link
Member

odow commented Apr 22, 2022

The blocker for an NL reader has been a suitable data structure to read it into.

We should build on #1804 and add a NL reader. This would be a boon to JuMP benchmarking.

@odow odow added Submodule: FileFormats About the FileFormats submodule Project: next-gen nonlinear support Issues relating to nonlinear support labels Apr 22, 2022
@jd-foster
Copy link
Contributor

Would this wrap ASL_jll (à la AMPLNLReader.jl)?

@odow
Copy link
Member Author

odow commented Apr 27, 2022

No, we'd probably just try to parse the file in pure Julia.

@jd-foster
Copy link
Contributor

jd-foster commented Apr 27, 2022

Is this open to contributing or have you already got a draft?

@odow
Copy link
Member Author

odow commented Apr 27, 2022

I haven't started on this. My guess is we initially just want to consider read(io::IO)::Nonlinear.Model, and then we can think about how to incorporate it into MOI.FileFormats.

@odow
Copy link
Member Author

odow commented May 9, 2022

Did you make a start @jd-foster? Otherwise I'm going to do this.

@jd-foster
Copy link
Contributor

No. Go for it.

@odow odow self-assigned this May 9, 2022
@odow
Copy link
Member Author

odow commented May 17, 2022

Okay, I tried a few things but it got delicate. I still don't have a clear design.

A couple of issues:

  • write wants a very particular model structure. It made sense to only implement copy_to so that we can deal with everything once, and not store additional copies of the model.
  • read wants to return model that we can copy into something else. That doesn't fit with write
  • .sol file parsing is annoying. Currently it lives in AmplNLWriter, but it relies on internal data of MOI.NL.Model, so it makes sense to move it here before refactoring write.

In particular, it's really annoying that the variable ordering in the NL file does not correspond to the ordering of variable indices in the MOI model!!! If binary/integer constraints were stored separately instead of depending on the order of variables, this would greatly simplify things. But alas, that's no what happens.

Some options:

  • Keep everything the same and kludge read to store a model inside our current Model, then overload get for it. That would lead to problems because you couldn't ask for get if you copied a problem to Model, only if you called read.
  • Make a new Model and have write create a second copy of the problem. This is probably the right way to go, but it breaks the assumptions in AmplNLWriter which currently has the sol file parsing.

@odow odow closed this as completed May 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Project: next-gen nonlinear support Issues relating to nonlinear support Submodule: FileFormats About the FileFormats submodule
Development

No branches or pull requests

2 participants