File tree Expand file tree Collapse file tree 2 files changed +18
-10
lines changed
Expand file tree Collapse file tree 2 files changed +18
-10
lines changed Original file line number Diff line number Diff line change @@ -61,10 +61,13 @@ rules <- validator( rule1 = x > 0
6161is_infeasible(rules)
6262
6363detect_infeasible_rules(rules, verbose=TRUE)
64- make_feasible(rules, verbose=TRUE)
65-
6664# find out the conflict with this rule
6765is_contradicted_by(rules, "rule1", verbose=TRUE)
66+
67+ # we prefer to keep rule1, so we can give rule1 Inf weight
68+ detect_infeasible_rules(rules, weight=c(rule1 = Inf), verbose=TRUE)
69+ make_feasible(rules, weight=c(rule1=Inf), verbose=TRUE)
70+
6871```
6972
7073### Finding contradicting if rules
Original file line number Diff line number Diff line change @@ -62,21 +62,26 @@ detect_infeasible_rules(rules, verbose=TRUE)
6262# > Found:
6363# > rule1: x > 0
6464# > [1] "rule1"
65- make_feasible(rules , verbose = TRUE )
66- # > Found:
67- # > rule1: x > 0
68- # > Dropping rule(s): "rule1"
69- # > Object of class 'validator' with 1 elements:
70- # > rule2: x < 0
71- # > Rules are evaluated using locally defined options
72-
7365# find out the conflict with this rule
7466is_contradicted_by(rules , " rule1" , verbose = TRUE )
7567# > Rule(s):
7668# > rule1: x > 0
7769# > contradicted by:
7870# > rule2: x < 0
7971# > [1] "rule2"
72+
73+ # we prefer to keep rule1, so we can give rule1 Inf weight
74+ detect_infeasible_rules(rules , weight = c(rule1 = Inf ), verbose = TRUE )
75+ # > Found:
76+ # > rule2: x < 0
77+ # > [1] "rule2"
78+ make_feasible(rules , weight = c(rule1 = Inf ), verbose = TRUE )
79+ # > Found:
80+ # > rule2: x < 0
81+ # > Dropping rule(s): "rule2"
82+ # > Object of class 'validator' with 1 elements:
83+ # > rule1: x > 0
84+ # > Rules are evaluated using locally defined options
8085```
8186
8287### Finding contradicting if rules
You can’t perform that action at this time.
0 commit comments