You cannot use strict inequalities with the NLP solver. But you could do this instead to force a positive mean:
con PositiveMean: mean >= 1e-6;
Similarly, you can force A < B like this:
con A_LT_B: A + 1e-6 <= B;
With or without these constraints, your new objective does not avoid all trivial solutions. For example, the following code yields an optimal solution with mean = 2 and objective value = 0:
proc optmodel;
set YEARS = 2013..2016;
set DAYS;
num temp{DAYS, YEARS};
read data temp into DAYS=[Log] {y in YEARS} <temp[Log,y]=col('y'||y)>;
var a,b;
impvar CU{p in DAYS, y in YEARS} = (if a <= temp[p,y] <= b then 1 else 0);
impvar S{y in YEARS} = sum{p in DAYS} CU[p,y];
impvar mean = (sum{y in YEARS} S[y])/card(YEARS);
minimize CoefvSquared = (sum{y in YEARS}((S[y]-mean)**2)/card(YEARS))/mean^2;
a = min {p in DAYS, y in YEARS} temp[p,y];
b = max {p in DAYS, y in YEARS} temp[p,y];
solve;
/* display solution */
print a b;
print S mean CoefvSquared;
quit;
Note that I squared the objective to avoid the SQRT function, which is nondifferentiable at 0. Also, the a and b values supplied as a starting solution are computed as min and max, respectively, across all observations.
... View more