DblMatrix lrbnd = new DblMatrix(2.0);
DblMatrix upbnd = new DblMatrix(12.0);
Param.Dblput("pH",initval);
NMSimplex Simplex = new NMSimplex(new CbObjective(this),Param);
NMSimplexConfiguration Opts = Simplex.getOptions();
DblParamSet bnd = (DblParamSet)Opts.getConfigValue("LowerBnd");
bnd.Dblput("pH",lrbnd);
Opts.setConfigValue("LowerBnd",bnd);
bnd = (DblParamSet)Opts.getConfigValue("UpperBnd");
bnd.Dblput("pH",upbnd);
Opts.setConfigValue("UpperBnd",bnd);
try
{
Simplex.solve();
}
catch (Exception err)
{
throw new RuntimeException("Failed minimization in initpH",err);
}
DblParamSet best = Simplex.getBestEstimate();
return(best.Dblget("pH"));
}