-
Notifications
You must be signed in to change notification settings - Fork 22
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
refactor: remove Gurobi requirement #106
Merged
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a0ddb73
chore: remove Gurobi dependency
danielolsen 056b0c0
chore: add Requires
danielolsen 66ce8aa
refactor: create new file for gurobi-specific functions
danielolsen 4dec7c9
refactor: remove Gurobi references from main REISE.jl file
danielolsen 5f75865
refactor: remove gurobi-specific code from loop.jl
danielolsen 4154512
refactor: add include for gurobi-specific code if Gurobi has been loaded
danielolsen d07c39d
refactor: create new classes for simulation Launchers
danielolsen a5617df
chore: add Gurobi add and import to Dockerfile
danielolsen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Importing Gurobi in this way avoids a warning with Requires | ||
import .Gurobi | ||
|
||
|
||
function run_scenario_gurobi(; solver_kwargs::Union{Dict, Nothing}=nothing, kwargs...) | ||
solver_kwargs = something(solver_kwargs, Dict("Method" => 2, "Crossover" => 0)) | ||
try | ||
global env = Gurobi.Env() | ||
global m = run_scenario(; | ||
optimizer_factory=env, solver_kwargs=solver_kwargs, kwargs...) | ||
finally | ||
Gurobi.finalize(JuMP.backend(m)) | ||
Gurobi.finalize(env) | ||
println("Connection closed successfully!") | ||
end | ||
# Return `nothing` to prevent `m` from the `try` block from being returned | ||
return nothing | ||
end | ||
|
||
|
||
function new_model(env::Gurobi.Env) | ||
return JuMP.direct_model(Gurobi.Optimizer(env)) | ||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I try to understand how you can avoid to instantiate the parent class using
super()
. The parameters used inREISE.run_scenario_gurobi
) are all attributes of theLauncher
class (to the exception ofexecute_dir
andthreads
) are set in the constructor ofLauncher
. I guess I am missing something.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GurobiLauncher
inherits the__init__
fromLauncher
since we don't redefine our own.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. I guess I have never been in a situation where the child class does not have a constructor