Exemple #1
0
 /**
  * Compute F(H) for all assessment regarding criteria and alternatives 
  * Use this value to compute the dominance degree
  * It uses aggregationHFLWA($data, $weights, $granularity) from "Operators and Comparisons of Hesitant Fuzzy Linguistic Term Sets"
  */
 private function crossAlternativesWithCriteria()
 {
     $length = $delta = 0;
     $criterionScore = array();
     //score of assessment  of several experts about a single criterion. Temporal array
     $criterionAssessment = array();
     //what several experts say about a single criterion. Temporal array
     for ($i = 0; $i < $this->N; $i++) {
         for ($j = 0; $j < $this->M; $j++) {
             if ($this->debug) {
                 echo $this->data[$i * $this->P]["ref"] . " - C" . $j;
             }
             //Aggregate hesitants given from experts for each criterion and alternative
             //if we compute F for each hesitant the average F is <> from the score of aggregate hesitant
             //case: [5,5] F=5; [5,6] F=5.4375; [5,6] F=5.4375; [5,5] F=5; avgF=5.21875 vs avg hesitant = {5} and F_H=5
             for ($k = 0; $k < $this->P; $k++) {
                 $c = $i * $this->P + $k;
                 //index to get assessments - system_message("#".$c);
                 $inf = "L" . ($j + 1);
                 $sup = "U" . ($j + 1);
                 $criterionAssessment[$k] = array("inf" => $this->data[$c][$inf], "sup" => $this->data[$c][$sup]);
                 if ($this->debug) {
                     //echo " - E_" . $this->data[$c]['co_codigo'];
                     echo " [" . $this->data[$c][$inf] . "," . $this->data[$c][$sup] . "], ";
                 }
             }
             $avgH_Cj = parent::aggregate($criterionAssessment, true);
             //-..-..-..-..-..-..-..-..-..-..-..--..-..-..-..-..-..-..-..-..-..-..--..-..-..-..-..-..-..-..-..-..-..-
             $this->hesitants[$i][$j] = $avgH_Cj;
             //store the aggretate hesitant and compute its length and delta
             if ($this->hesitants[$i][$j] == -1) {
                 register_error("wrong hesitant in cross function ");
             }
             //echo('hesitant<pre>');	print_r($avgH_Cj);	echo('</pre><br>');
             $length = count($avgH_Cj);
             //number of terms in the hesitant
             $delta = deltaHesitant($avgH_Cj);
             $F_H = $this->scoreFunction($avgH_Cj, $length, $delta);
             if ($this->debug) {
                 echo " => L=" . $length . " d=" . $delta . " & F(avgH) = " . $F_H . "<br>";
             }
             $this->score[$i][$j] = $F_H;
             //store the score function of hte aggregate hesitant
         }
     }
     //check cases ((like with one expert assessment))
     for ($j = 0; $j < $this->M; $j++) {
         if ($this->debug) {
             echo "C" . ($j + 1);
         }
         for ($i = 0; $i < $this->N; $i++) {
             for ($k = 0; $k < $this->N; $k++) {
                 if ($i == $k) {
                     $this->dominance[$i][$k][$j] = 0;
                 } else {
                     if ($this->score[$i][$j] == $this->score[$k][$j]) {
                         $this->dominance[$i][$k][$j] = 0;
                     } else {
                         if ($this->score[$i][$j] > $this->score[$k][$j]) {
                             $this->dominance[$i][$k][$j] = $this->dominanceDegreeCaseOver($i, $j, $k);
                         } else {
                             $this->dominance[$i][$k][$j] = $this->dominanceDegreeCaseUnder($i, $j, $k);
                         }
                     }
                 }
                 if ($this->debug) {
                     $a = $i * $this->P;
                     $b = $k * $this->P;
                     echo " (" . $this->data[$a]["ref"] . "," . $this->data[$b]["ref"] . ") -> " . $this->dominance[$i][$k][$j];
                 }
             }
             if ($this->debug) {
                 echo "<br>&nbsp;&nbsp;&nbsp;";
             }
         }
         if ($this->debug) {
             echo "<br>";
         }
     }
 }
Exemple #2
0
 private function crossAlternativesWithCriteria()
 {
     $length = $delta = 0;
     $criterionScore = array();
     //score of assessment  of several experts about a single criterion. Temporal array
     $criterionAssessment = array();
     //what several experts say about a single criterion. Temporal array
     for ($i = 0; $i < $this->N; $i++) {
         for ($j = 0; $j < $this->M; $j++) {
             if ($this->debug) {
                 echo $this->data[$i * $this->P]["ref"] . " - C" . $j;
             }
             //Aggregate hesitants given from experts for each criterion and alternative
             for ($k = 0; $k < $this->P; $k++) {
                 $c = $i * $this->P + $k;
                 //index to get assessments - system_message("#".$c);
                 $inf = "L" . ($j + 1);
                 $sup = "U" . ($j + 1);
                 $criterionAssessment[$k] = array("inf" => $this->data[$c][$inf], "sup" => $this->data[$c][$sup]);
                 if ($this->debug) {
                     //" - E_" . $this->data[$c]['co_codigo']
                     echo " [" . $this->data[$c][$inf] . "," . $this->data[$c][$sup] . "], ";
                 }
             }
             $avgH_Cj = parent::aggregate($criterionAssessment, true);
             //-..-..-..-..-..-..-..-..-..-..-..--..-..-..-..-..-..-..-..-..-..-..--..-..-..-..-..-..-..-..-..-..-..-
             $this->hesitants[$j][$i] = $avgH_Cj;
             //store the aggretate hesitant and compute its length and delta
             if ($this->hesitants[$j][$i] == -1) {
                 register_error("wrong hesitant in cross function");
             }
             //echo('# aggregate: <pre>');	print_r($avgH_Cj);	echo('</pre>');
             $length = count($avgH_Cj);
             //number of terms in the hesitant
             $delta = deltaHesitant($avgH_Cj);
             //store the score function of the aggregate hesitant
             $this->score[$j][$i] = $delta;
             //similar to mean in statistics
             $this->variance[$j][$i] = $this->varianceFunction($avgH_Cj, $length);
             if ($this->debug) {
                 echo " => L=" . $length . " delta=score(avgH)=" . $delta . " & variance(avgH) = " . $this->variance[$j][$i] . "<br>";
             }
         }
     }
 }