Problem with skyline (checking dominance) wish can hear from u guys soon.TQ

  1. Problem: i need to use function boolean run through an algorithm to check the dominance of array $ds, and sort the point base on it dominancy. Note: the algorithm below is given by my profesor.

  2. Example= given a set of array like below $ds, i wish to sort the points based on it dominancy after running through the alogorithm in boolean function below.

  3. Note: Points = one of the array rows = array(1,11,5) //juz an example to tell wat i mean by points.

  4. i have been thinking for so long on how to perform this task. My profesor said it is juz a simple task.

<?php function A(){ $ds = array( array(1,11,5), array(2,6,7), array(3,13,9), array(12,7,16), array(14,3,25), array(19,18,22), array(23,13,29), array(24,4,28) ); return $ds; } function boolean(){ $ds=A(); $p=$ds[1]; $d = 3; $n =8; for($i = 0; $i < $n; $i++){ if ($ds[$i]!= $p){ $it=0; $eq=0; for($j = 0; $j < $d; $j++){ if($ds[$i][$j]<$p[$j]){ $it++; } elseif($ds[$i][$j]==$p[$j]){ $eq++; } } if(($it+$eq==$d)&&($it>0)){ return false; } } } return true; } if ( boolean == true) { echo "
print_r ($p[$j]);
else {
echo 'Something has defiantly gone wrong...';

So what is your question? You want someone here to solve the task what your professor gave you?

yup u right :slight_smile: …well is time too start my work!

Sponsor our Newsletter | Privacy Policy | Terms of Service