crowding_distance.html ( File view )

  • By chghzz 2013-09-27
  • View(s):101
  • Download(s):5
  • Point(s): 1
			<html xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd">
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   
      <!--
This HTML is auto-generated from an M-file.
To make changes, update the M-file and republish this document.
      -->
      <title>function f = crowding_distance(x,problem)</title>
      <meta name="generator" content="MATLAB 7.0">
      <meta name="date" content="2006-03-07">
      <meta name="m-file" content="crowding_distance"><style>
body {

  background-color: white;
  margin:10px;

}
h1 {

  color: #990000; 
  font-size: x-large;

}
h2 {

  color: #990000;
  font-size: medium;

}
p.footer {

  text-align: right;
  font-size: xx-small;
  font-weight: lighter;
  font-style: italic;
  color: gray;

}

pre.codeinput {

  margin-left: 30px;

}

span.keyword {
color: #0000FF
}
span.comment {
color: #228B22
}
span.string {
color: #A020F0
}
span.untermstring {
color: #B20000
}
span.syscmd {
color: #B28C00
}

pre.showbuttons {

  margin-left: 30px;
  border: solid black 2px;
  padding: 4px;
  background: #EBEFF3;

}

pre.codeoutput {

  color: gray;
  font-style: italic;

}
pre.error {

  color: red;

}

/* Make the text shrink to fit narrow windows, but not stretch too far in 
wide windows.  On Gecko-based browsers, the shrink-to-fit doesn't work. */ 
p,h1,h2,div {

  /* for MATLAB's browser */
  width: 600px;
  /* for Mozilla, but the "width" tag overrides it anyway */
  max-width: 600px;
  /* for IE */
  width:expression(document.body.clientWidth > 620 ? "600px": "auto" );

}

    </style></head>
   <body>
      <h1>function f = crowding_distance(x,problem)</h1><pre class="codeinput"><span class="comment">% This function calculates the crowding distance</span>
[N,M] = size(x);
<span class="keyword">switch</span> problem
    <span class="keyword">case</span> 1
        M = 2;
        V = 6;
    <span class="keyword">case</span> 2
        M = 3;
        V = 12;
<span class="keyword">end</span>

<span class="comment">% Crowding distance for each front</span>
<span class="keyword">for</span> i = 1 : length(F(front).f)
    y(i,:) = x(F(front).f(i),:);
<span class="keyword">end</span>
<span class="keyword">for</span> i = 1 : M
    [sorted(i).individual,sorted(i).index] = sort(y(:,V + i));
    distance(sorted(i).index(1)).individual = Inf;
    distance(sorted(i).index(length(sorted(i).index))).individual = Inf;
<span class="keyword">end</span>

[num,len] = size(y);
<span class="comment">% Initialize all the distance of individuals as zero.</span>
<span class="keyword">for</span> i = 1 : M
    <span class="keyword">for</span> j = 2 : num - 1
        distance(j).individual = 0;
    <span class="keyword">end</span>
    objective(i).range = <span class="keyword">...</span>
                sorted(i).individual(length(sorted(i).individual)) - <span class="keyword">...</span>
                sorted(i).individual(1);
        <span class="comment">% Maximum and minimum objectives value for the ith objective</span>
<span class="keyword">end</span>
<span class="comment">% Caluclate the crowding distance for front one.</span>
<span class="keyword">for</span> i = 1 : M
    <span class="keyword">for</span> j = 2 : num - 1
        distance(j).individual = distance(j).individual + <span class="keyword">...</span>
           
...
...
(Please download the complete source code to view)
			
...
Expand> <Close

Want complete source code? Download it here

Point(s): 1

Download
0 lines left, continue to read
Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
MOEA-NSGA-II0.00 B05-06-13|16:57
crowding_distance.m1.24 kB07-03-06|16:14
evaluate_objective.m970.00 B13-11-05|23:37
genetic_operator.m3.43 kB07-03-06|16:11
html0.00 B19-03-13|08:15
crowding_distance.html5.01 kB07-03-06|16:14
genetic_operator.html10.05 kB07-03-06|16:11
initialize_variables.html4.33 kB07-03-06|16:08
non_domination_sort_mod.html11.44 kB07-03-06|16:01
nsga_2.html13.43 kB07-03-06|15:59
replace_chromosome.html6.20 kB07-03-06|16:05
tournament_selection.html6.04 kB07-03-06|16:13
initialize_variables.m966.00 B07-03-06|16:08
non_domination_sort_mod.m4.02 kB07-03-06|16:01
nsga_2.m4.56 kB07-03-06|16:48
NSGA_2.pdf364.92 kB07-03-06|16:46
plot_objective.m476.00 B13-11-05|13:51
replace_chromosome.m1.93 kB07-03-06|16:05
solution.txt31.64 kB18-03-13|21:13
tournament_selection.m1.70 kB07-03-06|16:13
...
Sponsored links

crowding_distance.html (368.17 kB)

Need 1 point
Your Point(s)

Your Point isn't enough.

Get point immediately by PayPal

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more point

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com

切换到中文版?

CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D