# Path: phievo/Networks/mutation.py
# T=1.0 #typical time scale
# C=1.0 #typical concentration
# L=1.0 #typical size for diffusion
#                 E_I=log(interval[1]/min_param) #range of possible energies
# def ligand_fct(random_generator):
# def build_lists(mutation_dict):
# def sample_dictionary_ranges(key,random_generator):
# def random_parameters(Types,random_generator):
# def rand_modify(self,random_generator):
#     def __init__(self,generator = random.Random()):
#     def compute_Cseed(self):
#     def random_Species(self, Type='Species'):
#     def random_Interaction(self,Interaction_Type):
#     def remove_Interaction(self,Type):
#     def random_remove_output(self):
#     def random_add_output(self):
#     def random_change_output(self):
#     def random_duplicate(self):
#     def mutate_Node(self,Type):
#     def build_mutations(self):
#         def update_dict(self,dictionary,key,name):
#     def compute_next_mutation(self):
#     def mutate_and_integrate(self,prmt,nnetwork,tgeneration,mutation=True):
# class Mutable_Network(classes_eds2.Network):


import numpy as np
import Immune
import math
import random
    import random
from phievo.Networks import mutation
# in the space of fitness functions, their pareto ranks are increased (but are still consider better than those of pareto rank 2)
#this gives a selective advantage to rarer networks in population which is pareto rank 1

prmt['pareto']=0 # a flag, set to 1 to run pareto
prmt['npareto_functions']= 2 # number of functions to use for pareto optimization.
prmt['rshare']= 15 #radius to use for fitness sharing, set to zero to turn off

# Control the network and species(time) plotting from evolution_gillespie.py (off for cluster)
prmt['plot']=0

## prmt['restart']['kgeneration'] tells phievo to save a complete generation
## at a given frequency in a restart_file. The algorithm can relaunched at
## backuped generation by turning  prmt['restart']['activated'] = True and
## setting the generation and the seed. If the two latters are not set, the
## algorithm restart from the highest generation  in the highest seed.
prmt['restart'] = {}
prmt['restart']['activated'] = False #indicate if you want to restart or not
prmt['restart']['freq'] = 50  # save population every freq generations
#prmt['restart']['seed'] =  0 # the directory of the population you want to restart from
#prmt['restart']['kgeneration'] = 50  # restart from After this generation number
#prmt['restart']['same_seed'] = True # Backup the random generator to the same seed

# necessary imports to define following functions

# generic init network function that just creates desired number of input/output species

def init_network():

    seed=int(random.random()*510)
    g=random.Random(seed)

# Path: phievo/Networks/mutation.py
# T=1.0 #typical time scale
# C=1.0 #typical concentration
# L=1.0 #typical size for diffusion
#                 E_I=log(interval[1]/min_param) #range of possible energies
# def ligand_fct(random_generator):
# def build_lists(mutation_dict):
# def sample_dictionary_ranges(key,random_generator):
# def random_parameters(Types,random_generator):
# def rand_modify(self,random_generator):
#     def __init__(self,generator = random.Random()):
#     def compute_Cseed(self):
#     def random_Species(self, Type='Species'):
#     def random_Interaction(self,Interaction_Type):
#     def remove_Interaction(self,Type):
#     def random_remove_output(self):
#     def random_add_output(self):
#     def random_change_output(self):
#     def random_duplicate(self):
#     def mutate_Node(self,Type):
#     def build_mutations(self):
#         def update_dict(self,dictionary,key,name):
#     def compute_next_mutation(self):
#     def mutate_and_integrate(self,prmt,nnetwork,tgeneration,mutation=True):
# class Mutable_Network(classes_eds2.Network):


# Path: Examples/immune/initialization_pMHC.py
import numpy as np
import Immune
import math
import random
    import random
from phievo.Networks import mutation

# in the space of fitness functions, their pareto ranks are increased (but are still consider better than those of pareto rank 2)
#this gives a selective advantage to rarer networks in population which is pareto rank 1

prmt['pareto']=0 # a flag, set to 1 to run pareto
prmt['npareto_functions']= 2 # number of functions to use for pareto optimization.
prmt['rshare']= 15 #radius to use for fitness sharing, set to zero to turn off

# Control the network and species(time) plotting from evolution_gillespie.py (off for cluster)
prmt['plot']=0

## prmt['restart']['kgeneration'] tells phievo to save a complete generation
## at a given frequency in a restart_file. The algorithm can relaunched at
## backuped generation by turning  prmt['restart']['activated'] = True and
## setting the generation and the seed. If the two latters are not set, the
## algorithm restart from the highest generation  in the highest seed.
prmt['restart'] = {}
prmt['restart']['activated'] = False #indicate if you want to restart or not
prmt['restart']['freq'] = 50  # save population every freq generations
#prmt['restart']['seed'] =  0 # the directory of the population you want to restart from
#prmt['restart']['kgeneration'] = 50  # restart from After this generation number
#prmt['restart']['same_seed'] = True # Backup the random generator to the same seed

# necessary imports to define following functions

# generic init network function that just creates desired number of input/output species

def init_network():

    seed=int(random.random()*510)
    g=random.Random(seed)

    L=mutation.Mutable_Network(g)