Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 878f401f authored by hhakim's avatar hhakim
Browse files

Verify pyfaust.StoppingCriterion construc. arguments consistency.

To make clear that the user has to choose between stopping criterion defined by number of iterations or defined by error treshold.
parent 4d8dfac1
No related branches found
No related tags found
No related merge requests found
...@@ -1156,6 +1156,14 @@ class StoppingCriterion(object): ...@@ -1156,6 +1156,14 @@ class StoppingCriterion(object):
self.num_its = num_its self.num_its = num_its
self.max_num_its = max_num_its self.max_num_its = max_num_its
#TODO: check_validity() like C++ code does #TODO: check_validity() like C++ code does
if(is_criterion_error and num_its != 500):
raise ValueError("It's forbidden to set a number of iterations as stopping"
" criterion when is_criterion_error == True.")
elif(not is_criterion_error and (max_num_its != 1000 or error_treshold
!= 0.3)):
raise ValueError("When is_criterion_error == True it's forbidden to use"
" other arguments than num_its argument to define "
"the stopping criterion.")
class ConstraintName: class ConstraintName:
SP = 0 # Int Constraint SP = 0 # Int Constraint
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment