translated everything to english

main
parent 488c796122
commit 3aec36d0c0

@ -1,28 +1,18 @@
# Ricerca Operativa / PL / Algoritmo del Simplesso
# Operations Research / Linear Programming / Simplex Algorithm
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.
This website is a project for the course of Operations Research of the
University of Pisa to automatically visualize automatically all steps of the
primal simplex algorithm.
## Caratteristiche principali
## Features
- Visualizza automaticamente tutti i passaggi dell'algoritmo del simplesso primale
- Automatically visualize all steps of the primal simplex algorithm
- Gestisce problemi d ricerca operativa in formato matriciale
- Save and load problems
- Permette il salvataggio e il caricamento di problemi
- Preact as frontend framework
- Utilizza Preact per una interfaccia interattiva
## Funzionamento
1. Inserisci i dati del problema nel campo di testo nel formato specificato
2. Il sistema analizza l'input mostra il risultato dell'algoritmo con tutti i passaggi algebrici
dell'algoritmo con una visualizzazione geometrica dello stato corrente
3. Puoi salvare i problemi inseriti e caricarli in seguito
## Svilluppo
## Development
### Setup
@ -42,7 +32,8 @@ bun dev
### Build
Use this command to build the project and serve the files from the `dist/` directory.
Use this command to build the project and serve the files from the `dist/`
directory.
```bash
bun run build

@ -10,14 +10,14 @@
<link rel="manifest" href="/site.webmanifest" />
<meta property="og:type" content="website" />
<meta property="og:site_name" content="Ricerca Operativa / PL / Algoritmo del Simplesso" />
<meta property="og:title" content="Ricerca Operativa / PL / Algoritmo del Simplesso" />
<meta property="og:description" content="Visualizzazione dell'algoritmo del simplesso per la programmazione lineare" />
<meta property="og:site_name" content="Simplex Algorithm | LP | Operations Research" />
<meta property="og:title" content="Simplex Algorithm | LP | Operations Research" />
<meta property="og:description" content="A tool to visualize the simplex algorithm for linear programming" />
<meta property="og:url" content="https://ricerca-operativa.lab.aziis98.com" />
<link rel="stylesheet" href="./src/style.css" />
<title>Algoritmo del Simplesso | PL | Ricerca Operativa</title>
<title>Simplex Algorithm | LP | Operations Research</title>
</head>
<body>
<script type="module" src="./src/main.tsx"></script>

@ -53,7 +53,7 @@ const PrimalStep = ({
<div class="algebraic-step">
<div class="comment">
<p>
Iterazione <strong>{iter + 1}</strong> dell'algoritmo
Iteration <strong>{iter + 1}</strong> of the algorithm
</p>
</div>
@ -105,7 +105,7 @@ export const Primal = ({ input }: { input: ProblemInput }) => {
{problemOutput ? (
<>
<div class="title">
<h2>Svolgimento</h2>
<h2>Visualization</h2>
</div>
{problemOutput.steps.map((step, iter) => (
<PrimalStep

@ -128,15 +128,15 @@ export function computePrimalSimplexSteps(input: ProblemInput): ProblemOutput {
comments.push({
type: 'text',
content: `La soluzione primale è *${isAdmissible ? 'ammissibile' : 'non ammissibile'}* e *${
isDegenerate ? 'degenere' : 'non degenere'
content: `The primal solution is *${isAdmissible ? 'admissible' : 'not admissible'}* and *${
isDegenerate ? 'degenerate' : 'non degenerate'
}*.`,
})
comments.push({
type: 'text',
content: `La soluzione duale è *${isDualAdmissible ? 'ammissibile' : 'non ammissibile'}* e *${
isDualDegenerate ? 'degenere' : 'non degenere'
content: `The dual solution is *${isDualAdmissible ? 'admissible' : 'not admissible'}* and *${
isDualDegenerate ? 'degenerate' : 'non degenerate'
}*.`,
})
@ -224,12 +224,12 @@ export function computePrimalSimplexSteps(input: ProblemInput): ProblemOutput {
stepResult_B = [...B.filter(i => i !== h), k].toSorted()
} else {
comments.push({ type: 'text', content: 'La soluzione è *illimitata*' })
comments.push({ type: 'text', content: 'The solution is *unbounded*' })
status = { result: 'unbounded', xi }
}
} else {
comments.push({ type: 'text', content: 'La soluzione è *ottima*' })
comments.push({ type: 'text', content: 'The solution is *optimal*' })
status = { result: 'optimal', x }
}
@ -258,7 +258,7 @@ export function computePrimalSimplexSteps(input: ProblemInput): ProblemOutput {
comments.push({
type: 'text',
content: 'In questo caso bisogna usare il metodo del *simplesso duale*.',
content: 'In this case you need to use the *dual simplex* algorithm.',
})
status = { result: 'wrong-starting-basis' }

@ -9,6 +9,11 @@ import { Primal } from './Primal'
import exampleProblems from './example-problems.json'
type Problem = {
name: string
source: string
}
const INITIAL_PROBLEM_INPUT = `
c' = 500 200;
@ -42,15 +47,8 @@ const useLocalStorage = <T,>(key: string, initialValue: T) => {
}
const App = () => {
const [currentProblemName, setCurrentProblemName] = useLocalStorage(
'ricerca-operativa.currentProblemName',
'Pintel'
)
const [savedProblems, setSavedProblems] = useLocalStorage<{ name: string; source: string }[]>(
'ricerca-operativa.savedProblems',
exampleProblems
)
const [currentProblemName, setCurrentProblemName] = useLocalStorage('current-problem-name', 'Pintel')
const [savedProblems, setSavedProblems] = useLocalStorage<Problem[]>('saved-problems', exampleProblems)
const [problemInput, setProblemInput] = useState(
savedProblems.find(p => p.name === currentProblemName)?.source ?? INITIAL_PROBLEM_INPUT
@ -61,20 +59,20 @@ const App = () => {
return (
<>
<h1>
Ricerca Operativa / PL / Algoritmo del Simplesso
Operations Research / LP / Simplex Algorithm
<small>
{' '}
by <a href="https://poisson.phc.dm.unipi.it/~delucreziis/">@aziis98</a>
</small>
</h1>
<p>
Questo sito è un progetto per il{' '}
<a href="https://didawiki.cli.di.unipi.it/doku.php/matematica/ro/start">corso di Ricerca Operativa</a>{' '}
dell'Università di Pisa per visualizzare automaticamente tutti i passaggi dell'
<a href="https://it.wikipedia.org/wiki/Algoritmo_del_simplesso">algoritmo del simplesso primale</a>.
This is a project for the{' '}
<a href="https://didawiki.cli.di.unipi.it/doku.php/matematica/ro/start">Operative Research course</a> at
the University of Pisa to automatically visualize all the steps of the{' '}
<a href="https://en.wikipedia.org/wiki/Simplex_algorithm">primal simplex algorithm</a>.
</p>
<h2>Visualizzazione</h2>
<p>I dati del problema vanno inseriti nel seguente campo di testo nel formato:</p>
<h2>Visualization</h2>
<p>The problem data must be entered in the following text field in the format:</p>
<div class="flex-row">
<select
@ -129,7 +127,7 @@ const App = () => {
cols={100}
></textarea>
<h2>Problema di Input</h2>
<h2>Input Problem</h2>
{'result' in problemValuesResult ? (
<DisplayProblemInput problemInput={problemValuesResult.result} />
) : (

@ -20,16 +20,16 @@ export function parseSafeProblemInput(source: string): Result<ProblemInput> {
const { result: env } = parseResult
if (!env.A) {
return { error: 'Manca la matrice A' }
return { error: 'Missing matrix A' }
}
if (!env.b) {
return { error: 'Manca il vettore b' }
return { error: 'Missing vector b' }
}
if (!env.c) {
return { error: 'Manca il vettore c' }
return { error: 'Missing vector c' }
}
if (!env.B) {
return { error: 'Manca il vettore B' }
return { error: 'Missing vector B' }
}
const A_asMatrixResult = tryBlock(() => asMatrix(env.A))
@ -53,23 +53,23 @@ export function parseSafeProblemInput(source: string): Result<ProblemInput> {
const B = env.B
if (B.rank !== 1) {
return { error: 'B deve essere un vettore' }
return { error: 'B must be a vector' }
}
if (B.value.length !== 2) {
return { error: 'B deve contenere esattamente due elementi' }
return { error: 'B must contain exactly two elements for this visualization' }
}
if (B.value.some(v => !v.isInteger() || v.num < 1 || v.num > A.rows)) {
return {
error: `Gli elementi di B devono essere interi tra 1 e ${A.rows}: ${JSON.stringify(B.value)}`,
error: `The elements of B must be integer indices between 1 and ${A.rows}: ${JSON.stringify(B.value)}`,
}
}
// check dimensions
if (A.cols !== c.size) {
return { error: 'Il numero di colonne di A deve essere uguale alla dimensione di c' }
return { error: 'The number of columns in A must have the same dimension of c' }
}
if (A.rows !== b.size) {
return { error: 'Il numero di righe di A deve essere uguale alla dimensione di b' }
return { error: 'The number of rows of A must match the dimension of b' }
}
return {

Loading…
Cancel
Save