/usr/share/pyshared/PyTrilinos/NOX/StatusTest.py is in python-pytrilinos 10.4.0.dfsg-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 | # This file was automatically generated by SWIG (http://www.swig.org).
# Version 2.0.4
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
"""
PyTrilinos.NOX.StatusTest is the python interface to the namespace
StatusTest in Trilinos package NOX:
http://trilinos.sandia.gov/packages/nox
The purpose of NOX.StatusTest is to provide clompletely flexible
specification of stopping tests for NOX algorithms.
NOX.StatusTest provides the following user-level classes:
* Generic - Base class for all stopping tests
* Combo - Allows combining of stopping tests with AND or OR
* NormF - Stopping test based on norm of F
* NormUpdate - Stopping test based on norm of update
* NormWRMS - Stopping test based on norm of weighted RMS of F
* MaxIters - Stopping test based on maximum iterations
* Stagnation - Stopping test based on algorithm stagnation
* FiniteValue - Stopping test based on detecting NaNs
"""
from sys import version_info
if version_info >= (2,6,0):
def swig_import_helper():
from os.path import dirname
import imp
fp = None
try:
fp, pathname, description = imp.find_module('_StatusTest', [dirname(__file__)])
except ImportError:
import _StatusTest
return _StatusTest
if fp is not None:
try:
_mod = imp.load_module('_StatusTest', fp, pathname, description)
finally:
fp.close()
return _mod
_StatusTest = swig_import_helper()
del swig_import_helper
else:
import _StatusTest
del version_info
try:
_swig_property = property
except NameError:
pass # Python < 2.2 doesn't have 'property'.
def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
if (name == "thisown"): return self.this.own(value)
if (name == "this"):
if type(value).__name__ == 'SwigPyObject':
self.__dict__[name] = value
return
method = class_type.__swig_setmethods__.get(name,None)
if method: return method(self,value)
if (not static):
self.__dict__[name] = value
else:
raise AttributeError("You cannot add attributes to %s" % self)
def _swig_setattr(self,class_type,name,value):
return _swig_setattr_nondynamic(self,class_type,name,value,0)
def _swig_getattr(self,class_type,name):
if (name == "thisown"): return self.this.own()
method = class_type.__swig_getmethods__.get(name,None)
if method: return method(self)
raise AttributeError(name)
def _swig_repr(self):
try: strthis = "proxy of " + self.this.__repr__()
except: strthis = ""
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
try:
_object = object
_newclass = 1
except AttributeError:
class _object : pass
_newclass = 0
try:
import weakref
weakref_proxy = weakref.proxy
except:
weakref_proxy = lambda x: x
class SwigPyIterator(_object):
"""Proxy of C++ swig::SwigPyIterator class"""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, SwigPyIterator, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, SwigPyIterator, name)
def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined - class is abstract")
__repr__ = _swig_repr
__swig_destroy__ = _StatusTest.delete_SwigPyIterator
__del__ = lambda self : None;
def value(self):
"""value(self) -> PyObject"""
return _StatusTest.SwigPyIterator_value(self)
def incr(self, n = 1):
"""
incr(self, size_t n = 1) -> SwigPyIterator
incr(self) -> SwigPyIterator
"""
return _StatusTest.SwigPyIterator_incr(self, n)
def decr(self, n = 1):
"""
decr(self, size_t n = 1) -> SwigPyIterator
decr(self) -> SwigPyIterator
"""
return _StatusTest.SwigPyIterator_decr(self, n)
def distance(self, *args):
"""distance(self, SwigPyIterator x) -> ptrdiff_t"""
return _StatusTest.SwigPyIterator_distance(self, *args)
def equal(self, *args):
"""equal(self, SwigPyIterator x) -> bool"""
return _StatusTest.SwigPyIterator_equal(self, *args)
def copy(self):
"""copy(self) -> SwigPyIterator"""
return _StatusTest.SwigPyIterator_copy(self)
def next(self):
"""next(self) -> PyObject"""
return _StatusTest.SwigPyIterator_next(self)
def __next__(self):
"""__next__(self) -> PyObject"""
return _StatusTest.SwigPyIterator___next__(self)
def previous(self):
"""previous(self) -> PyObject"""
return _StatusTest.SwigPyIterator_previous(self)
def advance(self, *args):
"""advance(self, ptrdiff_t n) -> SwigPyIterator"""
return _StatusTest.SwigPyIterator_advance(self, *args)
def __eq__(self, *args):
"""__eq__(self, SwigPyIterator x) -> bool"""
return _StatusTest.SwigPyIterator___eq__(self, *args)
def __ne__(self, *args):
"""__ne__(self, SwigPyIterator x) -> bool"""
return _StatusTest.SwigPyIterator___ne__(self, *args)
def __iadd__(self, *args):
"""__iadd__(self, ptrdiff_t n) -> SwigPyIterator"""
return _StatusTest.SwigPyIterator___iadd__(self, *args)
def __isub__(self, *args):
"""__isub__(self, ptrdiff_t n) -> SwigPyIterator"""
return _StatusTest.SwigPyIterator___isub__(self, *args)
def __add__(self, *args):
"""__add__(self, ptrdiff_t n) -> SwigPyIterator"""
return _StatusTest.SwigPyIterator___add__(self, *args)
def __sub__(self, *args):
"""
__sub__(self, ptrdiff_t n) -> SwigPyIterator
__sub__(self, SwigPyIterator x) -> ptrdiff_t
"""
return _StatusTest.SwigPyIterator___sub__(self, *args)
def __iter__(self): return self
SwigPyIterator_swigregister = _StatusTest.SwigPyIterator_swigregister
SwigPyIterator_swigregister(SwigPyIterator)
import PyTrilinos.Teuchos
Unevaluated = _StatusTest.Unevaluated
Unconverged = _StatusTest.Unconverged
Converged = _StatusTest.Converged
Failed = _StatusTest.Failed
Complete = _StatusTest.Complete
Minimal = _StatusTest.Minimal
StatusTest_None = _StatusTest.StatusTest_None
class Generic(_object):
"""
Generic status test to check for convergence or failure of the
nonlinear solver.
C++ includes: NOX_StatusTest_Generic.H
"""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, Generic, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, Generic, name)
def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined - class is abstract")
__repr__ = _swig_repr
__swig_destroy__ = _StatusTest.delete_Generic
__del__ = lambda self : None;
def checkStatus(self, *args):
"""
checkStatus(self, Generic problem, CheckType checkType) -> StatusType
virtual
NOX::StatusTest::StatusType
NOX::StatusTest::Generic::checkStatus(const NOX::Solver::Generic
&problem, NOX::StatusTest::CheckType checkType)=0
Test the stopping criterion
The test can (and should, if possible) be skipped if checkType is
NOX::StatusType::None. If the test is skipped, then the status should
be set to NOX::StatusTest::Unevaluated.
"""
return _StatusTest.Generic_checkStatus(self, *args)
def getStatus(self, *args):
"""
getStatus(self) -> StatusType
virtual
NOX::StatusTest::StatusType NOX::StatusTest::Generic::getStatus()
const =0
Return the result of the most recent checkStatus call.
"""
return _StatusTest.Generic_getStatus(self, *args)
def __str__(self, *args):
"""__str__(self) -> string"""
return _StatusTest.Generic___str__(self, *args)
Generic_swigregister = _StatusTest.Generic_swigregister
Generic_swigregister(Generic)
def __lshift__(*args):
"""__lshift__(ostream os, StatusType type) -> ostream"""
return _StatusTest.__lshift__(*args)
class Combo(Generic):
"""
Arbitrary combination of status tests.
In the AND (see NOX::StatusTest::Combo::ComboType) combination, the
result is Unconverged (see NOX::StatusTest::StatusType) if any of the
tests is Unconverged. Otherwise, the result is equal to the result of
the first test in the list that is either Converged or Failed. It is
not recommended to mix Converged and Failed tests in an AND
combination.
In the OR combination, the result is Unconverged if all of the tests
are Unconverged. Otherwise, it is the result of the first test in the
list that is either Converged or Failed. Therefore, it will generally
make sense to put the Failed -type tests at the end of the OR list.
We call checkStatus on every convergence test, though some may be
called with the NOX::StatusTest::None option.
Tammy Kolda (SNL 8950) and Roger Pawlowski (SNL 1416)
C++ includes: NOX_StatusTest_Combo.H
"""
__swig_setmethods__ = {}
for _s in [Generic]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
__setattr__ = lambda self, name, value: _swig_setattr(self, Combo, name, value)
__swig_getmethods__ = {}
for _s in [Generic]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
__getattr__ = lambda self, name: _swig_getattr(self, Combo, name)
__repr__ = _swig_repr
AND = _StatusTest.Combo_AND
OR = _StatusTest.Combo_OR
def __init__(self, *args):
"""
__init__(self, ComboType t, NOX::Utils u = None) -> Combo
__init__(self, ComboType t, Teuchos::RCP<(NOX::StatusTest::Generic)> a,
NOX::Utils u = None) -> Combo
__init__(self, ComboType t, Teuchos::RCP<(NOX::StatusTest::Generic)> a,
Teuchos::RCP<(NOX::StatusTest::Generic)> b,
NOX::Utils u = None) -> Combo
NOX::StatusTest::Combo::Combo(ComboType t, const Teuchos::RCP< Generic
> &a, const Teuchos::RCP< Generic > &b, const NOX::Utils *u=NULL)
Constructor with two tests.
"""
this = _StatusTest.new_Combo(*args)
try: self.this.append(this)
except: self.this = this
def addStatusTest(self, *args):
"""
addStatusTest(self, Teuchos::RCP<(NOX::StatusTest::Generic)> a) -> Combo
NOX::StatusTest::Combo & NOX::StatusTest::Combo::addStatusTest(const
Teuchos::RCP< Generic > &a)
Add another test to this combination.
Calls isSafe() to determine if it is safe to add a to the combination.
"""
return _StatusTest.Combo_addStatusTest(self, *args)
__swig_destroy__ = _StatusTest.delete_Combo
__del__ = lambda self : None;
def checkStatus(self, *args):
"""
checkStatus(self, Generic problem, CheckType checkType) -> StatusType
NOX::StatusTest::StatusType NOX::StatusTest::Combo::checkStatus(const
NOX::Solver::Generic &problem, NOX::StatusTest::CheckType checkType)
Tests stopping criterion.
See addOp() and orOp() for details.
"""
return _StatusTest.Combo_checkStatus(self, *args)
def getStatus(self, *args):
"""
getStatus(self) -> StatusType
NOX::StatusTest::StatusType NOX::StatusTest::Combo::getStatus() const
Return the result of the most recent checkStatus call.
"""
return _StatusTest.Combo_getStatus(self, *args)
Combo_swigregister = _StatusTest.Combo_swigregister
Combo_swigregister(Combo)
class NormF(Generic):
"""
Various convergence tests based on the norm of the residual.
Use the constructor to define the test based on the type of scaling
(see ScaleType) and the type of Tolerance (see Tolerance).
If checkStatus is called with the type set to NOX::StatusTest::None,
then the status is set to NOX::StatusTest::Unevaluated and returned.
(Also normF is set to 0.0.)
If checkStatus is called on a problem where the solution group does
not have F evaluated (i.e., problem.getSolutionGroup().isF() is
false), then the status is set to NOX::StatusTest::Unconverged and
returned. (Also normF is set to -1.0.)
Finally, we return NOX::StatusTest::Converged if $\\alpha <
\\beta$, and NOX::StatusTest::Unconverged otherwise. Here
$\\alpha$ represents the norm of $F(x)$ and $\\beta$ represents
the tolerance, as described below.
Let $\\gamma$ denote an optional scale factor defined as
$\\gamma = \\frac{1}{n}$ if sType in the constructor is
NOX::NormF::Scaled, and
Then $\\alpha$ is defined as follows:
If nType in the constructor is Abstract::Vector::TWO, then \\[
\\alpha = \\sqrt{ \\gamma \\sum_{i=1}^n F_i^2 } \\]
If nType in the constructor is Abstract::Vector::ONE, then \\[
\\alpha = \\gamma \\sum_{i=1}^n | F_i | \\]
If nType in the constructor is Abstract::Vector::INF, then \\[
\\alpha = \\gamma \\max_{i} | F_i | \\]
We set $\\beta$ as follows, based on the value of tolerance in the
constructor.
If an initial guess is provided, we use a relative tolerance defined
by \\[ \\beta = \\alpha_0 * \\mbox{tolerance} \\] Here
$\\alpha_0$ is the $\\alpha$ (as defined above) associated with
the initial guess.
Otherwise, we use an absolute tolerance defined by \\[ \\beta =
\\mbox{tolerance} \\]
C++ includes: NOX_StatusTest_NormF.H
"""
__swig_setmethods__ = {}
for _s in [Generic]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
__setattr__ = lambda self, name, value: _swig_setattr(self, NormF, name, value)
__swig_getmethods__ = {}
for _s in [Generic]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
__getattr__ = lambda self, name: _swig_getattr(self, NormF, name)
__repr__ = _swig_repr
Unscaled = _StatusTest.NormF_Unscaled
Scaled = _StatusTest.NormF_Scaled
Relative = _StatusTest.NormF_Relative
Absolute = _StatusTest.NormF_Absolute
def __init__(self, *args):
"""
__init__(self, double tolerance, NOX::Abstract::Vector::NormType ntype,
ScaleType stype = Scaled, NOX::Utils u = None) -> NormF
__init__(self, double tolerance, ScaleType stype = Scaled, NOX::Utils u = None) -> NormF
__init__(self, Group initialGuess, double tolerance, NOX::Abstract::Vector::NormType ntype,
ScaleType stype = Scaled,
NOX::Utils u = None) -> NormF
__init__(self, Group initialGuess, double tolerance, ScaleType stype = Scaled,
NOX::Utils u = None) -> NormF
NOX::StatusTest::NormF::NormF(NOX::Abstract::Group &initialGuess,
double tolerance, ScaleType stype=Scaled, const NOX::Utils *u=NULL)
Constructor with initial guess (for relative norms).
This constructor defaults to the Relative ToleranceType and TWO
NormType.
"""
this = _StatusTest.new_NormF(*args)
try: self.this.append(this)
except: self.this = this
__swig_destroy__ = _StatusTest.delete_NormF
__del__ = lambda self : None;
def checkStatus(self, *args):
"""
checkStatus(self, Generic problem, CheckType checkType) -> StatusType
NOX::StatusTest::StatusType NOX::StatusTest::NormF::checkStatus(const
NOX::Solver::Generic &problem, NOX::StatusTest::CheckType checkType)
Test the stopping criterion
The test can (and should, if possible) be skipped if checkType is
NOX::StatusType::None. If the test is skipped, then the status should
be set to NOX::StatusTest::Unevaluated.
"""
return _StatusTest.NormF_checkStatus(self, *args)
def getStatus(self, *args):
"""
getStatus(self) -> StatusType
NOX::StatusTest::StatusType NOX::StatusTest::NormF::getStatus() const
Return the result of the most recent checkStatus call.
"""
return _StatusTest.NormF_getStatus(self, *args)
def reset(self, *args):
"""
reset(self, double tolerance)
reset(self, Group initialGuess, double tolerance)
void
NOX::StatusTest::NormF::reset(NOX::Abstract::Group &initialGuess,
double tolerance)
Resets the user specified relative tolerance.
"""
return _StatusTest.NormF_reset(self, *args)
def getNormF(self, *args):
"""
getNormF(self) -> double
double
NOX::StatusTest::NormF::getNormF() const
Returns the value of the F-norm computed in the last call to
checkStatus.
"""
return _StatusTest.NormF_getNormF(self, *args)
def getTrueTolerance(self, *args):
"""
getTrueTolerance(self) -> double
double NOX::StatusTest::NormF::getTrueTolerance() const
Returns the true tolerance.
"""
return _StatusTest.NormF_getTrueTolerance(self, *args)
def getSpecifiedTolerance(self, *args):
"""
getSpecifiedTolerance(self) -> double
double NOX::StatusTest::NormF::getSpecifiedTolerance() const
Returns the specified tolerance set in the constructor.
"""
return _StatusTest.NormF_getSpecifiedTolerance(self, *args)
def getInitialTolerance(self, *args):
"""
getInitialTolerance(self) -> double
double NOX::StatusTest::NormF::getInitialTolerance() const
Returns the initial tolerance.
"""
return _StatusTest.NormF_getInitialTolerance(self, *args)
NormF_swigregister = _StatusTest.NormF_swigregister
NormF_swigregister(NormF)
class NormUpdate(Generic):
"""
Various convergence tests based on the norm of the change in the
solution vector, $ x $, between outer iterations.
If checkStatusEfficiently is called with the type set to
NOX::StatusTest::None, then the status is set to
NOX::StatusTest::Unevaluated and returned. (Also normUpdate is set to
-1.0.)
If checkStatusEfficiently is called on the first iteration, then the
status is set to NOX::StatusTest::Unconverged and returned. (Also
normUpdate is set to -1.0.)
If checkStatusEfficiently is called on a problem where the solution
group does not have F evaluated (i.e.,
problem.getSolutionGroup().isF() is false), then the status is set to
NOX::StatusTest::Unconverged and returned. (Also normUpdate is set to
-1.0.)
Finally, we return NOX::StatusTest::Converged if $\\alpha <
\\beta$ and NOX::StatusTest::Uncoverged otherwise. Here $\\alpha$
represents the norm of $ \\Delta x $ and $\\beta$ represents the
tolerance. We define:
\\[ \\Delta x = x_k - x_{k-1} \\]
where $ x_k $ is the solution vector of the $ k $-th nonlinear
iterate.
Let $\\gamma$ denote an optional scale factor defined as
$\\gamma = \\frac{1}{n}$ if sType in the constructor is
NOX::NormF::Scaled, and
$\\gamma = 1$ if sType in the constructor is NOX::NormF::Unscaled.
Then $\\alpha$ is defined as follows:
If nType in the constructor is Abstract::Vector::TWO, then \\[
\\alpha = \\sqrt{ \\gamma \\sum_{i=1}^n \\Delta x_i^2 }
\\]
If nType in the constructor is Abstract::Vector::ONE, then \\[
\\alpha = \\gamma \\sum_{i=1}^n | \\Delta x_i | \\]
If nType in the constructor is Abstract::Vector::INF, then \\[
\\alpha = \\gamma \\max_{i} | \\Delta x_i | \\]
Finally, $\\beta$ is set to the tolerance in the constructor, i.e.,
\\[ \\beta = \\mbox{tolerance} \\]
C++ includes: NOX_StatusTest_NormUpdate.H
"""
__swig_setmethods__ = {}
for _s in [Generic]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
__setattr__ = lambda self, name, value: _swig_setattr(self, NormUpdate, name, value)
__swig_getmethods__ = {}
for _s in [Generic]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
__getattr__ = lambda self, name: _swig_getattr(self, NormUpdate, name)
__repr__ = _swig_repr
Unscaled = _StatusTest.NormUpdate_Unscaled
Scaled = _StatusTest.NormUpdate_Scaled
def __init__(self, *args):
"""
__init__(self, double tolerance, NOX::Abstract::Vector::NormType ntype,
ScaleType stype = Scaled) -> NormUpdate
__init__(self, double tolerance, ScaleType stype = Scaled) -> NormUpdate
NormUpdate::NormUpdate(double tolerance, ScaleType stype=Scaled)
Constructor for absolute norm.
This constructor defaults to the Absolute ToleranceType and TWO
NormType.
"""
this = _StatusTest.new_NormUpdate(*args)
try: self.this.append(this)
except: self.this = this
__swig_destroy__ = _StatusTest.delete_NormUpdate
__del__ = lambda self : None;
def checkStatus(self, *args):
"""
checkStatus(self, Generic problem, CheckType checkType) -> StatusType
StatusType NormUpdate::checkStatus(const NOX::Solver::Generic
&problem, NOX::StatusTest::CheckType checkType)
Test the stopping criterion
The test can (and should, if possible) be skipped if checkType is
NOX::StatusType::None. If the test is skipped, then the status should
be set to NOX::StatusTest::Unevaluated.
"""
return _StatusTest.NormUpdate_checkStatus(self, *args)
def getStatus(self, *args):
"""
getStatus(self) -> StatusType
StatusType NormUpdate::getStatus() const
Return the result of the most recent checkStatus call.
"""
return _StatusTest.NormUpdate_getStatus(self, *args)
def getNormUpdate(self, *args):
"""
getNormUpdate(self) -> double
double NOX::StatusTest::NormUpdate::getNormUpdate() const
Returns the value of the Update-norm computed in the last call to
checkStatus.
"""
return _StatusTest.NormUpdate_getNormUpdate(self, *args)
def getTolerance(self, *args):
"""
getTolerance(self) -> double
double NOX::StatusTest::NormUpdate::getTolerance() const
Returns the true tolerance.
"""
return _StatusTest.NormUpdate_getTolerance(self, *args)
NormUpdate_swigregister = _StatusTest.NormUpdate_swigregister
NormUpdate_swigregister(NormUpdate)
class NormWRMS(Generic):
"""
Convergence test based on the weighted root mean square norm fo the
solution update between iterations.
` If the number of iterations is zero, then the status is set to
NOX::StatusTest::Unconverged and returned. (Also, value is set to
1.0e+12.)
Otherwise, returns NOX::StatusTest::Converged if the three criteria
listed below are satisfied. Note that use of Criteria #2 and #3 depend
on the options set in the solver.
Weigthed root mean square norm is less than a specified tolerance:
\\[ ||\\delta x^k||_{wrms} < \\mbox{tolerance} \\]
where
\\[ ||\\delta x^k||_{wrms} \\equiv C \\sqrt{ \\frac{1}{N}
\\sum_{i=1}^N \\left( \\frac {(x^k_i-x^{k-1}_i)}{RTOL
|x^{k-1}_i| + ATOL_i} \\right) ^2 } \\]
Here:
$x_i^k$ denotes component $i$ of nonlinear iterate $k$.
$N$ denotes the number of unknowns
$RTOL$ denotes the relative error tolerance, specified via rtol in the
constructor
$ATOL$ denotes the absolution error tolerance, specified via atol in
the constructor. This can be a vector or a scalar.
$C$ denotes a weight, specified via the parameter BDFMultiplier in the
constructor.
If a line search based solver is used, the line search step size, $
\\lambda $, must be greater than a specified step size value, $
\\alpha $:
\\[ \\lambda > \\alpha \\]
The motivation for this test is to avoid detecting stagnation when in
fact the true problem is that the step size is just small.
The value of $\\alpha$ is set in the constructor via the argument
alpha. Setting $\\alpha$ to zero effectively eliminates this part of
the test.
The achieved linear solver tolerance, $ \\eta^k $ for nonlinear
iteration $ k $, must be less than a specified tolerance value, $
\\beta $; i.e.,
\\[ \\eta^k < \\beta \\]
The motivation for this test is to avoid detecting stagnation when in
fact the true problem is that the linear solve tolerance was not
accurate enough.
The value of $\\beta$ is set in the constructor via the argument
beta. Setting $\\beta$ to 1.0 effectively eliminates this part of
the test.
This criteria will only be used if the "Achieved Tolerance"
parameter (the value of $ \\eta^k $) is set by the linear solver in
the "Newton"/"Linear Solver"/"Output" sublist. The checkStatus()
method will search for this parameter.
References:
K. E. Brennam, S. L. Cambell, L. R. Petzold, Numerical Solution of
Initial-Value Problems in Differential-Algebraic Equations, Classics
in Applied Mathematics 14, SIAM 1996.
G. D. Byrne and A. C. Hindmarch, PVODE, an ODE Solver for Parallel
Computers, Technical Report UCRL-JC-132361, Rev. 1, Center for Applied
Scientific Computing (CASC), Lawrence Livermore National Lab, May
1999.
C++ includes: NOX_StatusTest_NormWRMS.H
"""
__swig_setmethods__ = {}
for _s in [Generic]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
__setattr__ = lambda self, name, value: _swig_setattr(self, NormWRMS, name, value)
__swig_getmethods__ = {}
for _s in [Generic]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
__getattr__ = lambda self, name: _swig_getattr(self, NormWRMS, name)
__repr__ = _swig_repr
def __init__(self, *args):
"""
__init__(self, double rtol, double atol, double BDFMultiplier = 1.0,
double tolerance = 1.0, double alpha = 1.0,
double beta = 0.5) -> NormWRMS
__init__(self, double rtol, Teuchos::RCP<(q(const).NOX::Abstract::Vector)> atol,
double BDFMultiplier = 1.0, double tolerance = 1.0,
double alpha = 1.0, double beta = 0.5) -> NormWRMS
NormWRMS::NormWRMS(double rtol, const Teuchos::RCP< const
NOX::Abstract::Vector > &atol, double BDFMultiplier=1.0, double
tolerance=1.0, double alpha=1.0, double beta=0.5)
Constructor where ATOL is a vector.
"""
this = _StatusTest.new_NormWRMS(*args)
try: self.this.append(this)
except: self.this = this
__swig_destroy__ = _StatusTest.delete_NormWRMS
__del__ = lambda self : None;
def checkStatus(self, *args):
"""
checkStatus(self, Generic problem, CheckType checkType) -> StatusType
StatusType NormWRMS::checkStatus(const NOX::Solver::Generic &problem,
NOX::StatusTest::CheckType checkType)
Test the stopping criterion
The test can (and should, if possible) be skipped if checkType is
NOX::StatusType::None. If the test is skipped, then the status should
be set to NOX::StatusTest::Unevaluated.
"""
return _StatusTest.NormWRMS_checkStatus(self, *args)
def getStatus(self, *args):
"""
getStatus(self) -> StatusType
StatusType NormWRMS::getStatus() const
Return the result of the most recent checkStatus call.
"""
return _StatusTest.NormWRMS_getStatus(self, *args)
def getNormWRMS(self, *args):
"""
getNormWRMS(self) -> double
double
NormWRMS::getNormWRMS() const
Returns the value of WRMS norm.
"""
return _StatusTest.NormWRMS_getNormWRMS(self, *args)
def getTolerance(self, *args):
"""
getTolerance(self) -> double
double NormWRMS::getTolerance() const
Returns the requested tolerance set in the constructor.
"""
return _StatusTest.NormWRMS_getTolerance(self, *args)
def getRTOL(self, *args):
"""
getRTOL(self) -> double
double
NormWRMS::getRTOL() const
Returns the realative tolerance set in the constructor.
"""
return _StatusTest.NormWRMS_getRTOL(self, *args)
def getATOL(self, *args):
"""
getATOL(self) -> double
double
NormWRMS::getATOL() const
Returns the absolute tolerance set in the constructor. If ATOL is a
vector, this will return a value of -1.0.
"""
return _StatusTest.NormWRMS_getATOL(self, *args)
def getBDFMultiplier(self, *args):
"""
getBDFMultiplier(self) -> double
double NormWRMS::getBDFMultiplier() const
Returns the value of the BDFMultiplier set in the constructor.
"""
return _StatusTest.NormWRMS_getBDFMultiplier(self, *args)
def getAlpha(self, *args):
"""
getAlpha(self) -> double
double
NormWRMS::getAlpha() const
Returns the value of 'alpha' set in the constructor.
"""
return _StatusTest.NormWRMS_getAlpha(self, *args)
def getBeta(self, *args):
"""
getBeta(self) -> double
double
NormWRMS::getBeta() const
Returns the value of 'beta' set in the constructor.
"""
return _StatusTest.NormWRMS_getBeta(self, *args)
NormWRMS_swigregister = _StatusTest.NormWRMS_swigregister
NormWRMS_swigregister(NormWRMS)
class MaxIters(Generic):
"""
Failure test based on the maximum number of nonlinear solver
iterations.
Let $k$ denote the current number of iterations (accessed via
NOX::Solver::getNumIterations) and $k_{\\max}$ denote the tolerance
set in the constructor of this status test. This test returns
NOX::StatusTest::Failed if $ k \\geq k_{\\rm max}. $ Otherwise, it
returns NOX::StatusTest::Unconverged.
If checkStatus is called with the type set to NOX::StatusTest::None,
it then the status is set to to NOX::Status::Unevaluated and returned.
(Also niters is set to -1.)
C++ includes: NOX_StatusTest_MaxIters.H
"""
__swig_setmethods__ = {}
for _s in [Generic]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
__setattr__ = lambda self, name, value: _swig_setattr(self, MaxIters, name, value)
__swig_getmethods__ = {}
for _s in [Generic]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
__getattr__ = lambda self, name: _swig_getattr(self, MaxIters, name)
__repr__ = _swig_repr
def __init__(self, *args):
"""
__init__(self, int maxIterations, NOX::Utils u = None) -> MaxIters
NOX::StatusTest::MaxIters::MaxIters(int maxIterations, const
NOX::Utils *u=NULL)
Constructor. Specify the maximum number of nonlinear solver
iterations, $k_{\\max}$ ands optinally an error stream for printing
errors.
"""
this = _StatusTest.new_MaxIters(*args)
try: self.this.append(this)
except: self.this = this
__swig_destroy__ = _StatusTest.delete_MaxIters
__del__ = lambda self : None;
def checkStatus(self, *args):
"""
checkStatus(self, Generic problem, CheckType checkType) -> StatusType
NOX::StatusTest::StatusType
NOX::StatusTest::MaxIters::checkStatus(const NOX::Solver::Generic
&problem, NOX::StatusTest::CheckType checkType)
Test the stopping criterion
The test can (and should, if possible) be skipped if checkType is
NOX::StatusType::None. If the test is skipped, then the status should
be set to NOX::StatusTest::Unevaluated.
"""
return _StatusTest.MaxIters_checkStatus(self, *args)
def getStatus(self, *args):
"""
getStatus(self) -> StatusType
NOX::StatusTest::StatusType NOX::StatusTest::MaxIters::getStatus()
const
Return the result of the most recent checkStatus call.
"""
return _StatusTest.MaxIters_getStatus(self, *args)
def getMaxIters(self, *args):
"""
getMaxIters(self) -> int
int
NOX::StatusTest::MaxIters::getMaxIters() const
Returns the Maximum number of iterations set in the constructor.
"""
return _StatusTest.MaxIters_getMaxIters(self, *args)
def getNumIters(self, *args):
"""
getNumIters(self) -> int
int
NOX::StatusTest::MaxIters::getNumIters() const
Returns the current number of iterations taken by the solver.
Returns -1 if the status of this test is NOX::StatusTest::Unevaluated.
"""
return _StatusTest.MaxIters_getNumIters(self, *args)
MaxIters_swigregister = _StatusTest.MaxIters_swigregister
MaxIters_swigregister(MaxIters)
class Stagnation(Generic):
"""
Failure test based on the convergence rate between nonlinear
iterations.
This status test returns NOX::StatusTest::Failed if we fail to reduce
the norm of $F$ by a specified tolerance for n consecutive iterations.
In other words, if
\\[ \\frac{\\| F_k \\|}{\\| F_{k-1} \\|} \\geq {\\rm
tolerance}\\]
for n consecutive iterations, the status is set to
NOX::StatusTest::Failed and returned. Otherwise, the status is set to
NOX::StatusTest::Uncoverged and returned. Both n and the tolerance are
specified in the constructor, by n and tol, respectively.
Based on experience the following values are recommended:
For Newton solves: n = 50, tolerance = 1.0
For Newton solves with a line search: n = 15, tolerance = 0.99
C++ includes: NOX_StatusTest_Stagnation.H
"""
__swig_setmethods__ = {}
for _s in [Generic]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
__setattr__ = lambda self, name, value: _swig_setattr(self, Stagnation, name, value)
__swig_getmethods__ = {}
for _s in [Generic]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
__getattr__ = lambda self, name: _swig_getattr(self, Stagnation, name)
__repr__ = _swig_repr
def __init__(self, *args):
"""
__init__(self, int n = 50, double tol = 1.0) -> Stagnation
NOX::StatusTest::Stagnation::Stagnation(int n=50, double tol=1.0)
Constructor.
Parameters:
-----------
n: - Number of consecutive nonlinear iterations
tol: - Tolerance for stagnation test
"""
this = _StatusTest.new_Stagnation(*args)
try: self.this.append(this)
except: self.this = this
__swig_destroy__ = _StatusTest.delete_Stagnation
__del__ = lambda self : None;
def checkStatus(self, *args):
"""
checkStatus(self, Generic problem, CheckType checkType) -> StatusType
NOX::StatusTest::StatusType
NOX::StatusTest::Stagnation::checkStatus(const NOX::Solver::Generic
&problem, NOX::StatusTest::CheckType checkType)
Tests the stopping criterion.
The nature of this test is such that it must be executed at every
nonlinear iteration, so we don't use the checkType argument.
"""
return _StatusTest.Stagnation_checkStatus(self, *args)
def getStatus(self, *args):
"""
getStatus(self) -> StatusType
NOX::StatusTest::StatusType NOX::StatusTest::Stagnation::getStatus()
const
Return the result of the most recent checkStatus call.
"""
return _StatusTest.Stagnation_getStatus(self, *args)
def getMaxNumSteps(self, *args):
"""
getMaxNumSteps(self) -> int
int NOX::StatusTest::Stagnation::getMaxNumSteps() const
Returns the used specified number of steps that can consecutively fail
the tolerance test before the test returns a failed status.
"""
return _StatusTest.Stagnation_getMaxNumSteps(self, *args)
def getCurrentNumSteps(self, *args):
"""
getCurrentNumSteps(self) -> int
int NOX::StatusTest::Stagnation::getCurrentNumSteps() const
Returns the current number of steps that have consecutively failed the
tolerance test.
"""
return _StatusTest.Stagnation_getCurrentNumSteps(self, *args)
def getTolerance(self, *args):
"""
getTolerance(self) -> double
double NOX::StatusTest::Stagnation::getTolerance() const
Returns the user specified tolerance.
"""
return _StatusTest.Stagnation_getTolerance(self, *args)
def getConvRate(self, *args):
"""
getConvRate(self) -> double
double NOX::StatusTest::Stagnation::getConvRate() const
Returns the current convergence rate.
"""
return _StatusTest.Stagnation_getConvRate(self, *args)
Stagnation_swigregister = _StatusTest.Stagnation_swigregister
Stagnation_swigregister(Stagnation)
class FiniteValue(Generic):
"""
Failure test based on whether the norm of a vector has a finite value.
This test returns NOX::StatusTest::Failed if the norm of a vector is
calssified as a NaN or Inf. Otherwise, it returns
NOX::StatusTest::Unconverged. The user can specify whether to use the
F vector or the solution vector from the current solution group for
the check. NOX does not have access to vector entries so the number
used in the NaN/Inf check is based on the norm of a vector.
If checkStatus is called with the type set to NOX::StatusTest::None,
then the status is set to NOX::Status::Unevaluated and returned.
C++ includes: NOX_StatusTest_FiniteValue.H
"""
__swig_setmethods__ = {}
for _s in [Generic]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
__setattr__ = lambda self, name, value: _swig_setattr(self, FiniteValue, name, value)
__swig_getmethods__ = {}
for _s in [Generic]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
__getattr__ = lambda self, name: _swig_getattr(self, FiniteValue, name)
__repr__ = _swig_repr
FVector = _StatusTest.FiniteValue_FVector
SolutionVector = _StatusTest.FiniteValue_SolutionVector
def __init__(self, *args):
"""
__init__(self, VectorType v = FVector, NOX::Abstract::Vector::NormType n = NOX::Abstract::Vector::TwoNorm) -> FiniteValue
NOX::StatusTest::FiniteValue::FiniteValue(VectorType v=FVector,
NOX::Abstract::Vector::NormType n=NOX::Abstract::Vector::TwoNorm)
Constructor. Specify which vector to check and with what norm to use.
"""
this = _StatusTest.new_FiniteValue(*args)
try: self.this.append(this)
except: self.this = this
__swig_destroy__ = _StatusTest.delete_FiniteValue
__del__ = lambda self : None;
def checkStatus(self, *args):
"""
checkStatus(self, Generic problem, CheckType checkType) -> StatusType
NOX::StatusTest::StatusType
NOX::StatusTest::FiniteValue::checkStatus(const NOX::Solver::Generic
&problem, NOX::StatusTest::CheckType checkType)
Test the stopping criterion
The test can (and should, if possible) be skipped if checkType is
NOX::StatusType::None. If the test is skipped, then the status should
be set to NOX::StatusTest::Unevaluated.
"""
return _StatusTest.FiniteValue_checkStatus(self, *args)
def getStatus(self, *args):
"""
getStatus(self) -> StatusType
NOX::StatusTest::StatusType NOX::StatusTest::FiniteValue::getStatus()
const
Return the result of the most recent checkStatus call.
"""
return _StatusTest.FiniteValue_getStatus(self, *args)
def finiteNumberTest(self, *args):
"""
finiteNumberTest(self, double x) -> int
int NOX::StatusTest::FiniteValue::finiteNumberTest(double x) const
The finite number test algorithm.
Autoconf will test to see if the compiler implements the isnan() and
isinf() functions in the cmath or math.h headers. If so, we will use
these. If not, we supply a default implementation. The default
implementation is only guaranteed to work if the code is IEEE 748/754
compliant. The checks for isnan and isinf are separate because
compilers like the old sgi platforms support one but not the other.
See bug 2019 for more details.
This method is public so that other objects (solvers, line searches,
and directions) can use this test on their own values.
Return Values: 0 = Finite Number
-1 = NaN
-2 = Inf
"""
return _StatusTest.FiniteValue_finiteNumberTest(self, *args)
FiniteValue_swigregister = _StatusTest.FiniteValue_swigregister
FiniteValue_swigregister(FiniteValue)
# This file is compatible with both classic and new-style classes.
|