Home > Mateda2.0 > local_optimization > local_search_OffHP.m

# local_search_OffHP

## PURPOSE

[NewPop,NumbEvals] = local_search_OffHP(k,Pop,FunVal,local_opt_params)

## SYNOPSIS

function[NewPop,NewFunVal,NumbEvals] = local_search_OffHP(k,Pop,FunVal,local_opt_params)

## DESCRIPTION

     [NewPop,NumbEvals] =  local_search_OffHP(k,Pop,FunVal,local_opt_params)
     local_search_OffHP: Interface between Matlab local optimization methods
                         and the for the Off lattice HP model (Can be
                         generalized to other functions)

     INPUT
     k: Current generation
     Pop: Population
     FunVal: Function values for each individual in the population
     OUTPUT:
     NewPop: Population after local search
     NewFunVal: Function values for the population optimized
     NumbEvals: Number of evaluations made during the local optimization step

## CROSS-REFERENCE INFORMATION

This function calls:

- EvaluateOffHPProtein [Evals] = EvaluateOffHPProtein(Pop)
- Trigom_repairing [NewPop] = Trigomn_repairing(Pop,RangeValues,repairing_params)

This function is called by:

## SOURCE CODE

    0001 function[NewPop,NewFunVal,NumbEvals] =  local_search_OffHP(k,Pop,FunVal,local_opt_params)
    0002 % [NewPop,NumbEvals] =  local_search_OffHP(k,Pop,FunVal,local_opt_params)
    0003 % local_search_OffHP: Interface between Matlab local optimization methods
    0004 %                     and the for the Off lattice HP model (Can be
    0005 %                     generalized to other functions)
    0006 %
    0007 % INPUT
    0008 % k: Current generation
    0009 % Pop: Population
    0010 % FunVal: Function values for each individual in the population
    0011 % OUTPUT:
    0012 % NewPop: Population after local search
    0013 % NewFunVal: Function values for the population optimized
    0014 % NumbEvals: Number of evaluations made during the local optimization step
    0015
    0016 options = optimset('MaxFunEvals',20000);
    0017 options = optimset(options,'Display','off');
    0018 options = optimset(options,'MaxIter',10000);
    0019 options = optimset(options,'LargeScale','off');
    0020 options = optimset(options,'Diagnostics','off');
    0021 options = optimset(options,'HessUpdate','steepdesc'); % 'dfp','bfgs'
    0022
    0023 N = size(Pop,1);
    0024 NumbVar = size(Pop,2);
    0025 NumbEvals = 0;
    0026 for i=1:N
    0027  aux = FunVal(i,1);
    0028  X = Pop(i,:);
    0029  [NewPop(i,:),val,EXITFLAG,OUTPUT]=fminunc(@(X) -1*EvaluateOffHPProtein(X),X,options);
    0030  NewFunVal(i,1) = -1*val;
    0031  %[aux,NewFunVal(i,1)]
    0032  NumbEvals = NumbEvals + OUTPUT.funcCount;
    0033 end,
    0034
    0035 RangeValues =  [zeros(1,NumbVar);2*pi*ones(1,NumbVar)];
    0036 [NewPop] =   Trigom_repairing(NewPop,RangeValues,{});