Skip to contents

Checks simplex and dual feasibility and evaluates the exact integer numerators and denominators of a residual sandwich.

Usage

verify_certificate(M, target_num, target_den, weight_num, dual_num, dual_den)

Arguments

M

Numeric binary matrix.

target_num

Integer target numerators, one per row.

target_den

Positive common integer target denominator.

weight_num

Nonnegative integer weights; their sum is the denominator.

dual_num

Signed integer dual numerators, one per row.

dual_den

Positive common integer dual denominator.

Details

All intermediate integer operations are conservatively bounded below 2^50 so binary64 arithmetic can represent them exactly. Unsupported large inputs are rejected. The certificate is for the specified rational targets, not an unknown unrounded version. Exact comparisons of rational bounds should use cross multiplication only when products stay in range.

Value

A list containing lower_num, lower_den, upper_num, upper_den and exact.

Examples

verify_certificate(diag(2),c(3,3),10,c(1,1),c(-1,-1),2)
#> $lower_num
#> [1] 4
#> 
#> $lower_den
#> [1] 20
#> 
#> $upper_num
#> [1] 4
#> 
#> $upper_den
#> [1] 20
#> 
#> $exact
#> [1] TRUE
#>