Detect variables of which the values are restricted to a single value by the rule set. Simplify the rule set by replacing fixed variables with these values.

simplify_fixed_variables(x, eps = 1e-08, ...)

Arguments

x

validator object with validation rules

eps

detected fixed values will have this precission.

...

passed to substitute_values.

Value

validator object in which

Examples

library(validate)
rules <- validator( x >= 0
                  , x <= 0
                  )
detect_fixed_variables(rules)
#> $x
#> [1] 0
#> 
simplify_fixed_variables(rules)
#> Object of class 'validator' with 1 elements:
#>  .const_x: x == 0

rules <- validator( x1 + x2 + x3 == 0
                  , x1 + x2 >= 0
                  , x3 >= 0
                  )
simplify_fixed_variables(rules)
#> Object of class 'validator' with 3 elements:
#>  V1       : x1 + x2 + 0 == 0
#>  V2       : x1 + x2 >= 0
#>  .const_x3: x3 == 0