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>';
     }
 }
 /**
  * Two phase aggregation if only expertise is enabled
  */
 private function crossWithHFWAoperator()
 {
     $aggregation = array();
     //Temporal array of data
     $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 experts weights for each criterion weight
             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);
                 //if ($this->debug) //echo " - W^E_C=" . $this->superE[$k][$j];
                 echo " [" . $this->data[$c][$inf] . "," . $this->data[$c][$sup] . "], ";
                 $criterionAssessment[$k] = array("inf" => $this->data[$c][$inf], "sup" => $this->data[$c][$sup]);
             }
             $aggregation[$i][$j] = toEnvelope(aggregationHLWA($criterionAssessment, $this->E, $this->G));
             $this->cSi[$i][$j] = $aggregation[$i][$j]['inf'];
             $this->cSj[$i][$j] = $aggregation[$i][$j]['sup'];
             if ($this->debug) {
                 echo " agg1=> [" . $this->cSi[$i][$j] . ", " . $this->cSj[$i][$j] . "]<br>";
             }
         }
     }
 }
Beispiel #3
0
 /**
 * Method of the classs MCDM that decides which operator should be used 
 * Input: data array of envelopes
 * Output: check boolean to decide if output is an hesitant resulting of aggregation or its envelope
 	//To Do: aggregationHLWA with array of hesitants as input
 	//To Do: aggregationMinMax with input hesitants and weights
 * Note: weight is not a param ... all methods use it for expert aggregation
 */
 public function aggregate($assessments, $toHesitant)
 {
     //if pesos expertos solo aggregationHLWA??
     //chequear cual es el array de pesos a usar.
     $aggOperator = elgg_get_plugin_setting('aggOperator', 'hflts');
     if ($aggOperator == 0) {
         //system_message(elgg_echo('hflts:aggOperator:minmax'));//does not consider weights
         if ($toHesitant) {
             $result = aggregationMinMaxToHesitant($assessments);
         } else {
             $result = aggregationMinMaxToEnvelope($assessments);
         }
     } else {
         //system_message(elgg_echo('hflts:aggOperator:HLWA'));//admits weights
         $result = aggregationHLWA($assessments, $this->E, $this->G);
         if (!$toHesitant) {
             $result = toEnvelope($result);
         }
     }
     return $result;
 }