Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Generate progressive warm-up schedule.
- *
- * @param int $targetVolumePerIp Total email per IP selama masa warm-up
- * @param int $days Jumlah hari warm-up (default: 14)
- * @return array Volume harian (progressive)
- */
- function generateProgressiveWarmupSchedule(int $targetVolumePerIp, int $days = 14): array
- {
- // Distribusi bobot eksponensial per hari (misalnya pangkat 1.5)
- $weights = [];
- $sumWeights = 0;
- for ($i = 1; $i <= $days; $i++) {
- $weight = pow($i, 1.5); // makin ke akhir makin besar
- $weights[] = $weight;
- $sumWeights += $weight;
- }
- // Hitung volume per hari berdasarkan proporsi bobot
- $schedule = [];
- $accumulated = 0;
- for ($i = 0; $i < $days; $i++) {
- $volume = floor(($weights[$i] / $sumWeights) * $targetVolumePerIp);
- $schedule[] = $volume;
- $accumulated += $volume;
- }
- // Distribusi sisa (akibat pembulatan) ke hari-hari akhir
- $remainder = $targetVolumePerIp - $accumulated;
- for ($i = $days - 1; $i >= 0 && $remainder > 0; $i--) {
- $schedule[$i]++;
- $remainder--;
- }
- return $schedule;
- }
Advertisement
Add Comment
Please, Sign In to add comment