资源简介

用于图象处理的,量子遗传算法。量子计算,量子算法初学者参考。

资源截图

代码片段和文件信息

function [best_indexbest_fitnessbest_alphabest_beta]=evaluate_image_opt(rg_cameramanrowcolumenum_pixelnum_of_singlesnum_of_chromnum_of_genes)
dec=zeros(1num_of_singles*num_of_chrom);
flt=zeros(1num_of_singles*num_of_chrom);
for i=1:num_of_singles
    for j=1:num_of_chrom
        curr_chrom=r((2*i-3+j)*num_of_genes+1:(2*i-2+j)*num_of_genes);
        for k=1:num_of_genes
            dec(i*2+j-2)=dec(i*2+j-2)+curr_chrom(k)*2^(num_of_genes-k);
        end
    end
end
flt=round(10*(dec/1024));
fitness=zeros(1num_of_singles);
for k=1:num_of_singles
    alpha=flt(k*2-1);
    beta=flt(k*2);
    if alpha==0
       alpha=1;
    end
    if beta==0
        beta=1;
    end
    gc_cameraman=zeros(rowcolume);
    syms t;
    for i=1:row
        for j=1:colume
            gc_cameraman(ij)=double(int(t^(alpha-1)*(1-t)^(beta-1)t0g_cameraman(ij))/int(t^(alpha-1)*(1-t)^(beta-1)t01));
        end
    end
    fitness(k)=sum(sum(gc_cameraman.*gc_cameraman))/num_pixel-(sum(sum(gc_cameraman))/num_pixel)^2;
end
[best_fitness best_index]=max(fitness);
best_alpha=flt(best_index*2-1);
best_beta=flt(best_index*2);

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        765  2007-05-23 08:14  量子遗传算法用于图象处理\image_optimization.m

     文件        759  2007-05-16 20:35  量子遗传算法用于图象处理\init_qga.m

     文件        153  2007-05-21 10:51  量子遗传算法用于图象处理\observe.m

     文件        851  2007-05-23 08:01  量子遗传算法用于图象处理\qga_image_opt.m

     文件        788  2007-05-16 20:19  量子遗传算法用于图象处理\upgate.m

     文件       1156  2007-05-23 08:01  量子遗传算法用于图象处理\evaluate_image_opt.m

     文件        441  2007-05-16 19:36  量子遗传算法用于图象处理\f.m

     目录          0  2007-09-02 10:33  量子遗传算法用于图象处理

----------- ---------  ---------- -----  ----

                 5131                    9


评论

共有 条评论