public function run()
 {
     parent::run();
     $this->debug = true;
     if ($this->debug) {
         system_message($this->N . " x " . $this->M . " x " . $this->P);
         echo '<br>superE <pre>';
         print_r($this->superE);
         echo '</pre>';
         echo '<br>E <pre>';
         print_r($this->E);
         echo '</pre>';
         echo '<br>W <pre>';
         print_r($this->W);
         echo '</pre>';
     }
     //Get the scenario  .-..-..-..-..-..-..-..-..-..-..-..-..-..-..-..-..-..-..-..-..-..-..-..-
     if (elgg_get_plugin_setting('weight_experts', 'hflts') == 1) {
         if (elgg_get_plugin_setting('weight_assessments', 'hflts') == 1) {
             system_message("Scenario 3: double subjectivity (E, superE) => 2-tuple extendend weighted mean in two phases");
             $this->crossAlternativesWithCriteria();
         } else {
             system_message("Scenario 2: DM with expertise (E) ignore (superE, W=1) => HFWA operator + extended mean");
             $this->crossWithHFWAoperator();
             $this->aggregation2();
         }
     } else {
         if (elgg_get_plugin_setting('weight_assessments', 'hflts') == 0) {
             system_message("Scenario 1: ignore (E, superE) W=1 => minmax operator + extended mean");
         } else {
             system_message("Scenario 4: ignore (E, superE) aggregate W => minmax + extended mean");
         }
         $this->translation();
         $this->aggregation2();
     }
     //..-..-..-..-..-..-..-..-..-..-..-..-..-..-..-..-..-..-..-..-..-..-..-..-..-..-
     $this->average();
     $this->ranking();
     return $this->ranking[0]['average']['label'];
 }
示例#2
0
 /**
  * Gather all assessment regarding criteria and alternatives 
  * It uses aggregationMinMax($data) from the same paper
  */
 private function crossAlternativesWithCriteria()
 {
     $length = $delta = 0;
     $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 + 1);
             }
             //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) {
                     //echo " - E_" . $this->data[$c]['co_codigo'];
                     echo " [" . $this->data[$c][$inf] . "," . $this->data[$c][$sup] . "], ";
                 }
             }
             $avgE_Cj = parent::aggregate($criterionAssessment, false);
             //-..-..-..-..-..-..-..-..-..-..-..--..-..-..-..-..-..-..-..-..-..-..--..-..-..-..-..-..-..-..-..-..-..-
             $this->envelopes[$i][$j] = $avgE_Cj;
             //store the aggretate linguistic interval as alternative x criteria
             if ($this->debug) {
                 echo " => [" . $avgE_Cj['inf'] . ", " . $avgE_Cj['sup'] . "]<br>";
             }
         }
     }
 }
示例#3
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>";
         }
     }
 }
示例#4
0
 public function run()
 {
     parent::run();
     //method not implemented
     return $this->ranking[0]['promethee']['label'];
 }
示例#5
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>";
             }
         }
     }
 }
示例#6
0
 private function crossAlternativesWithCriteria()
 {
     $envelope = array();
     $length = array();
     $delta = 0.0;
     $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 + 1;
             }
             //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) {
                     //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");
             }
             //temporarly store the length
             $length[$i][$j] = count($avgH_Cj);
             //number of terms in the hesitant
             //temporarly store the envelope
             $envelope[$i][$j] = toEnvelope($avgH_Cj);
             if ($this->debug) {
                 echo " = [" . $envelope[$i][$j]['inf'] . "," . $envelope[$i][$j]['sup'] . "]<br>";
             }
         }
     }
     $cc = 0;
     //case count
     for ($i = 0; $i < $this->N; $i++) {
         for ($k = $i; $k < $this->N; $k++) {
             if ($i != $k) {
                 for ($j = 0; $j < $this->M; $j++) {
                     $this->W_distance[$i][$k][$j] = distanceEnvelope($envelope[$i][$j], $envelope[$k][$j]) * $this->W[$j];
                     $len = $length[$i][$j] * $length[$k][$j];
                     $this->outrank[$i][$k][$j] = $this->binaryRelation($this->hesitants[$i][$j], $this->hesitants[$k][$j], $length[$i][$j], $length[$k][$j]) / $len;
                     $this->outrank[$k][$i][$j] = $this->binaryRelation($this->hesitants[$k][$j], $this->hesitants[$i][$j], $length[$k][$j], $length[$i][$j]) / $len;
                     if ($this->debug) {
                         echo "C" . ($j + 1) . " (" . ($i + 1) . "," . ($k + 1) . ") W_j=" . $this->W[$j];
                         echo " W_d=" . $this->W_distance[$i][$k][$j] . " Conc_r=" . $this->outrank[$i][$k][$j] . " Dis_r=" . $this->outrank[$k][$i][$j] . "<br>";
                         if ($this->outrank[$i][$k][$j] == 1.0) {
                             echo "C_S in " . ($j + 1) . "<br>";
                         } else {
                             if ($this->outrank[$i][$k][$j] >= 0.5) {
                                 echo "C_W in " . ($j + 1) . "<br>";
                             }
                         }
                         if ($this->outrank[$k][$i][$j] == 1.0) {
                             echo "D_S in " . ($j + 1) . "<br>";
                         } else {
                             if ($this->outrank[$k][$i][$j] >= 0.5) {
                                 echo "D_W in " . ($j + 1) . "<br>";
                             }
                         }
                     }
                     //concordance indices
                     if ($this->outrank[$i][$k][$j] == 1.0) {
                         $this->strong[$i][$k][$j] = $j;
                         $this->weak[$i][$k][$j] = -1;
                     } else {
                         $this->strong[$i][$k][$j] = -1;
                         if ($this->outrank[$i][$k][$j] >= 0.5) {
                             $this->weak[$i][$k][$j] = $j;
                         } else {
                             $this->weak[$i][$k][$j] = -1;
                         }
                     }
                     //discordance indices
                     if ($this->outrank[$k][$i][$j] == 1.0) {
                         $this->strong[$k][$i][$j] = $j;
                         $this->weak[$k][$i][$j] = -1;
                     } else {
                         $this->strong[$k][$i][$j] = -1;
                         if ($this->outrank[$k][$i][$j] >= 0.5) {
                             $this->weak[$k][$i][$j] = $j;
                         } else {
                             $this->weak[$k][$i][$j] = -1;
                         }
                     }
                 }
                 $this->maxWD[$cc] = max($this->W_distance[$i][$k]);
                 if ($this->debug) {
                     echo $cc . "# max  " . $this->maxWD[$cc] . "<br>";
                 }
                 $cc++;
                 //case count
             }
         }
     }
     if ($this->debug) {
         echo 'strong indices: <pre>';
         print_r($this->strong);
         echo '</pre><br>';
         echo 'weak indices: <pre>';
         print_r($this->weak);
         echo '</pre><br>';
     }
 }