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

"logarthmic" to "logarithmic", improve readability, test 2D patterns and optimal IB #25

Merged
merged 8 commits into from
Jul 20, 2018

Conversation

chriscoey
Copy link
Contributor

@chriscoey chriscoey commented Jul 9, 2018

  • change "logarthmic" to "logarithmic"
  • slightly improve readability/consistency, especially of tests
  • test 2D patterns
  • test optimal IB scheme (tragically slow)

@coveralls
Copy link

coveralls commented Jul 9, 2018

Coverage Status

Coverage increased (+21.8%) to 77.635% when pulling d9881f0 on chriscoey:cc_cleanup into 184ea70 on joehuchette:master.

@codecov-io
Copy link

codecov-io commented Jul 9, 2018

Codecov Report

Merging #25 into master will increase coverage by 21.84%.
The diff coverage is 62.18%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master      #25       +/-   ##
===========================================
+ Coverage   55.79%   77.63%   +21.84%     
===========================================
  Files           2        2               
  Lines         708      702        -6     
===========================================
+ Hits          395      545      +150     
+ Misses        313      157      -156
Impacted Files Coverage Δ
src/types.jl 89.7% <28.57%> (+36.76%) ⬆️
src/jump.jl 76.34% <63.05%> (+20.24%) ⬆️

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 184ea70...d9881f0. Read the comment docs.

@chriscoey chriscoey changed the title change "logarthmic" to "logarithmic", slightly improve readability/consistency change "logarthmic" to "logarithmic", improve tests readability, test 2D patterns Jul 9, 2018
@chriscoey
Copy link
Contributor Author

@joehuchette optimal IB scheme is extremely slow to calculate (even for 4 breakpoints).. is it ever worthwhile?

also, where do the values for z in your tests come from? they don't match the true function values at the points, though they are the correct optimal solutions for the models constructed. are you just checking for consistency across the different formulations?

@chriscoey
Copy link
Contributor Author

chriscoey commented Jul 9, 2018

if optimal IB scheme test takes too long on travis, I will remove it. quite absurd how slow it is.

edit: reduced it to 3x3 breakpoints - works ok

@chriscoey chriscoey mentioned this pull request Jul 10, 2018
2 tasks
@chriscoey chriscoey changed the title change "logarthmic" to "logarithmic", improve tests readability, test 2D patterns "logarthmic" to "logarithmic", improve readability, test 2D patterns and optimal IB Jul 10, 2018
@chriscoey
Copy link
Contributor Author

I'm satisfied at this point

Copy link
Contributor

@joehuchette joehuchette left a comment

Choose a reason for hiding this comment

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

Looks fine to me, but the diff for the triangulation formulations is hard to read. Did you change that code?

src/jump.jl Outdated
sum(λ[tx,ty] for tx in 1:nˣ, ty in 1:nʸ if mod(tx,2) != mod(ty,2) && (tx+ty) in 3:4:(nˣ+nʸ)) ≤ w[2]
sum(λ[tx,ty] for tx in 1:nˣ, ty in 1:nʸ if mod(tx,2) != mod(ty,2) && (tx+ty) in 5:4:(nˣ+nʸ)) ≤ 1 - w[2]
end)
# elseif pattern == :OptimalTriangleSelection
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this commented out?

@chriscoey
Copy link
Contributor Author

I commented out 3 parts of code in src/jump.jl:

  • sos2 MC formulation
  • optimal triangle selection pattern
  • stencil pattern

because they all appeared to me to be not useable/accessible. imo it's better (and less confusing) to have untestable dead code commented out.

the two patterns above are not recognized in BivariatePWLFunction so it fails without an error message on https://github.com/joehuchette/PiecewiseLinearOpt.jl/blob/184ea708cd3d3869a95cd62b9dcb1923d03a1a77/src/types.jl#L101

@chriscoey
Copy link
Contributor Author

I only made a few small aesthetic changes, mostly to comments, in the triangulation formulations

@joehuchette
Copy link
Contributor

They're accessible if you change the pattern field after construction; I had research code that used this. The interface to specify the formulation needs to be rewritten (on my TODO list), but the code is not dead and shouldn't be removed.

@chriscoey
Copy link
Contributor Author

OK so it sounds like a simple fix to allow the two extra patterns, right? a few extra lines in BivariatePWLFunction. we can do it here and then cover the two patterns with unit tests.

which pattern did you need to specify before you could later change the pattern to stencil? and same question for triangle selection.

@joehuchette
Copy link
Contributor

Yes, it should be a simple change to support them "officially".

I would generate the triangulation randomly, then change the pattern field manually. The conflation here between structure (random) and formulation (e.g. optimal triangle selection) is not great, and one of the reasons I would like to change the interface.

@chriscoey
Copy link
Contributor Author

OK I uncommented. can you open an issue for the expected interface change

@joehuchette joehuchette merged commit ee7b8e8 into jump-dev:master Jul 20, 2018
@joehuchette
Copy link
Contributor

Thanks! #28 is for the interface change, take a look and let me know your thoughts.

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.

4 participants