import '@fontsource-variable/jetbrains-mono/index.css' import '@fontsource-variable/open-sans/index.css' import { render } from 'preact' import { useState } from 'preact/hooks' import { parseSafeProblemInput } from './parser-problem' import { DisplayProblemInput } from './DisplayProblemInput' import { Primal } from './Primal' import exampleProblems from './example-problems.json' const INITIAL_PROBLEM_INPUT = ` c' = 500 200; A = 1 0 0 1 2 1 -1 0 0 -1; b = 4 7 9 0 0; B = 2 3; `.trim() const useLocalStorage = (key: string, initialValue: T) => { const [value, setValue] = useState(() => { const item = window.localStorage.getItem(key) return item ? JSON.parse(item) : initialValue }) const setItem = (newValue: T) => { setValue(newValue) window.localStorage.setItem(key, JSON.stringify(newValue)) } return [value, setItem] as const } const App = () => { const [currentProblemName, setCurrentProblemName] = useLocalStorage( 'ricerca-operativa.currentProblemName', 'Pintel' ) const [savedProblems, setSavedProblems] = useLocalStorage<{ name: string; source: string }[]>( 'ricerca-operativa.savedProblems', exampleProblems ) const [problemInput, setProblemInput] = useState( savedProblems.find(p => p.name === currentProblemName)?.source ?? INITIAL_PROBLEM_INPUT ) const problemValuesResult = parseSafeProblemInput(problemInput) return ( <>

Ricerca Operativa / PL / Algoritmo del Simplesso {' '} by @aziis98

Questo sito è un progetto per il{' '} corso di Ricerca Operativa{' '} dell'Università di Pisa per visualizzare automaticamente tutti i passaggi dell' algoritmo del simplesso primale.

Visualizzazione

I dati del problema vanno inseriti nel seguente campo di testo nel formato:

{ const name = e.currentTarget.value setCurrentProblemName(name) }} value={currentProblemName} />

Problema di Input

{'result' in problemValuesResult ? ( ) : (

{problemValuesResult.error}

)} {'result' in problemValuesResult && } ) } render(, document.body)