#2994: add boundary constraints and threshold for epsx hoping to prevent endless loop in alglib, add optimization of variable weights