schrum2 / EvoCraft-SCOPE

0 stars 0 forks source link

Batch files for loading previously saved results #62

Open schrum2 opened 2 years ago

schrum2 commented 2 years ago

Once #61 works, you can make a batch file ResumeFitnessEvolution.bat where you specify a BASE_DIR, EXPERIMENT_PREFIX, and LOAD_SAVED_SEED. This will load the parameter settings from the previously saved parameters.txt file and also load the previously saved population, and then keep evolving from there.

Note: I would like for this to not require LOAD_GENERATION to be specified. There are two possible ways around this. One is to look at the saved directories and parse out whichever generation number if highest from those available, and use that one. The other option is for running simulations to periodically save the most recently saved generation. Perhaps we could have a text file next to parameters.txt called last_save.txt that gets overwritten whenever the population is saved, and is used to know which population to load.

schrum2 commented 2 years ago

What is the status of this?

alejmedinajr commented 2 years ago

When the parameters are first saved, LOAD_SAVED_POPULATION has to be false in order for the generation files to be saved. The problem with this is that we decided to check if a previously saved file already exists with the same directory names. If it does, then we are throwing an exception when any of the previously saved command line parameters are not matching with the newly sent command line parameters. Now this causes the issue of not being able to set LOAD_SAVED_POPULATION to true, along with the other loading command line parameters.

Example of sending a different command line parameter when the directory names match an already existing file: errorWithPythonSavingLoading

schrum2 commented 2 years ago

I guess the solution is to simply have a special case for LOAD_SAVED_POPULATION. Don't check if that particular parameter matches the previous value.

alejmedinajr commented 2 years ago

Latest commit saves and loads command line parameters. The LOAD_GENERATION value is obtained by parsing the files in the specified directory and assigning it to the largest numerical value. After loading a previously saved generation, the generation proceeds to run then crashes. Here is error message:

loadsave

schrum2 commented 2 years ago

I'm going to have to look at this more closely with you. We'll check it out on Monday

alejmedinajr commented 2 years ago

When loading the previously saved generation, the generation was loaded, but no further evolution happened, and the program crashed. The error trace is the same as in the image above. The code producing this error has comments explaining the problem, and it will only occur when attempting to load a previously saved file for fitness based evolution.

schrum2 commented 2 years ago

We should certainly be able to load a population and then continue evolving, but the code complains about the species not being properly defined. I suppose this means that we either weren't properly saving the species information before or we are not properly loading it, but we're following the examples in the NEAT Python repo so it's unclear what is missing. Still, the current behavior is satisfactory for now. It allows us to load and evaluate a previously saved population. We just can't evolve it further.