# On calcule la rponse tout seul lorsque l'tudiant abandonne

# On effectue les diffrentes tapes. 

  S=1
  pi=0
  !for j=2 to $n
    L=!line 1 of $GM
    u=!item $j of $L
    !if $u=0
      pi=$pi,\infty
    !else
      pi=$pi,$u
    !endif
  !next j
  cor=($S), ($pi)
!for i=2 to $n
# 1. On trouve un sommet satisfaisant
  x=$[($bp+1)*$n]
  y=0
  z=0
  !for j=2 to $n
    u=!item $j of $pi
    !if $u notsametext \infty
      !if ($j notin $S) and ($u<$x)
        x=$u
        y=$j
      !endif
    !else
      !if ($j notin $S) and ($z=0)
        z=$j
      !endif
    !endif
  !next j
  !if $y<>0
    sommet=$y
  !else
    sommet=$z
  !endif
  S=$S,$sommet
# 2. On modifie le vecteur pi
  !for j=2 to $n
    u=!item $j of $pi
    v=!item $sommet of $pi
    L=!line $sommet of $GM
    w=!item $j of $L
    y=0
    !if $v notsametext \infty
      !if $u notsametext \infty
        x=$[min($u,$[$v+$w])]
        !if ($w<>0) and ($j notin $S)
          y=1
        !endif
      !else
        x=$[$v+$w]
        !if ($w<>0) and ($j notin $S)
          y=1
        !endif
      !endif
      !if $y=1
        pi=!replace item number $j by $x in $pi
      !endif
    !endif
  !next j
  cor=$cor, ($S), ($pi)
!next i
!if $parm_aband=0
module_score=0
!else
module_score= $[ceil(10*max(-2*($n_essai-$etp+1)/$etp+($etp-1)/$n,0))/10]
!endif
status=done
