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

Refactoring #17

Closed
wants to merge 4 commits into from
Closed

Refactoring #17

wants to merge 4 commits into from

Conversation

remi-garcia
Copy link

Proposed changes:

  • Remove a few files that were not necessary;
  • Separate the methods into different files;
  • Add a few return nothing when no return statement was provided;
  • For each method, pass the arguments verbose, step, round_results as keyword arguments in order to avoid having to sort the arguments in the vSolve function;
  • In vSolve, replace the if/elseif conditions by a dict to functions.

Tests pass locally, with JuMP 0.23 and 1.1.1 (this closes #16)

ChalmetRecursion(m, yt_1, yt_2, ys_1, ys_2, varArray, rhs_z1, rhs_z2, ϵ, verbose ; kwargs...)
end

return nothing
Copy link
Author

Choose a reason for hiding this comment

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

Example of added return nothing

# MIT License
# Copyright (c) 2017: Xavier Gandibleux, Anthony Przybylski, Gauthier Soleilhac, and contributors.

function solve_dicho(m::JuMP.Model; round_results::Bool=false, verbose, kwargs...)
Copy link
Author

Choose a reason for hiding this comment

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

round_results is a keyword argument here instead of an argument, same for verbose.


if method in keys(methods)
solve_function = methods[method]
solve_function(m; verbose=verbose, relaxation=relax, kwargs...)
Copy link
Author

Choose a reason for hiding this comment

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

step and round_result are passed through kwargs, so dispatch is not necessary anymore. This permits to reduce the "cost" of adding new methods by just extending the Dict.

@remi-garcia remi-garcia closed this by deleting the head repository Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JuMP v1.0
1 participant