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

Can i write the InfiniteOpt's Model to file of nl? #364

Open
Aijunly opened this issue Oct 4, 2024 · 1 comment
Open

Can i write the InfiniteOpt's Model to file of nl? #364

Aijunly opened this issue Oct 4, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@Aijunly
Copy link

Aijunly commented Oct 4, 2024

Dear InfiniteOpt team,

If there exists a model of like the following

# INITIALIZE THE MODEL
model = InfiniteModel(Ipopt.Optimizer)

And then can i write the model to File_name.nl with the command of

write_to_file(model,"model.nl")

Dose the alternative method of

using AmplNLWriter
model = InfiniteModel(()->AmplNLWriter.Optimizer("Your_path\ipopt.exe"))

works ?

Thanks for your time.

Describe the feature you'd like
I need the feature that i can write the model builded by InfinityOpt.jl to file of File_Name.nl. Thanks.

Sincerely.
Aijune WANG

@Aijunly Aijunly added the enhancement New feature or request label Oct 4, 2024
@pulsipher
Copy link
Collaborator

See #231. You cannot directly write an InfiniteOpt model to an NL file, the issue is that the NL file format does not support infinite dimensional formulations.

However, you can write the discretized JuMP version to an NL writer:

model = InfiniteModel()

# define your model here

build_optimizer_model!(model)
write_to_file(optimizer_model(model), "model.nl")

Once version 0.6 is released, the above will become:

model = InfiniteModel()

# define your model here

build_transformation_backend!(model)
write_to_file(transformation_model(model), "model.nl")

Answering your other question, InfiniteOpt is compatible with any JuMP solver, this includes AmplNLWriter.

If you just want to interface with a solver executable, then I would most recommend using AmplNLWriter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants