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

# TreeFDA_HPProtein

## PURPOSE

EXAMPLE 18: Tree-FDA for the HP protein model (The tree structure is

## SYNOPSIS

This is a script file.

## DESCRIPTION

     EXAMPLE 18:  Tree-FDA for the HP protein model (The tree structure is
     learned from the mutual information applying a threshold on the minimum
     MI value to consider a dependence. Therefore the learned structure
     actually corresponds to a forest.

## CROSS-REFERENCE INFORMATION

This function calls:

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

This function is called by:

## SOURCE CODE

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