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

Support MOI.TimeLimitSec #165

Closed
mzy2240 opened this issue Mar 29, 2023 · 2 comments
Closed

Support MOI.TimeLimitSec #165

mzy2240 opened this issue Mar 29, 2023 · 2 comments

Comments

@mzy2240
Copy link

mzy2240 commented Mar 29, 2023

model = Model(() -> AmplNLWriter.Optimizer("/Users/xxx/Downloads/AMPL/gurobi"))
set_time_limit_sec(model, 600.0)

When using gurobi with AMPL, set_time_limit_sec will raise

MathOptInterface.UnsupportedAttribute{MathOptInterface.TimeLimitSec}: Attribute MathOptInterface.TimeLimitSec() is not supported by the model

Considering many users may actually use Gurobi/CPLEX/XPRESS/COPT with AMPL license, can we provide a generic attribute TimeLimitSec similar to COPT.jl Gurobi.jl?

@mzy2240
Copy link
Author

mzy2240 commented Mar 29, 2023

Of course I could check the native attribute name for each solvers (most of them are just timelimit), but I am thinking those work might be duplicated (when creating wrappers like COPT.jl and Gurobi.jl you probably already went through the same process).

@odow
Copy link
Member

odow commented Mar 29, 2023

We can't do this in AmplNLWriter because there is no way to set this uniformly across solvers via the AMPL interface.

You'll need to use set_optimizer_attribute(model, "xxx", value) where xxx is the solver-specific string.

@mzy2240 mzy2240 closed this as completed Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants