Skip to content
Snippets Groups Projects
Select Git revision
  • 036d0a2fa21b2ee60e7d01fb9d31312964e9ad5e
  • master default protected
  • 6.x
  • php84
  • ll-api-test
  • release_6.2.0
  • modif_maintenance_phtml
  • 6.0.x
  • detached2
  • detached
  • php82
  • feature_SearchAndSelectFilter
  • 5.x
  • 4.x
  • 6.3.0
  • 6.2.1
  • 7.2.1
  • 7.2.0
  • 6.2.0
  • 7.1.0
  • 7.0.0
  • 1.1.1
  • 6.1.7
  • 6.1.6
  • 6.1.5
  • 6.0.16
  • 6.0.15
  • 6.1.4
  • 6.0.14
  • 6.1.3
  • 6.0.13
  • 6.1.2
  • 6.0.12
  • 6.1.1
34 results

Module.php

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    test5.php 2.95 KiB
    <?php
    
    /**
     * @var $this       \Application\View\Renderer\PhpRenderer
     * @var $controller \Zend\Mvc\Controller\AbstractController
     * @var $viewName   string
     * @var $sl         \Zend\ServiceManager\ServiceLocatorInterface
     */
    
    $effectifs = 100;
    $cmin      = [0, 4];
    $cmax      = [0, 4];
    
    //$cmin      = [2,2];
    //$cmax      = [2,2];
    
    $noeuds = [
        1,
        5,
        2,
        8,
    ];
    
    /*$noeuds = [
        1,
        1,
        3
    ];*/
    
    $totalPoids = array_sum($noeuds);
    $nbChoix    = count($noeuds);
    $maxPoids = 0;
    foreach( $noeuds as $poids){
        if ($poids > $maxPoids) $maxPoids = $poids;
    }
    
    
    function calc($choixMin, $choixMax, $poids, $maxPoids, $totalPoids, $nbChoix)
    {
        $coefChoix = ($choixMin + $choixMax) / 2 / $nbChoix;
    
        $coefPoids = $poids / $totalPoids;
    
        $maxCoefPoids = $maxPoids / $totalPoids;
    
        $resMax = $coefChoix * $maxCoefPoids * $nbChoix;
        if (($resMax) <= 1){
            return 0;
            return $coefChoix * $coefPoids * $nbChoix;
        }else{
    //        $res = $coefChoix * $nbChoix * ($coefPoids+(((1/$nbChoix)-$coefPoids)*0));
    //        $resMax = $coefChoix * $nbChoix * $maxCoefPoids;
    
            $delta = $resMax;
            return $delta;
            $res = $coefChoix;
    
            //$res = 1 / (($coefChoix * $nbChoix * $coefPoids) - 1);
    //return $res;
            $correcteur = $res;
            $res = $coefChoix * $nbChoix * ($coefPoids+(((1/$nbChoix)-$coefPoids)*$correcteur));
    
    
    
            return $res;
        }
    }
    //var_dump(calc(3,3,3,3,5,3));
    
    echo "Effectifs = " . $effectifs . '<br />';