R code for Generalized Frechet bounds