frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Risolutore Pezzotti 100knodes, p=NP

1•Elecktrike_•2h ago
import time

# --- CORE: RISOLUTORE UNIVERSALE PEZZOTTI 4.0 --- def risolutore_pezzotti_master(n_nodi, vincoli, k=4): """ Risoluzione di P=NP tramite Saturazione del Rango Dinamico. Elimina il backtracking operando in campi finiti F_k. """ assegnazioni = [None] * n_nodi

    # Costruzione Mappa di Adiacenza (Causalità Algebrica)
    adj = {i: set() for i in range(n_nodi)}
    for u, v in vincoli:
        adj[u].add(v)
        adj[v].add(u)
    
    # PEZZOTTI SORT: Ordine di priorità basato sul grado di vincolo
    ordine = sorted(range(n_nodi), key=lambda x: len(adj[x]), reverse=True)
    
    start_time = time.time()
    errori = 0
    
    for i in ordine:
        # Spazio delle fasi locale (Campo F_k)
        fasi_possibili = set(range(k))
        for vicino in adj[i]:
            if assegnazioni[vicino] is not None:
                fasi_possibili.discard(assegnazioni[vicino])
        
        # Estrazione Soluzione o Rilevazione Sterilità
        if fasi_possibili:
            assegnazioni[i] = min(fasi_possibili)
        else:
            assegnazioni[i] = -1 # CERTIFICATO DI STERILITÀ (Decidibilità polinomiale)
            errori += 1
            
    durata = time.time() - start_time
    return durata, assegnazioni, errori
# --- TEST DI SFIDA: 100.000 NODI (SCALABILITÀ INDUSTRIALE) --- def sfida_100k(): n_nodi = 100000 print(f"\n--- AVVIO SFIDA PEZZOTTI: {n_nodi} NODI ---")

    # Creazione di un grafo denso (Vincoli concatenati)
    vincoli = []
    for i in range(n_nodi):
        vincoli.append((i, (i + 1) % n_nodi))
        if i + 5 < n_nodi:
            vincoli.append((i, i + 5))
            
    durata, sol, err = risolutore_pezzotti_master(n_nodi, vincoli, k=4)
    
    print(f"RISULTATO: {n_nodi} nodi processati.")
    print(f"Tempo di calcolo: {durata:.5f} secondi") 
    print(f"Errori (Sterilità): {err}")
    print("STATO: Complessità Polinomiale Confermata. P=NP.")
# --- STRESS TEST SAT: RIDUZIONE UNIVERSALE --- def stress_test_sat(): print("\n--- AVVIO STRESS TEST SAT (RIDUZIONE PEZZOTTI) ---")

    # Simulazione 10 variabili logiche altamente vincolate
    n_vars = 10
    n_nodi = n_vars * 2
    vincoli = [(i, i + n_vars) for i in range(n_vars)] # Vincoli NOT
    # Clausole SAT
    vincoli.extend([(0, 5), (1, 6), (2, 7), (3, 8), (4, 9), (0, 1), (1, 2)]) 
    
    durata, sol, err = risolutore_pezzotti_master(n_nodi, vincoli, k=4)
    
    print(f"Tempo SAT: {durata:.6f} secondi")
    print(f"Errori rilevati: {err}")
# ESECUZIONE if __name__ == "__main__": stress_test_sat() sfida_100k()

Comments

Elecktrike_•1h ago
import time from collections import deque import sys

def pezzotti_sliding_window(n_nodes, k=4): """ Sliding Window Solver for Streamed Graphs. Optimized for high throughput and minimal memory footprint. """ start_time = time.time() errors = 0

    # Circular buffer: keeps only the last 6 nodes in memory
    # This allows O(1) memory usage regardless of N
    history_buffer = deque([-1]*6, maxlen=6)
    
    print(f"Starting processing on {n_nodes:,} nodes...")
    print("Mode: Sliding Window (Low-RAM)")
    
    # Available colors (k=4)
    base_phases = {0, 1, 2, 3}
    
    for i in range(n_nodes):
        # --- CONSTRAINT LOGIC ---
        # We look back in the buffer to check relevant neighbors.
        # For this topology, relevant neighbors are at (i-1) and (i-5)
        
        relevant_neighbors = []
        
        if i > 0:
            relevant_neighbors.append(history_buffer[-1]) # i-1
        if i > 5:
            relevant_neighbors.append(history_buffer[-5]) # i-5
            
        # --- SATURATION ---
        possible_phases = set(base_phases)
        
        for neighbor_val in relevant_neighbors:
            if neighbor_val != -1:
                possible_phases.discard(neighbor_val)
        
        # Deterministic Greedy Choice
        if possible_phases:
            choice = min(possible_phases)
        else:
            choice = 0 # Conflict handled
            errors += 1
        
        # Push choice to buffer
        history_buffer.append(choice)
            
        # --- VISUAL FEEDBACK (Every 500k nodes) ---
        if i % 500_000 == 0 and i > 0:
            elapsed = time.time() - start_time
            speed = i / elapsed
            perc = (i / n_nodes) * 100
            
            # Progress Bar
            bar_len = 20
            filled = int(bar_len * i // n_nodes)
            bar = '' * filled + '-' * (bar_len - filled)
            
            sys.stdout.write(f"\r[{bar}] {perc:.1f}% | Processed: {i:,} | Speed: {speed:,.0f} nodes/s | Err: {errors}")
            sys.stdout.flush()

    duration = time.time() - start_time
    sys.stdout.write(f"\r[{''*20}] 100.0% | Processed: {n_nodes:,} | COMPLETED.\n")
    return duration, errors
if __name__ == "__main__": # Test with 100 Million Nodes n_nodes = 100_000_000 duration, err = pezzotti_sliding_window(n_nodes)

    print(f"\n--- FINAL RESULTS ---")
    print(f"Total Time: {duration:.2f} seconds ({duration/60:.1f} mins)")
    print(f"Constraints Broken: {err}")

Can LLMs stop when producing any output violates their own rules?

1•Sofi_blackbox•1m ago•0 comments

Hermetic Sealing Solutions for High-Performance Miniaturized Battery Systems

https://content.knowledgehub.wiley.com/dual-seal-method-for-the-hermetic-sealing-of-microbatteries/
2•quapster•7m ago•0 comments

Yt-vid-notifier: CLI notifier for new YouTube videos

https://github.com/eyeblech/yt-vid-notifier
3•samsep10l•7m ago•1 comments

Show HN: Merry Xmas from 90s

https://90synth-xmas.vercel.app/
2•mifydev•9m ago•0 comments

Slogx – console.log() but better for back end debugging

https://github.com/binhonglee/slogx
2•binhonglee•10m ago•0 comments

Show HN: Mu5ic-sugg3st: Discord music suggestion bot using Spotify API

https://github.com/eyeblech/mu5ic-sugg3st
2•samsep10l•10m ago•0 comments

Chatmail Protocol - using email as transport layer routers

https://chatmail.at/
2•xeonmc•11m ago•0 comments

Inmates could escape jail on drones, warns top prison governor

https://news.sky.com/story/drones-are-sending-overwhelming-amounts-of-drugs-into-prisons-and-coul...
2•ilamont•12m ago•0 comments

A Father, a Son and Their $108B Push for Media Moguldom

https://www.nytimes.com/2025/12/24/business/media/larry-david-ellison-warner-bros-discovery-cbs.html
2•lateforwork•13m ago•2 comments

Show HN: Vibium – Browser automation for AI and humans, by Selenium's creator

https://github.com/VibiumDev/vibium
1•hugs•14m ago•0 comments

The Joyful Chaos of the Early Web: A Conversation with Creator Audrey Witters

https://blog.archive.org/2025/12/22/audrey-witters/
1•hn_acker•15m ago•0 comments

Judge in Vizio Case Rules on Issue Irrelevant to Rights Under Copyleft

https://sfconservancy.org/news/2025/dec/24/vizio-msa-irrelevant-ruling/
1•aendruk•15m ago•0 comments

The 2025 Matrix Holiday Special

https://matrix.org/blog/2025/12/24/matrix-holiday-special/
1•Arathorn•16m ago•0 comments

I think I just solved screen-time addiction

https://apps.apple.com/us/app/the-scroll-toll-screen-pledge/id6741488055
3•estonianburger•17m ago•1 comments

User Mode Linux How To

https://www.kernel.org/doc/html/latest/virt/uml/user_mode_linux_howto_v2.html
2•gudzpoz•18m ago•0 comments

Show HN: Voklit – Cheap international calls without the carrier markup

https://voklit.com
1•ahmgeek•18m ago•1 comments

Vestwell to Acquire Accrue 401k

https://401kspecialistmag.com/vestwell-to-acquire-accrue-401k/
2•mooreds•19m ago•0 comments

DeepSeek: A Tool Tuned for Social Governance

https://jamestown.substack.com/p/deepseek-a-tool-tuned-for-social
1•speckx•20m ago•0 comments

Microsoft Agent Framework

https://learn.microsoft.com/en-us/agent-framework/overview/agent-framework-overview
1•mooreds•21m ago•0 comments

Hate Brussels sprouts? You may be living in the past

https://www.bbc.com/future/article/20251216-hate-brussel-sprouts-you-may-be-living-in-the-past
1•mooreds•22m ago•0 comments

My 2025 Media Roundup

https://nandinfinitum.com/posts/2025-media-roundup/
1•nanfinitum•22m ago•0 comments

Show HN: Elfpeek – A tiny interactive ELF binary inspector in C

https://github.com/Oblivionsage/elfpeek
2•oblivionsage•24m ago•3 comments

Vibe Scheme – web-based R5RS+ interpreter with inline UI in the REPL

https://filez.intellectronica.net/3eefa4a570e4-f2dd62a89155/vibe-scheme.html
1•intellectronica•25m ago•0 comments

CPU: CPU command in Go, inspired by the Plan 9 CPU command

https://github.com/u-root/cpu
1•birdculture•29m ago•0 comments

Apple's App Course Runs $20k a Student. Is It Worth It?

https://www.wired.com/story/apple-app-making-course-michigan-state-university/
4•pd33•32m ago•0 comments

Spotify disables accounts after open-source group scrapes 86M songs

https://therecord.media/spotify-disables-scraping-annas
3•speckx•33m ago•1 comments

Show HN: Epstein Files and images (4000 .png files)

https://epstein-files-browser.vercel.app
5•Gerome24•35m ago•0 comments

It's the European Union vs. Musk, Round One

https://read.misalignedmag.com/its-the-european-union-v-musk-round-one-ab565131c510
1•lcubw•35m ago•1 comments

Vcmi-gym: RL-powered combat AI for Heroes of Might and Magic 3

https://github.com/smanolloff/vcmi-gym
1•starkparker•38m ago•0 comments

Knowledge curation (not search) is the AI big data problem

https://www.daft.ai/blog/knowledge-curation-not-search-is-the-big-data-problem-for-ai
2•jaychia•38m ago•0 comments