33# ' An infeasible rule set cannot be satisfied by any data because of internal
44# ' contradictions. This function checks whether the record-wise linear,
55# ' categorical and conditional rules in a rule set are consistent.
6+ # ' Note that is it always wise to also check `detect_contradicting_if_rules()`.
67# '
78# ' @example ./examples/feasible.R
89# ' @param x `validator` object with validation rules.
@@ -29,6 +30,11 @@ is_feasible <- function(x, ...){
2930# ' Make an infeasible system feasible, by removing the minimum (weighted) number of rules, such that the remaining
3031# ' rules are not conflicting.
3132# ' This function uses [detect_infeasible_rules()] for determining the rules to be removed.
33+ # ' Note that this may not result in your desired system, because some rules may be more important.
34+ # ' This can be mediated by supplying weights for the rules. Default weight is 1.
35+ # '
36+ # ' Also `make_feasible()` does not check for contradictions in `if` rules, so it is wise to also check
37+ # ' `detect_contradicting_if_rules()` after making the system feasible.
3238# ' @export
3339# ' @param x [validate::validator()] object with the validation rules.
3440# ' @param ... passed to [detect_infeasible_rules()]
@@ -71,7 +77,8 @@ detect_infeasible_rules <- function(x, weight = numeric(), ...){
7177 mr <- fix_cat_domain(mr )
7278
7379 nms <- mr | > sapply(\(x ) x $ rule )
74- w_inf <- nms [grepl(" ^\\ .domain." , nms )] | > sapply(\(x ) Inf )
80+ # meaning: all rules that start with a dot are "hard rules"
81+ w_inf <- nms [grepl(" ^\\ ." , nms )] | > sapply(\(x ) Inf )
7582 weight <- c(weight , w_inf )
7683
7784 is_equality <- sapply(mr , function (m ){
0 commit comments