Skip to content

Error users earlier, add Single type #43

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

Merged
merged 4 commits into from
May 3, 2022
Merged

Error users earlier, add Single type #43

merged 4 commits into from
May 3, 2022

Conversation

GiggleLiu
Copy link
Collaborator

@GiggleLiu GiggleLiu commented May 2, 2022

Thanks for @jon-wurtz 's feedback, I did the following changes in this PR.
Now if the input is an integer, it always return a TruncatedPoly type.

julia> ConfigsMax()
ConfigsMax{Single, true, false}()

julia> ConfigsMax(1)
ConfigsMax{1, true, false}()

julia> gp = IndependentSet(smallgraph(:petersen));

julia> solve(gp, ConfigsMax(1))
0-dimensional Array{TruncatedPoly{1, ConfigEnumerator{10, 1, 1}, Float64}, 0}:
{0010111000, 1010000011, 0100100110, 0101010001, 1001001100}*x^4

It also error users at input if the property if not computable

julia> gp = IndependentSet(smallgraph(:petersen); weights=rand(10));

julia> solve(gp, ConfigsMax(2))
ERROR: ArgumentError: Graph property `ConfigsMax{2, true, false}` is not computable due to having non-integer weights. Maybe you wanted `SingleConfigMax(2)`?

julia> solve(gp, ConfigsMax(0))
ERROR: AssertionError: k == Single || k > 0

Also updated some documentation.

@GiggleLiu GiggleLiu changed the title Error users earlier, avoid 1, >1 difference is XXXMax(k). Error users earlier, add Single type May 2, 2022
@GiggleLiu GiggleLiu requested a review from jon-wurtz May 2, 2022 21:17
@GiggleLiu GiggleLiu merged commit 62e8956 into master May 3, 2022
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.

1 participant