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

Implementation of smoothing stabilization #348

Merged
merged 20 commits into from
Jun 4, 2020
Merged

Implementation of smoothing stabilization #348

merged 20 commits into from
Jun 4, 2020

Conversation

rrsadykov
Copy link
Collaborator

No description provided.

@codecov
Copy link

codecov bot commented May 21, 2020

Codecov Report

Merging #348 into master will decrease coverage by 2.23%.
The diff coverage is 50.68%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #348      +/-   ##
==========================================
- Coverage   76.03%   73.79%   -2.24%     
==========================================
  Files          51       52       +1     
  Lines        3764     3931     +167     
==========================================
+ Hits         2862     2901      +39     
- Misses        902     1030     +128     
Impacted Files Coverage Δ
src/Algorithm/Algorithm.jl 100.00% <ø> (ø)
src/Algorithm/branching/branchingalgo.jl 88.54% <0.00%> (ø)
src/Algorithm/conquer.jl 71.01% <ø> (ø)
src/Algorithm/storage.jl 78.15% <ø> (-0.37%) ⬇️
src/Algorithm/colgenstabilization.jl 8.33% <8.33%> (ø)
src/Algorithm/colgen.jl 81.01% <80.35%> (-2.10%) ⬇️
src/Algorithm/basic/solveipform.jl 87.50% <100.00%> (+0.54%) ⬆️
src/Algorithm/formstorages.jl 37.22% <100.00%> (+0.92%) ⬆️
src/ColunaBase/solsandbounds.jl 53.52% <0.00%> (-4.23%) ⬇️

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 22a3693...3e74b6f. Read the comment docs.

@rrsadykov
Copy link
Collaborator Author

@guimarqu What is the best way to do a linear combination of two DualSolution? For example, if we have solutions (constr_1 = 2, constr_2 = 2) and (constr_1 = 1, constr_3 = 1), then linear combination with coefficient 0.5 should be (constr_1 = 1.5, constr_2 = 1, constr_3 = 0.5). In addition, the coefficient should depend on the constraint type (coefficient should be different for convexity constraints).

@guimarqu
Copy link
Contributor

@guimarqu What is the best way to do a linear combination of two DualSolution? For example, if we have solutions (constr_1 = 2, constr_2 = 2) and (constr_1 = 1, constr_3 = 1), then linear combination with coefficient 0.5 should be (constr_1 = 1.5, constr_2 = 1, constr_3 = 0.5). In addition, the coefficient should depend on the constraint type (coefficient should be different for convexity constraints).

If the coefficient depends on the duty, it’s better to use a loop.

@rrsadykov
Copy link
Collaborator Author

If the coefficient is independent, is it possible to perform the linear combination in O(n)?
Because if one uses a loop, the complexity is O(n\log n), no?
I think that the best is to do the linear combination with the same coefficient in O(n), and then make another loop in O(n) to correct the coefficients of convexity constraints.

@guimarqu
Copy link
Contributor

guimarqu commented May 22, 2020

Loop is O(n), lookup is O(log n).
If you do something like that, you are in O(n) :

constrids = [constrid for (constrid, _) in getconstr(form)] # sorted ? If not, we should consider keeping the constraint dict sorted
constrvals = zeros(Float64, length(constrids)

pos = 1
for (constrid, constrval) in dualsolution # sorted and O(n)
    while constrids[pos] < constrid
         pos += 1
    end
    if ! (constrids[pos] > constrid)
        constrvals[pos] += coefficient * constrval
    end
end

@guimarqu
Copy link
Contributor

It's not a good idea to keep the constraints dict sorted. If we assume that no constraints are added during column generation, we can sort the constrids once at the beginning of colgen.

@rrsadykov
Copy link
Collaborator Author

Ok, I will first do a simple version in O(n\log n). We will see latter if we need to improve that

@rrsadykov
Copy link
Collaborator Author

@guimarqu In Solution.sol, ConstrId are sorted or not?

@guimarqu
Copy link
Contributor

@guimarqu In Solution.sol, ConstrId are sorted or not?

Yes, they are.

@guimarqu guimarqu added the enhancement New feature or request label May 29, 2020
@rrsadykov rrsadykov marked this pull request as ready for review June 3, 2020 16:36
@rrsadykov
Copy link
Collaborator Author

@guimarqu Guillaume, can you review and merge? All tests without stabilization work.
I prefer to do an "intermediate" merge now as there are many changes in column generation algorithm and it will simplify merging with other branches in the future.

For the moment, stabilization is not quite ready yet, but the column generation algorithm is fully prepared for it. I think I need a couple days more to finish the implementation and add tests.

Can you leave the branch after merge so I can continue

@rrsadykov rrsadykov requested a review from guimarqu June 3, 2020 16:42
@guimarqu guimarqu mentioned this pull request Jun 3, 2020
Copy link
Contributor

@guimarqu guimarqu left a comment

Choose a reason for hiding this comment

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

Only style issues :

On github, 1 branch = 1 PR, you can create a new branch from this one or after the merge of this one into master.

src/Algorithm/basic/solveipform.jl Show resolved Hide resolved
src/Algorithm/colgen.jl Outdated Show resolved Hide resolved
src/Algorithm/colgen.jl Show resolved Hide resolved
src/Algorithm/colgen.jl Outdated Show resolved Hide resolved
src/Algorithm/colgen.jl Show resolved Hide resolved
src/Algorithm/colgen.jl Outdated Show resolved Hide resolved
src/Algorithm/colgen.jl Outdated Show resolved Hide resolved
src/Algorithm/colgen.jl Outdated Show resolved Hide resolved
src/Algorithm/colgen.jl Outdated Show resolved Hide resolved
src/Algorithm/colgenstabilization.jl Show resolved Hide resolved
@guimarqu
Copy link
Contributor

guimarqu commented Jun 3, 2020

Do you want to finish stabilization before release of 0.3 (we can wait until mid-June max) ?

@rrsadykov
Copy link
Collaborator Author

I think I can finish this week

@rrsadykov rrsadykov merged commit 52f3c0f into master Jun 4, 2020
@rrsadykov rrsadykov deleted the stabilization branch June 4, 2020 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants