134 lines
12 KiB
PHP
134 lines
12 KiB
PHP
<!DOCTYPE html>
|
|
<html>
|
|
<head><meta charset="utf-8"></head>
|
|
<body>
|
|
<table>
|
|
<!-- Header Info -->
|
|
<tr>
|
|
<td colspan="12" style="font-size: 14pt; font-weight: bold; color: #1E293B; height: 30px;">2. INISIALISASI POPULASI AWAL (GEN 0) & EVALUASI FITNESS</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="12" style="font-size: 10pt; color: #64748B;">Membangkitkan N=6 Individu secara acak dan mengukur total penalti B1 s/d B7 dengan rumus: Fitness = 1 / (1 + Total Penalti)</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="12" style="font-size: 9pt; color: #2563EB; font-weight: bold;">* Catatan Struktur Genetik: Urutan Gen dari kiri ke kanan berurutan untuk Kelas K01 s/d K10. Format tiap Gen: [G:Guru, R:Ruang, S:Sesi Jam, H:Hari]. ID Kelas tidak dijadikan atribut gen karena urutan posisi gen secara implisit merepresentasikan ID Kelas.</td>
|
|
</tr>
|
|
<tr><td colspan="12" style="height: 10px;"> </td></tr>
|
|
|
|
<!-- Table Header POPULASI -->
|
|
<thead>
|
|
<tr>
|
|
<th style="background-color: #1E293B; color: #FFFFFF; font-weight: bold; text-align: center; border: 1px solid #0F172A; width: 100px; height: 30px; vertical-align: middle;">No Individu</th>
|
|
<th style="background-color: #1E293B; color: #FFFFFF; font-weight: bold; text-align: center; border: 1px solid #0F172A; width: 110px; height: 30px; vertical-align: middle;">Nilai Fitness</th>
|
|
<th style="background-color: #1E293B; color: #FFFFFF; font-weight: bold; text-align: center; border: 1px solid #0F172A; width: 160px; height: 30px; vertical-align: middle;">Formula Excel Fitness</th>
|
|
<th style="background-color: #1E293B; color: #FFFFFF; font-weight: bold; text-align: center; border: 1px solid #0F172A; width: 100px; height: 30px; vertical-align: middle;">Total Penalti</th>
|
|
<th style="background-color: #991B1B; color: #FFFFFF; font-weight: bold; text-align: center; border: 1px solid #7F1D1D; width: 60px;">B1 (Guru)</th>
|
|
<th style="background-color: #991B1B; color: #FFFFFF; font-weight: bold; text-align: center; border: 1px solid #7F1D1D; width: 60px;">B2 (Ruang)</th>
|
|
<th style="background-color: #991B1B; color: #FFFFFF; font-weight: bold; text-align: center; border: 1px solid #7F1D1D; width: 60px;">B3 (Avail)</th>
|
|
<th style="background-color: #991B1B; color: #FFFFFF; font-weight: bold; text-align: center; border: 1px solid #7F1D1D; width: 60px;">B4 (Kelas)</th>
|
|
<th style="background-color: #991B1B; color: #FFFFFF; font-weight: bold; text-align: center; border: 1px solid #7F1D1D; width: 60px;">B5 (Level)</th>
|
|
<th style="background-color: #991B1B; color: #FFFFFF; font-weight: bold; text-align: center; border: 1px solid #7F1D1D; width: 60px;">B6 (Sebar)</th>
|
|
<th style="background-color: #991B1B; color: #FFFFFF; font-weight: bold; text-align: center; border: 1px solid #7F1D1D; width: 60px;">B7 (Kosts)</th>
|
|
<th style="background-color: #1E293B; color: #FFFFFF; font-weight: bold; text-align: left; border: 1px solid #0F172A; width: 500px;">Vektor Kromosom 10 Gen [G, R, S, H] (K01 s/d K10)</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach($sim['populasiAwal'] as $idx => $ind)
|
|
@php
|
|
$rowExcel = $idx + 6; // Baris ke-6 pada Excel
|
|
$isBest = $ind['fitness'] == 1.0;
|
|
$bgColor = $isBest ? '#DCFCE7' : '#FFFFFF';
|
|
$textColor = $isBest ? '#15803D' : '#1E293B';
|
|
|
|
$genesStr = [];
|
|
foreach($ind['genes'] as $gIdx => $g) {
|
|
$genesStr[] = "[G{$g['guru_id']},R{$g['ruang_id']},S{$g['sesi_id']},H{$g['hari_id']}]";
|
|
}
|
|
$geneText = implode(' ', $genesStr);
|
|
@endphp
|
|
<tr>
|
|
<td style="text-align: center; border: 1px solid #CBD5E1; font-weight: bold; background-color: {{ $bgColor }}; color: {{ $textColor }};">Individu [{{ $ind['index'] }}]</td>
|
|
<td style="text-align: center; border: 1px solid #CBD5E1; font-weight: bold; background-color: {{ $bgColor }}; color: {{ $textColor }};">{{ number_format($ind['fitness'], 4) }}</td>
|
|
<td style="text-align: center; border: 1px solid #CBD5E1; font-family: monospace; font-size: 9pt; background-color: #F8FAFC;">=1/(1+SUM(E{{ $rowExcel }}:K{{ $rowExcel }}))</td>
|
|
<td style="text-align: center; border: 1px solid #CBD5E1; font-weight: bold; color: {{ $ind['total_penalti'] > 0 ? '#DC2626' : '#166534' }};">{{ $ind['total_penalti'] }}</td>
|
|
<td style="text-align: center; border: 1px solid #CBD5E1; color: {{ $ind['b1'] > 0 ? '#DC2626' : '#94A3B8' }}; font-weight: bold;">{{ $ind['b1'] }}</td>
|
|
<td style="text-align: center; border: 1px solid #CBD5E1; color: {{ $ind['b2'] > 0 ? '#DC2626' : '#94A3B8' }}; font-weight: bold;">{{ $ind['b2'] }}</td>
|
|
<td style="text-align: center; border: 1px solid #CBD5E1; color: {{ $ind['b3'] > 0 ? '#DC2626' : '#94A3B8' }}; font-weight: bold;">{{ $ind['b3'] }}</td>
|
|
<td style="text-align: center; border: 1px solid #CBD5E1; color: {{ $ind['b4'] > 0 ? '#DC2626' : '#94A3B8' }}; font-weight: bold;">{{ $ind['b4'] }}</td>
|
|
<td style="text-align: center; border: 1px solid #CBD5E1; color: {{ $ind['b5'] > 0 ? '#DC2626' : '#94A3B8' }}; font-weight: bold;">{{ $ind['b5'] }}</td>
|
|
<td style="text-align: center; border: 1px solid #CBD5E1; color: {{ $ind['b6'] > 0 ? '#DC2626' : '#94A3B8' }}; font-weight: bold;">{{ $ind['b6'] }}</td>
|
|
<td style="text-align: center; border: 1px solid #CBD5E1; color: {{ $ind['b7'] > 0 ? '#DC2626' : '#94A3B8' }}; font-weight: bold;">{{ $ind['b7'] }}</td>
|
|
<td style="border: 1px solid #CBD5E1; font-family: monospace; font-size: 8.5pt;">{{ $geneText }}</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
<tr><td colspan="12" style="height: 20px;"> </td></tr>
|
|
|
|
<!-- DEKODE TRANSLASI JADWAL UTUH INDIVIDU 1 (SAMPEL VISUAL PENJELASAN PENGUJI) -->
|
|
<tr>
|
|
<td colspan="12" style="background-color: #1E293B; color: #FFFFFF; font-weight: bold; font-size: 11pt; height: 25px;">
|
|
SAMPLE TRANSLASI DEKODE JADWAL UTUH INDIVIDU [1] (REFERENSI PENJELASAN LENGKAP KROMOSOM GEN)
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="12" style="font-size: 9.5pt; color: #475569;">
|
|
Tabel di bawah memperjelas arti dari setiap kode gen [G, R, S, H] pada Individu 1 ke dalam teks bahasa Indonesia agar mudah dijelaskan tanpa harus bolak-balik melihat Sheet 1.
|
|
</td>
|
|
</tr>
|
|
<thead>
|
|
<tr>
|
|
<th style="background-color: #334155; color: #FFFFFF; font-weight: bold; text-align: center; border: 1px solid #0F172A; width: 60px;">Gen</th>
|
|
<th style="background-color: #334155; color: #FFFFFF; font-weight: bold; text-align: left; border: 1px solid #0F172A; width: 220px;">Nama Kelas Sampel</th>
|
|
<th style="background-color: #334155; color: #FFFFFF; font-weight: bold; text-align: center; border: 1px solid #0F172A; width: 110px;">Kode Gen</th>
|
|
<th style="background-color: #334155; color: #FFFFFF; font-weight: bold; text-align: left; border: 1px solid #0F172A; width: 180px;">Nama Pengajar (G)</th>
|
|
<th style="background-color: #334155; color: #FFFFFF; font-weight: bold; text-align: left; border: 1px solid #0F172A; width: 180px;">Alokasi Ruangan (R)</th>
|
|
<th style="background-color: #334155; color: #FFFFFF; font-weight: bold; text-align: left; border: 1px solid #0F172A; width: 180px;">Sesi Jam Operasional (S)</th>
|
|
<th style="background-color: #334155; color: #FFFFFF; font-weight: bold; text-align: center; border: 1px solid #0F172A; width: 110px;">Hari (H)</th>
|
|
<th style="background-color: #334155; color: #FFFFFF; font-weight: bold; text-align: left; border: 1px solid #0F172A; width: 250px;" colspan="5">Status Evaluasi Constraints (B1 - B7)</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@php
|
|
$decodedInd1 = [
|
|
['k' => 'K01', 'nama' => 'KD26 - Basic 1 (Robotics)', 'g' => 1, 'r' => 1, 's' => 1, 'h' => 1, 'status' => 'Melanggar B2 (Ruang bentrok dgn K02)'],
|
|
['k' => 'K02', 'nama' => 'PO1 - Scratch Beginner', 'g' => 2, 'r' => 1, 's' => 1, 'h' => 1, 'status' => 'Melanggar B2 (Ruang bentrok dgn K01)'],
|
|
['k' => 'K03', 'nama' => 'B26 (R1) - Basic 1 (Coding)', 'g' => 3, 'r' => 2, 's' => 2, 'h' => 2, 'status' => 'Melanggar B6 (Sebaran Hari < 2 hari dgn K04)'],
|
|
['k' => 'K04', 'nama' => 'B26 (R2) - Basic 1 (Coding)', 'g' => 3, 'r' => 2, 's' => 2, 'h' => 2, 'status' => 'Melanggar B6 (Sebaran Hari < 2 hari dgn K03)'],
|
|
['k' => 'K05', 'nama' => 'Ekskul SD Bintang Harapan', 'g' => 5, 'r' => 4, 's' => 1, 'h' => 5, 'status' => 'Normal / Terpenuhi (Fix Sekolah)'],
|
|
['k' => 'K06', 'nama' => 'A28 - Beginner 1 (Python)', 'g' => 4, 'r' => 3, 's' => 1, 'h' => 1, 'status' => 'Melanggar B3 (G4 tidak tersedia Senin Sesi 1)'],
|
|
['k' => 'K07', 'nama' => 'Ekskul TK Namira Probolinggo', 'g' => 1, 'r' => 5, 's' => 1, 'h' => 2, 'status' => 'Normal / Terpenuhi (Fix Sekolah)'],
|
|
['k' => 'K08', 'nama' => 'E26 (R1) - Beginner 4 (Arduino)', 'g' => 5, 'r' => 2, 's' => 1, 'h' => 1, 'status' => 'Normal / Terpenuhi'],
|
|
['k' => 'K09', 'nama' => 'E26 (R2) - Beginner 4 (Arduino)', 'g' => 5, 'r' => 2, 's' => 1, 'h' => 3, 'status' => 'Normal / Terpenuhi'],
|
|
['k' => 'K10', 'nama' => 'P1 - Beginner 2 (Robotics)', 'g' => 2, 'r' => 3, 's' => 2, 'h' => 3, 'status' => 'Normal / Terpenuhi'],
|
|
];
|
|
|
|
$guruMap = [1 => 'Ahmad Dandy (G1)', 2 => 'Agus Dwi Priyono (G2)', 3 => 'Putri Lailatul (G3)', 4 => 'Abdul Halim Al-Asrori (G4)', 5 => 'Vicko Effendy (G5)'];
|
|
$ruangMap = [1 => 'Lab Juara (R1)', 2 => 'Lab Cemerlang (R2)', 3 => 'Lab Gembita (R3)', 4 => 'SD Bintang Harapan (R4)', 5 => 'TK Namira (R5)'];
|
|
$sesiMap = [1 => 'Sesi 1 (08:00 - 10:00)', 2 => 'Sesi 2 (10:00 - 12:00)', 3 => 'Sesi 3 (13:00 - 15:00)', 4 => 'Sesi 4 (15:00 - 17:00)'];
|
|
$hariMap = [1 => 'Senin (H1)', 2 => 'Selasa (H2)', 3 => 'Rabu (H3)', 4 => 'Kamis (H4)', 5 => 'Jumat (H5)'];
|
|
@endphp
|
|
|
|
@foreach($decodedInd1 as $row)
|
|
@php
|
|
$isViolated = str_contains($row['status'], 'Melanggar');
|
|
@endphp
|
|
<tr>
|
|
<td style="text-align: center; border: 1px solid #E2E8F0; font-weight: bold;">{{ $row['k'] }}</td>
|
|
<td style="border: 1px solid #E2E8F0; font-weight: bold;">{{ $row['nama'] }}</td>
|
|
<td style="text-align: center; border: 1px solid #E2E8F0; font-family: monospace; font-weight: bold; background-color: #F8FAFC;">
|
|
[G{{ $row['g'] }},R{{ $row['r'] }},S{{ $row['s'] }},H{{ $row['h'] }}]
|
|
</td>
|
|
<td style="border: 1px solid #E2E8F0;">{{ $guruMap[$row['g']] }}</td>
|
|
<td style="border: 1px solid #E2E8F0;">{{ $ruangMap[$row['r']] }}</td>
|
|
<td style="border: 1px solid #E2E8F0;">{{ $sesiMap[$row['s']] }}</td>
|
|
<td style="text-align: center; border: 1px solid #E2E8F0; font-weight: bold;">{{ $hariMap[$row['h']] }}</td>
|
|
<td style="border: 1px solid #E2E8F0; font-weight: bold; color: {{ $isViolated ? '#DC2626' : '#166534' }}; background-color: {{ $isViolated ? '#FEE2E2' : '#F0FDF4' }};" colspan="5">
|
|
{{ $row['status'] }}
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</body>
|
|
</html>
|