def start():
    config = BeamNGConfig()
    problem = BeamNGProblem(config, SmartArchive(config.ARCHIVE_THRESHOLD))
    nsga2.main(problem)
    print('done')

    plt.ioff()
    plt.show()
Exemplo n.º 2
0
 def __init__(self, service: AIExchangeService) -> None:
     from core.folders import folders
     from self_driving.beamng_config import BeamNGConfig
     from self_driving.nvidia_prediction import NvidiaPrediction
     from keras.models import load_model
     self._service = service
     config = BeamNGConfig()
     model_file = str(
         folders.trained_models_colab.joinpath(config.keras_model_file))
     model = load_model(model_file)
     self._prediction = NvidiaPrediction(model, config)
Exemplo n.º 3
0
        try:
            if self.config.beamng_close_at_iteration:
                self._close()
            else:
                if self.brewer:
                    self.brewer.beamng.stop_scenario()
        except Exception as ex:
            log.debug('end_iteration() failed:')
            traceback.print_exception(type(ex), ex, ex.__traceback__)

    def _close(self):
        if self.brewer:
            try:
                self.brewer.beamng.close()
            except Exception as ex:
                log.debug('beamng.close() failed:')
                traceback.print_exception(type(ex), ex, ex.__traceback__)
            self.brewer = None


if __name__ == '__main__':
    config = BeamNGConfig()
    inst = BeamNGNvidiaOob(config)
    while True:
        seed_storage = SeedStorage('basic5')
        for i in range(1, 11):
            member = BeamNGMember.from_dict(seed_storage.load_json_by_index(i))
            member.clear_evaluation()
            inst.evaluate([member])
            log.info(member)
import json

from core.archive_impl import SmartArchive
from self_driving.beamng_config import BeamNGConfig
from self_driving.beamng_problem import BeamNGProblem
from core.config import Config
from core.folder_storage import SeedStorage

config_silliest = BeamNGConfig()
config_silliest.keras_model_file = 'self-driving-car-039.h5'
config_silliest.beamng_close_at_iteration = True

config_silly = BeamNGConfig()
config_silly.keras_model_file = 'self-driving-car-065.h5'
config_silly.beamng_close_at_iteration = True

config_smart = BeamNGConfig()
config_silly.keras_model_file = 'self-driving-car-4600.h5'
config_smart.beamng_close_at_iteration = True

problem_silliest = BeamNGProblem(config_silliest,
                                 SmartArchive(config_silly.ARCHIVE_THRESHOLD))
problem_silly = BeamNGProblem(config_silly,
                              SmartArchive(config_silly.ARCHIVE_THRESHOLD))
problem_smart = BeamNGProblem(config_smart,
                              SmartArchive(config_smart.ARCHIVE_THRESHOLD))

# problem = BeamNGProblem(config, SmartArchive(config.ARCHIVE_THRESHOLD))

if __name__ == '__main__':
    good_members_found = 0