counter += 1
        #clear_output(wait=True)
        optimizerId = str(result['optimizer'].__name__)
        problemId = str(result['problem'].__name__)
        k = result['k']

        if ('result' in result):
            p = result['result']

            logger.info("Finished evaluation " + str(counter) + "/" +
                        str(total) + " ( " + str(100 * counter / total) + "%)")
            logger.info(optimizerId + " on " + problemId + " k=" + str(k) +
                        "(0-" + str(config.K - 1) + ")")
            #logger.debug(p.getResultAsDictionary())

            db.store(optimizerId, problemId, str(k), p.getResultAsDictionary())
            if lastSave + timeUntilNextSave < (time.time()):  #in seconds
                lastSave = time.time()
                db.saveToJson(config.DATABASE_PATH + "tmp")
                os.replace(config.DATABASE_PATH + "tmp",
                           config.DATABASE_PATH)  #to prevent corrupt files.
                timeUntilNextSave = max(
                    60, (time.time() - lastSave) * 100
                )  #the time spend on saving should grow if saving takes more time, but should be at least 60 seconds.
                lastSave = time.time()
        else:
            logger.info("Failed evaluation " + str(counter) + "/" +
                        str(total) + " ( " + str(100 * counter / total) + "%)")
            logger.info(optimizerId + " on " + problemId + " k=" + str(k + 1) +
                        "/" + str(config.K))
            exception = result['exception']