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

rules with '&' #14

Open
balima78 opened this issue Mar 31, 2021 · 1 comment
Open

rules with '&' #14

balima78 opened this issue Mar 31, 2021 · 1 comment

Comments

@balima78
Copy link

balima78 commented Mar 31, 2021

I'm trying some rules with '&' but when I try to run your functions from {validatetoos} I have an error. Here the example:

rules <- validator( r1 = A1 == 0 & A2 == 0 & A3 <= A4
, r2 = A1 == 0 & A2 == 0 & A3 > A4 )

is_infeasible(rules)

Error in A[, v] : subscript out of bounds
In addition: Warning message:
In to_miprules(x) : Ignoring rules: r1, r2

@edwindj
Copy link
Member

edwindj commented Apr 1, 2021

Thanks for your question!

In validate and validator a record is considered valid if it obeys all rule.
So implicitely a rule set is "&"-ding all rules.

validatetools (and errorlocate) currently assume that rules are not composed by "&".

Current work-around is splitting your rules (replacing "&" with ",")

rules <- validator(
                   r1   = A1 == 0
                 , r2 = A2 == 0
                 , r3 = A3 <= A4
                 , r4 = A3 > A4 
                )

Suggestions for validatetools are welcome: validatetools could rewrite the ruleset to do exactly this...

Best,

Edwin

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

No branches or pull requests

2 participants