-
Notifications
You must be signed in to change notification settings - Fork 4
New reduction rule: BinaryMatrixFactorization to BicliqueCover #140
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
base: main
Are you sure you want to change the base?
Changes from 4 commits
c66c791
e16bdb2
f915691
f263d1e
435723a
9e23fb0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,46 @@ | ||||||
| """ | ||||||
| $TYPEDEF | ||||||
| The reduction result from BinaryMatrixFactorization to BicliqueCover. | ||||||
| ### Fields | ||||||
| - `bicliquecover`: The BicliqueCover problem. | ||||||
| - `k`: The number of bicliques. | ||||||
| """ | ||||||
| struct ReductionBMFToBicliqueCover{Int64} <: AbstractReductionResult | ||||||
| bicliquecover::BicliqueCover{Int64} | ||||||
| k::Int64 | ||||||
| end | ||||||
| Base.:(==)(a::ReductionBMFToBicliqueCover, b::ReductionBMFToBicliqueCover) = a.bicliquecover == b.bicliquecover && a.k == b.k | ||||||
| target_problem(res::ReductionBMFToBicliqueCover) = res.bicliquecover | ||||||
|
|
||||||
| function reduceto(::Type{BicliqueCover}, bmf::BinaryMatrixFactorization) | ||||||
|
||||||
| function reduceto(::Type{BicliqueCover}, bmf::BinaryMatrixFactorization) | |
| function reduceto(::Type{<:BicliqueCover}, bmf::BinaryMatrixFactorization) |
Outdated
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.
Should return a vector, and convert it back with read_solution. e.g.
| function read_solution(factoring::Factoring,solution::AbstractVector) #return a tuple of 2 numbers result |
Outdated
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.
We do not need this?
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| using Test, ProblemReductions, Graphs | ||
|
|
||
| @testset "BMF_BicliqueCover" begin | ||
| A = [1 0 ; 1 1] | ||
| A = BitMatrix(A) | ||
| bmf1 = BinaryMatrixFactorization(A, 2) | ||
| bc1 = ProblemReductions.biclique_cover_from_matrix(Int.(A), 2) | ||
| res = reduceto(BicliqueCover, bmf1) | ||
| res1 = ReductionBMFToBicliqueCover(bc1,2) | ||
| @test res == res1 | ||
| @test res.k == 2 | ||
| @test res.bicliquecover == bc1 | ||
| @test res.bicliquecover.part1 == [i for i in 1:size(A,1)] | ||
| @test target_problem(res) == bc1 | ||
| @test extract_solution(res,[[1,1,1,0],[0,1,0,1]]) == ([true false ; true true], [true false ; false true]) | ||
| @test extract_multiple_solutions(res,[[[1,1,1,0],[0,1,0,1]]]) == [([true false ; true true], [true false ; false true])] | ||
| end |
Uh oh!
There was an error while loading. Please reload this page.