| 264 | | mr_field = 'mr_alt' |
| 265 | | point2compareResidual = getattr(point2compare, mr_field)() |
| 266 | | else: |
| 267 | | mr_field = 'mr' |
| 268 | | point2compareResidual = getattr(point2compare, mr_field)() |
| 269 | | |
| 270 | | criticalResidualValue = max(self.p.contol, point2compareResidual) |
| 271 | | |
| 272 | | if hasattr(self, '_'+mr_field): |
| 273 | | if getattr(self, '_'+mr_field) > criticalResidualValue: return False |
| 274 | | else: |
| 275 | | #TODO: simplify it! |
| 276 | | #for fn in Residuals: (...) |
| 277 | | if altLinInEq: |
| 278 | | if self.__all_lin_ineq() > criticalResidualValue: return False |
| 279 | | else: |
| 280 | | if any(self.lb() > criticalResidualValue): return False |
| 281 | | if any(self.ub() > criticalResidualValue): return False |
| 282 | | if any(self.lin_ineq() > criticalResidualValue): return False |
| 283 | | if any(abs(self.lin_eq()) > criticalResidualValue): return False |
| 284 | | if any(abs(self.h()) > criticalResidualValue): return False |
| 285 | | if any(self.c() > criticalResidualValue): return False |
| 286 | | |
| 287 | | mr = getattr(self, mr_field)() |
| 288 | | |
| 289 | | if not self.p.isNaNInConstraintsAllowed: |
| 290 | | if point2compare.__nNaNs__() > self.__nNaNs__(): return True |
| 291 | | elif point2compare.__nNaNs__() < self.__nNaNs__(): return False |
| 292 | | # TODO: check me |
| 293 | | if mr <= self.p.contol and point2compareResidual <= self.p.contol and self.__nNaNs__() != 0: return mr < point2compareResidual |
| 294 | | |
| 295 | | if mr < point2compareResidual and self.p.contol < point2compareResidual: return True |
| 296 | | |
| 297 | | point2compareF_is_NaN = isnan(point2compare.f()) |
| 298 | | selfF_is_NaN = isnan(self.f()) |
| 299 | | |
| 300 | | if not point2compareF_is_NaN: # f(point2compare) is not NaN |
| 301 | | if not selfF_is_NaN: # f(newPoint) is not NaN |
| 302 | | return self.f() < point2compare.f() |
| 303 | | else: # f(newPoint) is NaN |
| 304 | | return False |
| 305 | | else: # f(point2compare) is NaN |
| 306 | | if selfF_is_NaN: # f(newPoint) is NaN |
| 307 | | return mr < point2compareResidual |
| 308 | | else: # f(newPoint) is not NaN |
| 309 | | return True |
| | 286 | if self.__all_lin_ineq() > criticalResidualValue: return False |
| | 287 | else: |
| | 288 | if any(self.lb() > criticalResidualValue): return False |
| | 289 | if any(self.ub() > criticalResidualValue): return False |
| | 290 | if any(self.lin_ineq() > criticalResidualValue): return False |
| | 291 | if any(abs(self.lin_eq()) > criticalResidualValue): return False |
| | 292 | if any(abs(self.h()) > criticalResidualValue): return False |
| | 293 | if any(self.c() > criticalResidualValue): return False |
| | 294 | |
| | 295 | mr = getattr(self, mr_field)() |
| | 296 | |
| | 297 | if not self.p.isNaNInConstraintsAllowed: |
| | 298 | if point2compare.__nNaNs__() > self.__nNaNs__(): return True |
| | 299 | elif point2compare.__nNaNs__() < self.__nNaNs__(): return False |
| | 300 | # TODO: check me |
| | 301 | if mr <= self.p.contol and point2compareResidual <= self.p.contol and self.__nNaNs__() != 0: return mr < point2compareResidual |
| | 302 | |
| | 303 | if mr < point2compareResidual and self.p.contol < point2compareResidual: return True |
| | 304 | |
| | 305 | point2compareF_is_NaN = isnan(point2compare.f()) |
| | 306 | selfF_is_NaN = isnan(self.f()) |
| | 307 | |
| | 308 | if not point2compareF_is_NaN: # f(point2compare) is not NaN |
| | 309 | if not selfF_is_NaN: # f(newPoint) is not NaN |
| | 310 | return self.f() < point2compare.f() |
| | 311 | else: # f(newPoint) is NaN |
| | 312 | return False |
| | 313 | else: # f(point2compare) is NaN |
| | 314 | if selfF_is_NaN: # f(newPoint) is NaN |
| | 315 | return mr < point2compareResidual |
| | 316 | else: # f(newPoint) is not NaN |
| | 317 | return True |