Gracias
Using perl Syntax Highlighting
- $ga->( [ [ 100, 200 ], [ 100, 200 ], [ 4, 14 ], [ 8, 14 ] ] );
- my $genes = $_[0];
- my $x1 = $genes->[0] / 10;
- my $x2 = $genes->[1] / 10;
- my $x3 = $genes->[2];
- my $x4 = $genes->[3];
- @variables = ( $x1, $x2, $x3, $x4 );
- my $mayor = 0;
- my $n = 68;
- for ( $i = 0; $i <= 3; $i++ ) {
- if ( $variables[0] + $variables[1] + $variables[2] + $variables[3] == 68 ) {
- $mayor = $n;
- }
- }
- my $menor = 0;
- $m = 36;
- for ( $i = 0; $i <= 3; $i++ ) {
- if ( $variables[0] + $variables[1] + $variables[2] + $variables[3] == 36 ) {
- $menor = $m;
- }
- }
Coloreado en 0.002 segundos, usando GeSHi 1.0.8.4