Sprint 1 : scaffolding complet de Glibredecision
Plateforme de decisions collectives pour Duniter/G1. Backend FastAPI async + PostgreSQL (14 tables, 8 routers, 6 services, moteur de vote avec formule d'inertie WoT/Smith/TechComm). Frontend Nuxt 4 + Nuxt UI v3 + Pinia (9 pages, 5 stores). Infrastructure Docker + Woodpecker CI + Traefik. Documentation technique et utilisateur (15 fichiers). Seed : Licence G1, Engagement Forgeron v2.0.0, 4 protocoles de vote. 30 tests unitaires (formules, mode params, vote nuance) -- tous verts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
31
backend/app/engine/smith_threshold.py
Normal file
31
backend/app/engine/smith_threshold.py
Normal file
@@ -0,0 +1,31 @@
|
||||
"""Smith sub-WoT threshold criterion.
|
||||
|
||||
The Smith criterion requires a minimum number of votes from Smith members
|
||||
(forgerons) for certain decisions to be valid.
|
||||
|
||||
Formula: ceil(SmithWotSize ^ S)
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import math
|
||||
|
||||
|
||||
def smith_threshold(smith_wot_size: int, exponent: float = 0.1) -> int:
|
||||
"""Compute the minimum number of Smith member votes required.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
smith_wot_size:
|
||||
Number of active Smith members.
|
||||
exponent:
|
||||
S in the formula ``ceil(smith_wot_size^S)``.
|
||||
|
||||
Returns
|
||||
-------
|
||||
int
|
||||
Minimum Smith votes required.
|
||||
"""
|
||||
if smith_wot_size <= 0:
|
||||
raise ValueError("smith_wot_size doit etre strictement positif")
|
||||
return math.ceil(smith_wot_size ** exponent)
|
||||
Reference in New Issue
Block a user