Home > Mateda2.0 > functions > generators > CreateRandomFunctions.m

# CreateRandomFunctions

## PURPOSE

[Table] = CreateRandomFunctions(ListFactors,Card)

## SYNOPSIS

function [Table] = CreateRandomFunctions(ListFactors,Card)

## DESCRIPTION

     [Table] = CreateRandomFunctions(ListFactors,Card)
     CreateRandomFunctions:    Generates random values for the table entries of the structure defined in ListFactors
     INPUTS
     ListFactors: Each  row i stores the variables in the factor
     Card: Cardinalities of the variables
     OUTPUTS
     Tables{i}: Contains the values for each of the configurations of factor i

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

## CROSS-REFERENCE INFORMATION

This function calls:

This function is called by:

- EBNA_PLS_MPC_NKRandom EXAMPLE 16:
- AllNKInstances AllNKInstances(NumberVar,k,Number_Inst,nam)

## SOURCE CODE

    0001 function [Table] = CreateRandomFunctions(ListFactors,Card)
    0002 % [Table] = CreateRandomFunctions(ListFactors,Card)
    0003 % CreateRandomFunctions:    Generates random values for the table entries of the structure defined in ListFactors
    0004 % INPUTS
    0005 % ListFactors: Each  row i stores the variables in the factor
    0006 % Card: Cardinalities of the variables
    0007 % OUTPUTS
    0008 % Tables{i}: Contains the values for each of the configurations of factor i
    0009 %
    0010 % Last version 8/26/2008. Roberto Santana (roberto.santana@ehu.es)
    0011
    0012 totfactors = size(ListFactors,2);
    0013
    0014 for i=1:totfactors
    0015  sizeTable = 1;
    0016  for j=1:size(ListFactors{i},2)
    0017   sizeTable = sizeTable * Card(ListFactors{i}(j));
    0018   Table{i} = rand(1,sizeTable); %Random between 0 and 1 values are assigned to the entries
    0019  end,
    0020 end,