question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

current["nadir"] and current["ideal"] are NoneType

See original GitHub issue

Hello,

When I use the default termination, I got below error:

 File "/home/dev/miniconda3/envs/dev/lib/python3.10/site-packages/pymoo/core/algorithm.py", line 309, in _post_advance 
                                      self.termination.update(self)                                                                                                                           
File "/home/dev/miniconda3/envs/dev/lib/python3.10/site-packages/pymoo/core/termination.py", line 28, in update
                                             progress = self._update(algorithm)                                                                                                                      
File "/home/dev/miniconda3/envs/dev/lib/python3.10/site-packages/pymoo/termination/default.py", line 24, in _update 
                                        p = [criterion.update(algorithm) for criterion in self.criteria]                                                                                        
File "/home/dev/miniconda3/envs/dev/lib/python3.10/site-packages/pymoo/termination/default.py", line 24, in <listcomp>
                                      p = [criterion.update(algorithm) for criterion in self.criteria]                                                                                        
File "/home/dev/miniconda3/envs/dev/lib/python3.10/site-packages/pymoo/core/termination.py", line 28, in update 
                                            progress = self._update(algorithm)                                                                                                                      
File "/home/dev/miniconda3/envs/dev/lib/python3.10/site-packages/pymoo/termination/robust.py", line 32, in _update
                                          perc = self.termination.update(algorithm)                                                                                                               
File "/home/dev/miniconda3/envs/dev/lib/python3.10/site-packages/pymoo/core/termination.py", line 28, in update 
                                            progress = self._update(algorithm)                                                                                                                      
File "/home/dev/miniconda3/envs/dev/lib/python3.10/site-packages/pymoo/termination/delta.py", line 42, in _update 
                                          delta = self._delta(prev, current)                                                                                                                      
File "/home/dev/miniconda3/envs/dev/lib/python3.10/site-packages/pymoo/termination/ftol.py", line 71, in _delta 
                                            norm = current["nadir"] - current["ideal"]                                                                                                            
TypeError: unsupported operand type(s) for -: 'NoneType' and 'NoneType'

How to fix the None issue and why did it come out? Thanks!

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:3
  • Comments:6

github_iconTop GitHub Comments

2reactions
humanacommented, Oct 31, 2022

Yeah, I have the same problem. Don’t think this code is tested very well. What I basically did was add some checks to make sure those values exist. I don’t know if this is entirely correct, as I’ve seen many times that ftol is reached, but it just doesn’t converge. I’m guessing it’s because of these conditions.

def _delta(self, prev, current):

        if not (prev["feas"] and current["feas"]):
            return np.inf

        if prev["nadir"] is None or prev["ideal"] is None:
            return np.inf

        if current["nadir"] is None or current["ideal"] is None:
            return np.inf
1reaction
blankjulcommented, Dec 12, 2022

Sorry for the delay. That was indeed a bug which should be fixed now!

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found