first working version of constrainCoReMinMaxSign.m