-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
piotr.malkowski
committed
Feb 17, 2025
1 parent
30a7f12
commit f333e87
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { Divider, Heading, Spacer, Text } from "@chakra-ui/react"; | ||
import type { NextPage } from "next"; | ||
import { useState } from "react"; | ||
import { Layout } from "../../components/layout/Layout"; | ||
import { SAT_language } from "../../components/solvers/SAT/prism-SAT"; | ||
import { SolverConfiguration } from "../../components/solvers/SolverConfiguration"; | ||
import { TextInputMask } from "../../components/solvers/TextInputMask"; | ||
import { LogicalExpressionValidator } from "../../converter/dimacs/LogicalExpressionValidator"; | ||
|
||
const SharpSAT: NextPage = () => { | ||
const logicalExpressionValidator = new LogicalExpressionValidator(); | ||
|
||
const [logicalExpressionString, setLogicalExpressionString] = useState(""); | ||
|
||
return ( | ||
<Layout> | ||
<Heading as="h1">sharpSAT Solver</Heading> | ||
<Text color="text" align="justify"> | ||
For a given Boolean formula, this algorithm counts the number of satisfying assignments. | ||
You can enter any Boolean formula with any number of variables and combine them using Boolean operators | ||
(i.e., "and", "or" and "not"). | ||
</Text> | ||
|
||
<Spacer /> | ||
|
||
<TextInputMask | ||
textPlaceholder='Try "a and (not a or not b)"' | ||
text={logicalExpressionString} | ||
setText={setLogicalExpressionString} | ||
problemTypeId="sharpsat" | ||
grammar={{ | ||
grammar: SAT_language, | ||
language: "SAT_language", | ||
}} | ||
validate={(text) => | ||
logicalExpressionValidator.validateLogicalExpression(text) | ||
} | ||
/> | ||
|
||
<Divider /> | ||
|
||
<SolverConfiguration | ||
problemTypeId="sharpsat" | ||
problemInput={logicalExpressionString} | ||
/> | ||
</Layout> | ||
); | ||
}; | ||
|
||
export default SharpSAT; |