-
Notifications
You must be signed in to change notification settings - Fork 1
/
percobaan.php
52 lines (44 loc) · 1.51 KB
/
percobaan.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
require 'vendor/autoload.php';
use afrizalmy\FAHP\Base;
use afrizalmy\FAHP\Fahp;
$kriteria = ["Quality","Origin","Cost","Delivery","After Sales"];
$base = new Base();
// hitung bobot kriteria
$arr_kriteria = array();
for ($i=0; $i <= count($kriteria)-1 ; $i++) {
$gate = 0;
$tmpgate = $i + 1;
for ($j=$i; $j <= count($kriteria)-1; $j++) {
// printf($j);
$tmp_arr= array();
if ($gate != 0) {
if ($i > 0) {
// echo $i," | ",$tmpgate, " , ";
echo "Masukkan bobot kriteria index " ,$i," kolom ", $tmpgate, "\n";
for ($a=0; $a < 3; $a++) {
array_push($tmp_arr,trim(fgets(STDIN)));
}
$arr_kriteria[$i][$tmpgate] = json_encode($tmp_arr); //inputan
$tmpgate++;
} else {
echo "Masukkan bobot kriteria index " ,$i," kolom ", $gate, "\n";
for ($a=0; $a < 3; $a++) {
array_push($tmp_arr,trim(fgets(STDIN)));
}
$arr_kriteria[$i][$gate] = json_encode($tmp_arr); //inputan
}
}
$gate++;
unset($tmp_arr);
}
// printf("\n");
}
// var_dump($arr_kriteria);
$metriks = $base->buat_metric($kriteria, $arr_kriteria, json_encode([1,1,1]));
// var_dump($metriks);
$fuzzy = new Fahp();
$gm_kriteria = $fuzzy->HitungGeoMetricMean($fuzzy->FuzzyPairWise($metriks));
$bobot_kriteria = $fuzzy->FuzzyWeight($gm_kriteria);
var_dump($bobot_kriteria);
?>