Skip to content

Support to bridges with external sets/functions #490

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
wants to merge 2 commits into from
Closed

Support to bridges with external sets/functions #490

wants to merge 2 commits into from

Conversation

IssamT
Copy link
Contributor

@IssamT IssamT commented Aug 24, 2018

It is working for what I needed but I'd consider the PR as a WIP. There are still two issues mainly:

  • The sets/functions need to be explicitly imported in the current scope.
  • I had no clue how to name the new equivalent functions.

@codecov-io
Copy link

codecov-io commented Aug 24, 2018

Codecov Report

Merging #490 into master will decrease coverage by 1.08%.
The diff coverage is 36.11%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #490      +/-   ##
=========================================
- Coverage   95.38%   94.3%   -1.09%     
=========================================
  Files          46      46              
  Lines        4681    4738      +57     
=========================================
+ Hits         4465    4468       +3     
- Misses        216     270      +54
Impacted Files Coverage Δ
src/Utilities/model.jl 83.33% <50%> (-14.52%) ⬇️
src/Bridges/singlebridgeoptimizer.jl 30% <8.33%> (-55.72%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a1bfd83...e285092. Read the comment docs.

@@ -410,14 +410,31 @@ _mod(m::Module, s::Symbol) = Expr(:., m, :($(QuoteNode(s))))
# (:Zeros) -> :(MOI.Zeros)
_moi(s::Symbol) = _mod(MOI, s)
Copy link
Member

Choose a reason for hiding this comment

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

Why not simply removing this function and force the user to write

@model LPModel () (MOI.EqualTo, MOI.GreaterThan, MOI.LessThan, MOI.Interval) (MOI.Zeros, MOI.Nonnegatives, MOI.Nonpositives) () (MOI.SingleVariable,) (MOI.ScalarAffineFunction,) (MOI.VectorOfVariables,) (MOI.VectorAffineFunction,)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The @model might be called within the definition of module NewModule in which case you can't pass NewModule.NewSet for example. Can you?

Copy link
Member

Choose a reason for hiding this comment

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

If you remove this _moi function and all calls to it then it should work

Copy link
Member

Choose a reason for hiding this comment

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

FWIW the escaping/scoping rules for macros changed between 0.6 and 0.7. You might run into this.

Copy link
Member

Choose a reason for hiding this comment

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

Forcing the module prefix sounds like the most robust way to go.

@blegat blegat added this to the 0.6.0 milestone Aug 25, 2018
@IssamT
Copy link
Contributor Author

IssamT commented Aug 27, 2018

replaced by #510

@IssamT IssamT closed this Aug 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants