Will be called by the population model once created.
773520
public void initializeInstance(PopulationModel populationModel) {
        this.population = populationModel.getPopulation();
        culledSize = (int) (populationModel.getPopulationSize() * (1.0 - cullRatio) + 0.5);
    }
995606
public function populate(): void
  {
    foreach ($this->data as $data)
    {
      $this->rowFactory->createRow($this, $data);
    }
  }
257977
private void initializeUnknownCategoricalsPerColumn(GenModel model) {
    unknownCategoricalsPerColumn = new ConcurrentHashMap<>();

    for (int i = 0; i < model.getNumCols(); i++) {
      String[] domainValues = model.getDomainValues(i);
      if (domainValues != null) {
        unknownCategoricalsPerColumn.put(model.getNames()[i], new AtomicLong());
      }
    }

    unknownCategoricalsPerColumn = Collections.unmodifiableMap(unknownCategoricalsPerColumn);
  }
1239647
def _initialize_pop(self, pop_size):
        """"""
        self.initialize_cma_es(pop_size)
        self.toolbox.register("individual", self._make_individual)
        self.toolbox.register("generate", self._generate,
                              self.toolbox.individual)
        self.toolbox.register("population", tools.initRepeat,
                              list, self._initial_individual)
        self.toolbox.register("update", self.update)
        self.population = self.toolbox.population(n=pop_size)
        self.assign_fitnesses(self.population)
        self._model_count += len(self.population)
        return
410262
def init_population(self, population_size, graph_max_layer, graph_min_layer):
        
        population = []
        graph = Graph(max_layer_num=graph_max_layer, min_layer_num=graph_min_layer,
                      inputs=[Layer(LayerType.input.value, output=[4, 5], size='x'), Layer(LayerType.input.value, output=[4, 5], size='y')],
                      output=[Layer(LayerType.output.value, inputs=[4], size='x'), Layer(LayerType.output.value, inputs=[5], size='y')],
                      hide=[Layer(LayerType.attention.value, inputs=[0, 1], output=[2]),
                            Layer(LayerType.attention.value, inputs=[1, 0], output=[3])])
        for _ in range(population_size):
            graph_tmp = copy.deepcopy(graph)
            graph_tmp.mutation()
            population.append(Individual(indiv_id=self.generate_new_id(), graph_cfg=graph_tmp, result=None))
        return population
722767
def reset(self, populations, lag, mu, u_int, j_coup, mean_f):
        """"""

        self.set_filling(populations)
        self.param['lambda'] = lag
        self.param['orbital_e'] = mu
        self.selfconsistency(u_int, j_coup, mean_f)
1176170
function(model, options) {
      options = options ? _.clone(options) : {};
      var wait = options.wait;
      model = this._prepareModel(model, options);
      if (!model) return false;
      if (!wait) this.add(model, options);
      var collection = this;
      var success = options.success;
      options.success = function(m, resp, callbackOpts) {
        if (wait) collection.add(m, callbackOpts);
        if (success) success.call(callbackOpts.context, m, resp, callbackOpts);
      };
      model.save(null, options);
      return model;
    }
19857
def set_filling(self, populations):
        """"""
        populations = np.asarray(populations)
#
#        self.param['orbital_e'] -= bethe_findfill_zeroT( \
#                                        self.param['avg_particles'],
#                                        self.param['orbital_e'],
#                                        self.param['hopping'])
        efermi = - bethe_find_crystalfield(
                            populations, self.param['hopping'])
        self.param['populations'] = populations
#        fermion_avg(efermi, self.param['hopping'], 'ocupation')
        self.param['ekin'] = fermion_avg(efermi, self.param['hopping'], 'ekin')

        spin_gen_op(self.oper, estimate_gauge(populations))
128703
def create_population(self):
        ""
        base = self._base
        if base._share_inputs:
            used_inputs_var = SelectNumbers([x for x in range(base.nvar)])
            used_inputs_naive = used_inputs_var
        if base._pr_variable == 0:
            used_inputs_var = SelectNumbers([])
            used_inputs_naive = SelectNumbers([x for x in range(base.nvar)])
        elif base._pr_variable == 1:
            used_inputs_var = SelectNumbers([x for x in range(base.nvar)])
            used_inputs_naive = SelectNumbers([])
        else:
            used_inputs_var = SelectNumbers([x for x in range(base.nvar)])
            used_inputs_naive = SelectNumbers([x for x in range(base.nvar)])
        nb_input = Inputs(base, used_inputs_naive, functions=base._input_functions)
        while ((base._all_inputs and not base.stopping_criteria_tl()) or
               (self.popsize < base.popsize and
                not base.stopping_criteria())):
            if base._all_inputs and used_inputs_var.empty() and used_inputs_naive.empty():
                base._init_popsize = self.popsize
                break
            if nb_input.use_all_variables():
                v = nb_input.all_variables()
                if v is None:
                    continue
            elif not used_inputs_var.empty() and np.random.random() < base._pr_variable:
                v = self.variable_input(used_inputs_var)
                if v is None:
                    used_inputs_var.pos = used_inputs_var.size
                    continue
            elif not used_inputs_naive.empty():
                v = nb_input.input()
                if not used_inputs_var.empty() and used_inputs_naive.empty():
                    base._pr_variable = 1
                if v is None:
                    used_inputs_naive.pos = used_inputs_naive.size
                    if not used_inputs_var.empty():
                        base._pr_variable = 1
                    continue
            else:
                gen = self.generation
                self.generation = 0
                v = base.random_offspring()
                self.generation = gen
            self.add(v)
835713
private function model()
    {
        $this->relationship(config('amranidev.config.model').DIRECTORY_SEPARATOR.ucfirst(str_singular($this->tables['first'])).'.php', $this->tables['second']);
        $this->relationship(config('amranidev.config.model').DIRECTORY_SEPARATOR.ucfirst(str_singular($this->tables['second'])).'.php', $this->tables['first']);
    }
1307855
def create_model(self, ModelName, PrimaryContainer, *args, **kwargs):  # pylint: disable=unused-argument
        
        LocalSagemakerClient._models[ModelName] = _LocalModel(ModelName, PrimaryContainer)
551281
private Model makeModel() {
        Model mo = new DefaultModel();
        Mapping mapping = mo.getMapping();

        int nbNodes = 300;
        int nbVMs = 6 * nbNodes;

        //Memory usage/consumption in GB
        ShareableResource rcMem = new ShareableResource("mem");

        //A resource representing the bandwidth usage/consumption of the elements in GB
        ShareableResource rcBW = new ShareableResource("bandwidth");

        nodes = new ArrayList<>(nbNodes);

        for (int i = 0; i < nbNodes; i++) {
            Node n = mo.newNode();
            nodes.add(n);
            mapping.addOnlineNode(n);

            //Each node provides a 10GB bandwidth and 32 GB RAM to its VMs
            rcBW.setCapacity(n, 10);
            rcMem.setCapacity(n, 32);
        }

        for (int i = 0; i < nbVMs; i++) {
            VM vm = mo.newVM();
            //Basic balancing through a round-robin: 6 VMs per node
            mapping.addRunningVM(vm, nodes.get(i % nodes.size()));

            //Each VM uses currently a 1GB bandwidth and 1,2 or 3 GB RAM
            rcBW.setConsumption(vm, 1);
            rcMem.setConsumption(vm, i % 5 + 1);
        }

        mo.attach(rcBW);
        mo.attach(rcMem);
        return mo;
    }
115516
def make_population(population_size, solution_generator, *args, **kwargs):
    """"""
    return [
        solution_generator(*args, **kwargs) for _ in range(population_size)
    ]
521694
def _new_population_gsa(population, fitnesses, velocities, lower_bounds,
                        upper_bounds, grav_initial, grav_reduction_rate,
                        iteration, max_iterations):
    
    # Update the gravitational constant, and the best and worst of the population
    # Calculate the mass and acceleration for each solution
    # Update the velocity and position of each solution
    population_size = len(population)
    solution_size = len(population[0])

    # In GSA paper, grav is G
    grav = _next_grav_gsa(grav_initial, grav_reduction_rate, iteration,
                          max_iterations)
    masses = _get_masses(fitnesses)

    # Create bundled solution with position and mass for the K best calculation
    # Also store index to later check if two solutions are the same
    # Sorted by solution fitness (mass)
    solutions = [{
        'pos': pos,
        'mass': mass,
        'index': i
    } for i, (pos, mass) in enumerate(zip(population, masses))]
    solutions.sort(key=lambda x: x['mass'], reverse=True)

    # Get the force on each solution
    # Only the best K solutions apply force
    # K linearly decreases to 1
    num_best = int(population_size - (population_size - 1) *
                   (iteration / float(max_iterations)))
    forces = []
    for i in range(population_size):
        force_vectors = []
        for j in range(num_best):
            # If it is not the same solution
            if i != solutions[j]['index']:
                force_vectors.append(
                    _gsa_force(grav, masses[i], solutions[j]['mass'],
                               population[i], solutions[j]['pos']))
        forces.append(_gsa_total_force(force_vectors, solution_size))

    # Get the acceleration of each solution
    accelerations = []
    for i in range(population_size):
        accelerations.append(_gsa_acceleration(forces[i], masses[i]))

    # Update the velocity of each solution
    new_velocities = []
    for i in range(population_size):
        new_velocities.append(
            _gsa_update_velocity(velocities[i], accelerations[i]))

    # Create the new population
    new_population = []
    for i in range(population_size):
        new_position = _gsa_update_position(population[i], new_velocities[i])
        # Constrain to bounds
        new_position = list(
            numpy.clip(new_position, lower_bounds, upper_bounds))

        new_population.append(new_position)

    return new_population, new_velocities
1283911
private void populateModel()
   {
      if (m_count != 0)
      {
         m_count = 0;
         Arrays.fill(m_flags, false);
      }

      for (Resource resource : m_parentFile.getResources())
      {
         for (int loop = 0; loop < MPXResourceField.MAX_FIELDS; loop++)
         {
            if (resource.getCachedValue(MPXResourceField.getMpxjField(loop)) != null)
            {
               if (m_flags[loop] == false)
               {
                  m_flags[loop] = true;
                  m_fields[m_count] = loop;
                  ++m_count;
               }
            }
         }
      }

      //
      // Ensure the the model fields always appear in the same order
      //
      Arrays.sort(m_fields);
      System.arraycopy(m_fields, m_fields.length - m_count, m_fields, 0, m_count);
   }
16256
def _create_one(self, ctx):
        
        assert isinstance(ctx, ResourceQueryContext)

        fields = dict_pick(ctx.data, self._model_columns)
        model = self.model_cls(**fields)
        return model
923000
def update(self, population):
        
        population.sort(key=lambda ind: ind.fitness, reverse=True)

        old_centroid = self.centroid
        self.centroid = numpy.dot(self.weights, population[0:self.mu])

        c_diff = self.centroid - old_centroid

        # Cumulation : update evolution path
        self.ps = (1 - self.cs) * self.ps \
            + numpy.sqrt(self.cs * (2 - self.cs) * self.mueff) / self.sigma \
            * numpy.dot(self.B, (1. / self.diagD)
                        * numpy.dot(self.B.T, c_diff))

        hsig = float((numpy.linalg.norm(self.ps) /
                      numpy.sqrt(1. - (1. - self.cs) **
                                 (2. * (self.update_count + 1.))) / self.chiN
                      < (1.4 + 2. / (self.dim + 1.))))

        self.update_count += 1

        self.pc = (1 - self.cc) * self.pc + hsig \
            * numpy.sqrt(self.cc * (2 - self.cc) * self.mueff) / self.sigma \
            * c_diff

        # Update covariance matrix
        artmp = population[0:self.mu] - old_centroid
        self.C = (1 - self.ccov1 - self.ccovmu + (1 - hsig)
                  * self.ccov1 * self.cc * (2 - self.cc)) * self.C \
            + self.ccov1 * numpy.outer(self.pc, self.pc) \
            + self.ccovmu * numpy.dot((self.weights * artmp.T), artmp) \
            / self.sigma ** 2

        self.sigma *= numpy.exp((numpy.linalg.norm(self.ps) / self.chiN - 1.)
                                * self.cs / self.damps)

        self.diagD, self.B = numpy.linalg.eigh(self.C)
        indx = numpy.argsort(self.diagD)

        self.cond = self.diagD[indx[-1]] / self.diagD[indx[0]]

        self.diagD = self.diagD[indx] ** 0.5
        self.B = self.B[:, indx]
        self.BD = self.B * self.diagD