/** * Plugin: Valoraciones linguisticas con HFLTS * Author: Rosana Montes Soldado * Universidad de Granada * Licence: CC-ByNCSA * Reference: HFLTS in a ELGG community: Teranga Go! CEI BioTIC project * Project coordinator: @rosanamontes * Website: http://lsi.ugr.es/rosana * Date: july 2016 * * File: Export data to LaTeX */ function set2latex($data, $sample_term, $M) { //echo($sample_term . '<br>Dt from .csv <pre>'); print_r($data); echo('</pre><hr>'); //ref,co_codigo,U1,L1,U2,L2,U3,L3,U4,L4,U5,L5,U6,L6,U7,L7,U8,L8,U9,L9 $n = count($data); $output = table_header($M + 2, 2); $length = $delta = 0; for ($z = 0; $z < $n; $z++) { //for each line line for ($x = -1; $x < $M; $x++) { if ($x < 0) { $output .= "\\begin{scriptsize}\$" . $data[$z]['ref'] . "\$\\end{scriptsize} & "; $output .= "\\begin{scriptsize}\$TC_{" . $data[$z]['co_codigo'] . "}\$\\end{scriptsize} "; } else { $inf = "L" . ($x + 1); $sup = "U" . ($x + 1); $envelope = array("inf" => $data[$z][$inf], "sup" => $data[$z][$sup]); //If output is an interval $rangeTxt = "[ {$s_}" . $envelope['inf'] . "\$, {$s_}" . $envelope['sup'] . "\$ ]"; //If output is a hesitant $h = toHesitant($envelope, $length, $delta); $hTxt = "\$\\{"; for ($i = 0; $i < $length; $i++) { $hTxt .= "s_" . $h[$i]; if ($i == $length - 1) { $hTxt .= "\\}\$"; } else { $hTxt .= ", "; } } //now choose.... //$output .= $rangeTxt; $output .= $hTxt; } if ($x < $M - 1) { $output .= " & "; } else { $output .= "\\\\ <br>"; } } } $output .= table_footer("{$sample_term} data set", $sample_term); echo $output . "<hr>"; }
private function testing() { /* * Example 1 in paper */ $envelopes = array(['inf' => 3, 'sup' => 3], ['inf' => 3, 'sup' => 4], ['inf' => 1, 'sup' => 6]); //$envelopes = array(['inf'=>2, 'sup'=>4],['inf'=>0,'sup'=>1],['inf'=>0,'sup'=>2],['inf'=>2,'sup'=>5]); $n = sizeof($envelopes); //system_message("n " . $n); $hesitants = array(); $lengths = array(); $deltas = array(); for ($i = 0; $i < $n; $i++) { echo "[" . $envelopes[$i]['inf'] . "," . $envelopes[$i]['sup'] . "] "; $hesitants[$i] = toHesitant($envelopes[$i], $lengths[$i], $deltas[$i]); if ($hesitants[$i] != -1) { echo "score=" . $this->scoreFunction($hesitants[$i], $lengths[$i], $deltas[$i]) . "<br>"; } } /* * test intervalDominance. * Example 2 in the paper */ $is1 = intervalDominance($envelopes[1]['inf'], $envelopes[1]['sup'], $envelopes[0]['inf'], $envelopes[0]['sup']); //must be 1 $is1ov2 = intervalDominance($envelopes[1]['inf'], $envelopes[1]['sup'], $envelopes[2]['inf'], $envelopes[2]['sup']); //must be 0.5 $is3ov5 = intervalDominance($envelopes[2]['inf'], $envelopes[2]['sup'], $envelopes[0]['inf'], $envelopes[0]['sup']); //must be 0.6 if ($this->debug) { echo "intervalDominance " . $is1 . " " . $is1ov2 . " " . $is3ov5 . "<br>"; } }
function aggregationMinMaxToHesitant($data) { $maxH = maximumEnvelope($data); $minH = minimumEnvelope($data); $a = $minH['sup']; $b = $maxH['inf']; $E['inf'] = min($a, $b); $E['sup'] = max($a, $b); //echo('<hr>aggregationMinMax<pre>'); print_r($E); echo('</pre>'); return toHesitant($E); }
private function testing() { /* * Example 1 in paper */ $envelopes = array(['inf' => 1, 'sup' => 1], ['inf' => -3, 'sup' => 0], ['inf' => 1, 'sup' => 3], ['inf' => 0, 'sup' => 2]); $n = sizeof($envelopes); //system_message("n " . $n); $hesitants = array(); $lengths = array(); $deltas = array(); for ($i = 0; $i < $n; $i++) { echo "[" . $envelopes[$i]['inf'] . "," . $envelopes[$i]['sup'] . "] "; $hesitants[$i] = toHesitant($envelopes[$i], $lengths[$i], $deltas[$i]); if ($hesitants[$i] != -1) { $V = $this->varianceFunction($hesitants[$i], $lengths[$i]); echo "score=" . $deltas[$i] . " variance=" . $V . "<br>"; } } }
private function testing() { /* * Example 1 and 4 in paper */ $envelopes = array(['inf' => 3, 'sup' => 3], ['inf' => 2, 'sup' => 3], ['inf' => 3, 'sup' => 5], ['inf' => 4, 'sup' => 5]); $n = sizeof($envelopes); //system_message("n " . $n); $hesitants = array(); $lengths = array(); $deltas = array(); for ($i = 0; $i < $n; $i++) { $hesitants[$i] = toHesitant($envelopes[$i], $lengths[$i], $deltas[$i]); if ($hesitants[$i] == -1) { echo "stop here!<br>"; } } for ($i = 0; $i < $n; $i++) { for ($j = 0; $j < $n; $j++) { if ($i != $j) { //distanceEnvelope($envelopes[$i],$envelopes[$j]); //r(H,H) = sum p() / #h * #h $R = $this->binaryRelation($hesitants[$i], $hesitants[$j], $lengths[$i], $lengths[$j]); $R /= $lengths[$i] * $lengths[$j]; echo "r(" . ($i + 1) . "," . ($j + 1) . ") = " . $R . "<br>"; } } } }