From e17ff5947cea6a3e562c70cabadeed94e35ffcc6 Mon Sep 17 00:00:00 2001 From: Jason Wright Date: Thu, 18 Jun 2026 15:40:47 -0600 Subject: [PATCH] chore: remove dead SipserReduceToCliqueStandard solver path The backend endpoint that would have surfaced "CliqueBruteForce - via SipserReduceToCliqueStandard" as a solver option was commented out, making the frontend code handling it unreachable. Remove the two dead functions (requestSolvedInstanceTemporarySat3CliqueSolver, requestSolvedVisualization), replace the call site in SolveRowReact with requestSolvedInstance directly, and drop the matching ternary in useSolverInfo. The SipserReduceToCliqueStandard reduction itself is unchanged and still in use. Co-Authored-By: Claude Sonnet 4.6 --- components/hooks/ProblemProvider/Solver.js | 8 +--- components/pageblocks/SolveRowReact.js | 4 +- components/redux/index.js | 55 ---------------------- 3 files changed, 3 insertions(+), 64 deletions(-) diff --git a/components/hooks/ProblemProvider/Solver.js b/components/hooks/ProblemProvider/Solver.js index 925ac72..8ec4fff 100644 --- a/components/hooks/ProblemProvider/Solver.js +++ b/components/hooks/ProblemProvider/Solver.js @@ -14,13 +14,7 @@ export function useSolver(url, problemName, problemType, problemNameMap, problem } export function useSolverInfo(url, solver) { - // NOTE - Caleb - the following is a temporary solution to allow sat3 to be solved using the clique solver - // remove first if once this functionality is added for all problems, the false expression was the original - // functionality - return useGenericInfo( - url, - solver === "CliqueBruteForce - via SipserReduceToCliqueStandard" ? "CliqueBruteForce" : solver - ); + return useGenericInfo(url, solver); } function useSolvedInstance(problemInstance, chosenSolver) { diff --git a/components/pageblocks/SolveRowReact.js b/components/pageblocks/SolveRowReact.js index d4c6547..d525e31 100644 --- a/components/pageblocks/SolveRowReact.js +++ b/components/pageblocks/SolveRowReact.js @@ -14,7 +14,7 @@ import "bootstrap/dist/css/bootstrap.min.css"; import { Button } from "@mui/material"; import { Download as DownloadIcon } from '@mui/icons-material'; -import { requestSolvedInstanceTemporarySat3CliqueSolver } from "../redux"; +import { requestSolvedInstance } from "../redux"; import PopoverTooltipClick from "../widgets/PopoverTooltipClick"; import { useSolverInfo } from "../hooks/ProblemProvider"; import ProblemSection from "../widgets/ProblemSection"; @@ -48,7 +48,7 @@ export default function SolveRowReact({ async function handleSolve() { setSolvedInstance( chosenSolver && problemInstance - ? (await requestSolvedInstanceTemporarySat3CliqueSolver(url, chosenSolver, problemInstance)) ?? "" + ? (await requestSolvedInstance(url, chosenSolver, problemInstance)) ?? "" : "" ); } diff --git a/components/redux/index.js b/components/redux/index.js index f1f3139..5a2d946 100644 --- a/components/redux/index.js +++ b/components/redux/index.js @@ -385,61 +385,6 @@ export async function requestSolvedInstance(url, solver, instance) { ); } -/** - * Temporary solution to allow solving 3 SAT with a Clique solver. - * All calls to this function should eventually be replace with `requestSolvedInstance`. - * A verbose name was purposefully chosen as a reminder to fix this. - * @returns the solved `instance` from the specified `solver`. - * @returns `undefined` on failure and logs the error. - */ -export async function requestSolvedInstanceTemporarySat3CliqueSolver(url, solver, instance) { - // NOTE - Caleb - the following is a temporary solution to allow sat3 to be solved using the clique solver - // remove first if once this functionality is added for all problems, the else code block was the original - // functionality - if (solver == "CliqueBruteForce - via SipserReduceToCliqueStandard") { - const reduction = await requestReducedInstance(url, "SipserReduceToCliqueStandard", instance); - if (!reduction) { - return undefined; - } - - const solution = await requestSolvedInstance(url, "CliqueBruteForce", reduction.reductionTo.instance); - if (!solution) { - return undefined; - } - - const mappedSolution = await fetchPostJson( - `${url}ProblemProvider/mapSolution?reduction=SipserReduceToSAT3&solution=${encodeURIComponent(solution)}`, - reduction.reductionTo.instance, - () => "TRANSITIVE SOLVED REQUEST FAILED" - ); - - return mappedSolution; - } else { - return await requestSolvedInstance(url, solver, instance); - } -} - -/** - * @returns the solved graph visualization of the problem instance. - * @returns `undefined` on failure and logs the error. - */ -export async function requestSolvedVisualization(url, problem, instance, solution) { - // TODO: convert to POST request for problem instance - var preparedSolution = solution.replaceAll("&", "%26"); - var preparedInstance = instance.replaceAll("&", "%26"); - if (problem == "SipserReduceToCliqueStandard") { - return await fetchJson( - `${url}${problem}/solvedVisualization?problemInstance=${preparedInstance}&solution=${preparedSolution}`, - () => `${problem} VISUALIZE REQUEST FAILED` - ); - } else { - return await fetchJson( - `${url}${problem}Generic/solvedVisualization?problemInstance=${preparedInstance}&solution=${preparedSolution}`, - () => `${problem} VISUALIZE REQUEST FAILED` - ); - } -} - /** * @returns the `steps` from the specified `solver`. * @returns `undefined` on failure and logs the error.