Home > Mateda2.0 > ScriptsMateda > OptimizationScripts > MkFDA_HPProtein.m

# MkFDA_HPProtein

## PURPOSE

EXAMPLE 6: Markov Chain FDA for the HP protein model.

## SYNOPSIS

This is a script file.

## DESCRIPTION

     EXAMPLE 6:  Markov Chain FDA for the HP protein model.

## CROSS-REFERENCE INFORMATION

This function calls:

- RunEDA [AllStat,Cache]=RunEDA(PopSize,n,F,Card,cache,edaparams)
- PrintProtein [Pos] = PrintProtein(vector)
- CreateMarkovModel [Cliques] = CreateMarkovModel(NumbVar,dim)

This function is called by:

## SOURCE CODE

    0001 % EXAMPLE 6:  Markov Chain FDA for the HP protein model.
    0002
    0003  global HPInitConf;   % This is the HP protein instance, defined as a sequence of zeros and ones
    0004  HPInitConf =  [zeros(1,12),1,0,1,0,1,1,0,0,1,1,0,0,1,1,0,1,1,0,0,1,1,0,0,1,1,0,1,1,0,0,1,1,0,0,1,1,0,1,0,1,zeros(1,12)];
    0005  % The number of variables is equal to the sequence length and each
    0006  % variables takes values in {0,1,2}
    0007  PopSize = 1000; NumbVar = size(HPInitConf,2); cache  = [1,1,1,1,1]; Card = 3*ones(1,NumbVar);   maxgen = 300;
    0008  % The Markov chain model(Cliques) is constructed specifying the number of
    0009  % conditioned (previous) variables. In the example below this number is
    0010  % 1., i.e. p(x) = p(x0)p(x1|x0) ... p(xn|xn-1)
    0011  Cliques = CreateMarkovModel(NumbVar,2);
    0012
    0013  F = 'EvaluateEnergy'; % HP protein evaluation function
    0014  edaparams{1} = {'learning_method','LearnFDA',{Cliques}};
    0015  edaparams{2} = {'sampling_method','SampleFDA',{PopSize}};
    0016  edaparams{3} = {'repairing_method','HP_repairing',{}}; % Repairing method used to guarantee that
    0017                                                         % solutions do not self-intersect
    0018  edaparams{4} = {'stop_cond_method','max_gen',{maxgen}};
    0019  [AllStat,Cache]=RunEDA(PopSize,NumbVar,F,Card,cache,edaparams)
    0020
    0021  % To draw the resulting solution use function PrintProtein(vector),
    0022  % where vector is the best solution found.
    0023  vector = AllStat{maxgen,2}
    0024  PrintProtein(vector)