main_comparison.py
def run_the_missing_ones(
    out_path_raw: str,
    Date,
    n_shooting: tuple,
    dynamics_types: list,
    ode_solver: list,
    nstep: int,
    n_threads: int,
    model_str: str,
    extra_obj: bool,
    pool_nb: int,
):
    """
    This function is used to run the process that were not run during the previous pool of processes

    Parameters
    ----------
    out_path_raw : str
        The path to store the raw results
    Date : str
        The date of the run
    n_shooting : tuple
        The number of shooting points for each phase
    dynamics_types : list
        The list of dynamics types to be run such as MillerDynamics.EXPLICIT, MillerDynamics.IMPLICIT, MillerDynamics.ROOT_EXPLICIT
    ode_solver : list
        The list of OdeSolver to be run such as OdeSolver.RK4, OdeSolver.RK2
    nstep : int
        The number of intermediate steps between two shooting points
    n_threads : int
        The number of threads to be used
    model_str : str
        The path to the bioMod model
    extra_obj : bool
        Whether to run with the extra objective or not (minimizing extra controls for implicit formulations)
    """
    # Run the one that did not run
    files = os.listdir(out_path_raw)
    files.sort()

    new_calls = {dynamics_types[0].value: [], dynamics_types[1].value: []}
    for i, file in enumerate(files):
        if file.endswith(".pckl"):
            p = Path(f"{out_path_raw}/{file}")
            file_path = open(p, "rb")
            data = pickle.load(file_path)
            if (
                data["dynamics_type"].value == dynamics_types[0].value
                or data["dynamics_type"].value == dynamics_types[1].value
            ):
                new_calls[data["dynamics_type"].value].append(data["irand"])

    list_100 = [i for i in range(0, 100)]

    dif_list = list(set(list_100) - set(new_calls[dynamics_types[0].value]))
    if dif_list:
        calls = generate_calls(
            dif_list,
            Date,
            n_shooting,
            [dynamics_types[1]],
            [ode_solver[1]],
            nstep,
            n_threads,
            out_path_raw,
            model_str,
            extra_obj,
        )
        run_pool(calls, pool_nb)

    dif_list = list(set(list_100) - set(new_calls[dynamics_types[1].value]))

    if dif_list:
        calls = generate_calls(
            dif_list,
            Date,
            n_shooting,
            [dynamics_types[1]],
            [ode_solver[1]],
            nstep,
            n_threads,
            out_path_raw,
            model_str,
            extra_obj,
        )
        run_pool(calls, pool_nb)

    This function is used to run the process that were not run during the previous pool of processes

    Parameters
    ----------
    out_path_raw : str
        The path to store the raw results
    Date : str
        The date of the run
    n_shooting : tuple
        The number of shooting points for each phase
    dynamics_types : list
        The list of dynamics types to be run such as MillerDynamics.EXPLICIT, MillerDynamics.IMPLICIT, MillerDynamics.ROOT_EXPLICIT
    ode_solver : list
        The list of OdeSolver to be run such as OdeSolver.RK4, OdeSolver.RK2
    nstep : int
        The number of intermediate steps between two shooting points
    n_threads : int
        The number of threads to be used
    model_str : str
        The path to the bioMod model
    extra_obj : bool
        Whether to run with the extra objective or not (minimizing extra controls for implicit formulations)
    
This function is used to run the process that were not run during the previous pool of processes
Parameters


This function is used to run the process that were not run during the previous pool of processes Parameters
def run_the_missing_ones(
    out_path_raw: str,
    Date,
    n_shooting: tuple,
    dynamics_types: list,
    ode_solver: list,
    nstep: int,
    n_threads: int,
    model_str: str,
    extra_obj: bool,
    pool_nb: int,
):
    files = os.listdir(out_path_raw)
    files.sort()
    new_calls = {dynamics_types[0].value: [], dynamics_types[1].value: []}
    for i, file in enumerate(files):
        if file.endswith(".pckl"):
            p = Path(f"{out_path_raw}/{file}")
            file_path = open(p, "rb")
            data = pickle.load(file_path)
            if (
                data["dynamics_type"].value == dynamics_types[0].value
                or data["dynamics_type"].value == dynamics_types[1].value
            ):
                new_calls[data["dynamics_type"].value].append(data["irand"])
    list_100 = [i for i in range(0, 100)]
    dif_list = list(set(list_100) - set(new_calls[dynamics_types[0].value]))
    if dif_list:
        calls = generate_calls(
            dif_list,
            Date,
            n_shooting,
            [dynamics_types[1]],
            [ode_solver[1]],
            nstep,
            n_threads,
            out_path_raw,
            model_str,
            extra_obj,
        )
        run_pool(calls, pool_nb)
    dif_list = list(set(list_100) - set(new_calls[dynamics_types[1].value]))
    if dif_list:
        calls = generate_calls(
            dif_list,
            Date,
            n_shooting,
            [dynamics_types[1]],
            [ode_solver[1]],
            nstep,
            n_threads,
            out_path_raw,
            model_str,
            extra_obj,
        )
        run_pool(calls, pool_nb)
def run_the_missing_ones ( out_path_raw : str , Date , n_shooting : tuple , dynamics_types : list , ode_solver : list , nstep : int , n_threads : int , model_str : str , extra_obj : bool , pool_nb : int , ) : files = os . listdir ( out_path_raw ) files . sort ( ) new_calls = { dynamics_types [ 0 ] . value : [ ] , dynamics_types [ 1 ] . value : [ ] } for i , file in enumerate ( files ) : if file . endswith ( ".pckl" ) : p = Path ( f"{out_path_raw}/{file}" ) file_path = open ( p , "rb" ) data = pickle . load ( file_path ) if ( data [ "dynamics_type" ] . value == dynamics_types [ 0 ] . value or data [ "dynamics_type" ] . value == dynamics_types [ 1 ] . value ) : new_calls [ data [ "dynamics_type" ] . value ] . append ( data [ "irand" ] ) list_100 = [ i for i in range ( 0 , 100 ) ] dif_list = list ( set ( list_100 ) - set ( new_calls [ dynamics_types [ 0 ] . value ] ) ) if dif_list : calls = generate_calls ( dif_list , Date , n_shooting , [ dynamics_types [ 1 ] ] , [ ode_solver [ 1 ] ] , nstep , n_threads , out_path_raw , model_str , extra_obj , ) run_pool ( calls , pool_nb ) dif_list = list ( set ( list_100 ) - set ( new_calls [ dynamics_types [ 1 ] . value ] ) ) if dif_list : calls = generate_calls ( dif_list , Date , n_shooting , [ dynamics_types [ 1 ] ] , [ ode_solver [ 1 ] ] , nstep , n_threads , out_path_raw , model_str , extra_obj , ) run_pool ( calls , pool_nb )
This function is used to run the process that were not run during the previous pool of processes
Parameters
This function is used to run the process that were not run during the previous pool of processes Parameters
"""
    This function is used to run the process that were not run during the previous pool of processes

    Parameters
    ----------
    out_path_raw : str
        The path to store the raw results
    Date : str
        The date of the run
    n_shooting : tuple
        The number of shooting points for each phase
    dynamics_types : list
        The list of dynamics types to be run such as MillerDynamics.EXPLICIT, MillerDynamics.IMPLICIT, MillerDynamics.ROOT_EXPLICIT
    ode_solver : list
        The list of OdeSolver to be run such as OdeSolver.RK4, OdeSolver.RK2
    nstep : int
        The number of intermediate steps between two shooting points
    n_threads : int
        The number of threads to be used
    model_str : str
        The path to the bioMod model
    extra_obj : bool
        Whether to run with the extra objective or not (minimizing extra controls for implicit formulations)
    """ # Run the one that did not run
out_path_raw
str
Date
n_shooting
tuple
dynamics_types
list
ode_solver
list
nstep
int
n_threads
int
model_str
str
extra_obj
bool
pool_nb
int