hdavid16 / DisjunctiveProgramming.jl

A JuMP extension for Generalized Disjunctive Programming
MIT License
27 stars 3 forks source link

Disallow logical propositions with only 1 logical variable #92

Closed hdavid16 closed 8 months ago

hdavid16 commented 8 months ago

Currently, @constraint(m, y := true) throws an error, but @constraint(m, logical_not(y) := true does not. For consistency, both should error since the user should fix the value of the logical variable instead. This PR makes adds additional checks to enforce this.

codecov[bot] commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (b26e1ed) 99.89% compared to head (79c54c0) 99.89%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #92 +/- ## ======================================= Coverage 99.89% 99.89% ======================================= Files 10 10 Lines 963 967 +4 ======================================= + Hits 962 966 +4 Misses 1 1 ``` | [Files](https://app.codecov.io/gh/hdavid16/DisjunctiveProgramming.jl/pull/92?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Hector+Perez) | Coverage Δ | | |---|---|---| | [src/constraints.jl](https://app.codecov.io/gh/hdavid16/DisjunctiveProgramming.jl/pull/92?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Hector+Perez#diff-c3JjL2NvbnN0cmFpbnRzLmps) | `100.00% <100.00%> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

hdavid16 commented 8 months ago

It is still needed to reformulate:

@constraint(model, y[1] ∧ ¬y[2] := true)

I have updated test_intersection_reformulation() to use this constraint for the test, which should allow for testing the line you indicate.