Home > Mateda2.0 > repairing > SetWithinBounds_repairing.m

# SetWithinBounds_repairing

## PURPOSE

SetInBounds_repairing: For a problem with continuous representation

## SYNOPSIS

function[NewPop] = SetWithinBounds_repairing(Pop,RangeValues,repairing_params)

## DESCRIPTION

     SetInBounds_repairing:   For a problem with continuous representation
     where solutions are below (above) the contraints modify the solutions to
     a random value within the variables ranges

     INPUTS
     Pop: Population
     RangeValues: Range of values for each of the variables
     repairing_params: Not use for this function
     OUTPUTS
     NewPop: New repaired population

     Last version 8/26/2008. Roberto Santana (roberto.santana@ehu.es)

## CROSS-REFERENCE INFORMATION

This function calls:

This function is called by:

## SOURCE CODE

    0001 function[NewPop] =  SetWithinBounds_repairing(Pop,RangeValues,repairing_params)
    0002 % SetInBounds_repairing:   For a problem with continuous representation
    0003 % where solutions are below (above) the contraints modify the solutions to
    0004 % a random value within the variables ranges
    0005 %
    0006 % INPUTS
    0007 % Pop: Population
    0008 % RangeValues: Range of values for each of the variables
    0009 % repairing_params: Not use for this function
    0010 % OUTPUTS
    0011 % NewPop: New repaired population
    0012 %
    0013 % Last version 8/26/2008. Roberto Santana (roberto.santana@ehu.es)
    0014
    0015 NumbVar = size(Pop,2);
    0016 NewPop = Pop;
    0017    for i=1:NumbVar,
    0018           under_val = find(Pop(:,i)<RangeValues(1,i));
    0019           n_under = size(under_val,1);
    0020           NewPop(under_val,i) = RangeValues(1,i) + rand(1,n_under).*(RangeValues(2,i)-RangeValues(1,i));
    0021           over_val = find(Pop(:,i)>RangeValues(2,i));
    0022           n_over = size(over_val,1);
    0023           NewPop(over_val,i) = RangeValues(1,i) + rand(1,n_over).*(RangeValues(2,i)-RangeValues(1,i));
    0024    end