Scilab Website | Contribute with GitLab | Scilab Community | ATOMS toolboxes
Scilab Online Help
2026.1.0 - English


optim_nsga

A multi-objective Niched Sharing Genetic Algorithm

Syntax

[pop_opt,fobj_pop_opt,pop_init,fobj_pop_init] = optim_nsga(ga_f,pop_size,nb_generation,p_mut,p_cross,Log,param,sigma,pow)

Arguments

ga_f

the function to be optimized. The prototype if y = f(x) or y = list(f,p1,p2,...).

pop_size

the size of the population of individuals (default value: 100).

nb_generation

the number of generations (equivalent to the number of iterations in classical optimization) to be computed (default value: 10).

p_mut

the mutation probability (default value: 0.1).

p_cross

the crossover probability (default value: 0.7).

Log

if %T, will call the output function at the end of each iteration, see "output_func" under param variable below.

param

a list of parameters.

  • 'codage_func': the function which will perform the coding and decoding of individuals (default function: coding_ga_identity).

  • 'init_func': the function which will perform the initialization of the population (default function: init_ga_default).

  • 'dimension', 'minbounds' and 'maxbounds': parameters used by the initialization function to define the initial population.

  • 'crossover_func': the function which will perform the crossover between two individuals (default function: crossover_ga_default).

  • 'mutation_func': the function which will perform the mutation of one individual (default function: mutation_ga_default).

  • 'selection_func': the function whcih will perform the selection of individuals at the end of a generation (default function: selection_ga_elitist).

  • 'nb_couples': the number of couples which will be selected so as to perform the crossover and mutation (default value: 100).

  • 'pressure': the value the efficiency of the worst individual (default value: 0.05).

  • "output_func": a callback function called after each generation if Log is %T (default function output_nsga_default).

  • "use_vectorized": indicates if the objective function is vectorized or not. If "use_vectorized" is %T then the function will be called with the whole population at once (matrix with one individual per line) instead of individual by individual. Using vectorized functions will improve performances. (default value: %F).

sigma

the radius of the sharing area.

pow

the power coefficient of the penalty formula.

pop_opt

the population of optimal individuals.

fobj_pop_opt

the set of objective function values associated to pop_opt (optional).

pop_init

the initial population of individuals (optional).

fobj_pop_init

the set of objective function values associated to pop_init (optional).

Description

  • This function implements the classical "Niched Sharing Genetic Algorithm". For a demonstration, see SCI/modules/optimization/demos/genetic/NSGAdemo.sce

Examples

function f=deb_1(x)
   f1_x1 = x(1);
   g_x2  = 1 + 9 * sum((x(2:$)-x(1)).^2) / (length(x) - 1);
   h     = 1 - sqrt(f1_x1 / g_x2);

   f(1,1) = f1_x1;
   f(1,2) = g_x2 * h;
endfunction

PopSize     = 100;
Proba_cross = 0.5;
Proba_mut   = 0.3;
NbGen       = 4;
NbCouples   = 110;
Log         = %T;
nb_disp     = 10; // Nb point to display from the optimal population
pressure    = 0.1;

ga_params = init_param();
ga_params = add_param(ga_params,'dimension',2);
ga_params = add_param(ga_params,'minbound',zeros(2,1));
ga_params = add_param(ga_params,'maxbound',ones(2,1));

[pop_opt, fobj_pop_opt, pop_init, fobj_pop_init] = optim_nsga(deb_1, PopSize,NbGen, Proba_mut, Proba_cross, Log, ga_params)

See also

  • optim_moga — multi-objective genetic algorithm
  • optim_ga — A flexible genetic algorithm
  • optim_nsga2 — A multi-objective Niched Sharing Genetic Algorithm version 2

History

VersionDescription
2026.1.0

use_vectorized parameter added.

Report an issue
<< optim_moga Algorithms optim_nsga2 >>

Copyright (c) 2022-2026 (Dassault Systèmes S.E.)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue May 19 13:56:06 CEST 2026