An UnboundLocalError is thrown irregularly from examples2/vessel.py:
$ python vessel.py
Generation 0 has ChiSquare: 2.2437033826534276e+16
Traceback (most recent call last):
File "/Users/mmckerns/dev/git/uqfoundation/mystic/examples2/vessel.py", line 51, in <module>
result = diffev2(objective, x0=bounds, bounds=bounds, constraints=cf, penalty=pf, npop=40, gtol=50, disp=False, full_output=True, itermon=mon)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mmckerns/lib/python3.12/site-packages/mystic/differential_evolution.py", line 725, in diffev2
return diffev(cost,x0,npop,args=args,bounds=bounds,ftol=ftol,gtol=gtol,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mmckerns/lib/python3.12/site-packages/mystic/differential_evolution.py", line 835, in diffev
solver.Solve(cost, termination=termination, strategy=strategy, \
File "/Users/mmckerns/lib/python3.12/site-packages/mystic/differential_evolution.py", line 661, in Solve
super(DifferentialEvolutionSolver2, self).Solve(cost, termination,\
File "/Users/mmckerns/lib/python3.12/site-packages/mystic/abstract_solver.py", line 1180, in Solve
self._Solve(cost, ExtraArgs, **settings)
File "/Users/mmckerns/lib/python3.12/site-packages/mystic/abstract_solver.py", line 1123, in _Solve
stop = self.Step(**settings) #XXX: remove need to pass settings?
^^^^^^^^^^^^^^^^^^^^^
File "/Users/mmckerns/lib/python3.12/site-packages/mystic/abstract_solver.py", line 1096, in Step
self._Step(**kwds) #FIXME: not all kwds are given in __doc__
^^^^^^^^^^^^^^^^^^
File "/Users/mmckerns/lib/python3.12/site-packages/mystic/differential_evolution.py", line 552, in _Step
self.trialSolution[candidate][:] = constraints(self.trialSolution[candidate])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mmckerns/lib/python3.12/site-packages/mystic/constraints.py", line 576, in <lambda>
cf = lambda x: _constraint(x)
^^^^^^^^^^^^^^
File "/Users/mmckerns/lib/python3.12/site-packages/mystic/constraints.py", line 556, in _constraint
if all(xi == x[-1] for xi in x[1:]) and e is None:
^
UnboundLocalError: cannot access local variable 'e' where it is not associated with a value
An UnboundLocalError is thrown irregularly from examples2/vessel.py: