Skip to content

GA‐QAS: folder result

Vu Tuan Hai edited this page May 20, 2024 · 1 revision

The result of the GA-QAS algorithm will be saved automatically per generation with the below structure:

folder_name
│   best_circuit_0.qpy
│   best_circuit_1.qpy
│   ...
|   best_circuit_n.qpy
|   circuit_0_1.qpy
|   circuit_0_2.qpy
|   ...
|   circuit_n_m.qpy
|   funcs.json
|   metadata.json
  • best_circuit_i.qpyis the best circuit at generation $i^{th}$.
  • circuit_i_j.qpy is the $j^{th}$ circuit at generation $i^{th}$.
  • funcs.json save:
{
    "fitness_func",
    "crossover_func",
    "mutate_func",
    "selection_func",
    "threshold_func"
}
  • metadata.json save:
{
    "num_qubits",
    "depth",
    "num_circuit",
    "num_generation",
    "current_generation",
    "fitnessss": [[...]],
    "best_fitnesss": [...],
    "prob_mutate"
}

Where qpy files can be loaded by the qoop.utilities.load_circuit() method, metadata.json saves all important information. Others file serve for loading EEnvironment object.

GA-QAS will consume much time in case of a high number of qubits/generation/circuit because it needs to run fitness function $(n_{circuit}\times n_{generation}$; therefore, GA-QAS automatically saves results at each generation. If we interrupt the process in the middle, we can load this folder and continue to run GA-QAS.

env = EEnvironment.load("folder name")
env.evol()

In case you want to run in more generations, you must set a new number of generations, then call evol() method:

env.set_num_generation(100)
env.evol()