From fb54890785a4e4a73fb50c731d557094db8cb1ae Mon Sep 17 00:00:00 2001
From: SinusFox <61253950+SinusFox@users.noreply.github.com>
Date: Thu, 3 Oct 2024 22:43:07 +0200
Subject: [PATCH] Moving files to correct folders
---
.eslintrc.json | 7 ++++++-
src/{pages => }/api/optimizeLP.ts | 0
src/{pages => }/api/optimizeMIP.ts | 0
src/{pages => }/api/test.ts | 0
src/app/scripts.ts | 18 +++++++++---------
src/{pages => parser}/parseLP.ts | 0
src/{pages => parser}/parseMIP.ts | 0
7 files changed, 15 insertions(+), 10 deletions(-)
rename src/{pages => }/api/optimizeLP.ts (100%)
rename src/{pages => }/api/optimizeMIP.ts (100%)
rename src/{pages => }/api/test.ts (100%)
rename src/{pages => parser}/parseLP.ts (100%)
rename src/{pages => parser}/parseMIP.ts (100%)
diff --git a/.eslintrc.json b/.eslintrc.json
index 3722418..1eaa7f7 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -1,3 +1,8 @@
{
- "extends": ["next/core-web-vitals", "next/typescript"]
+ "extends": ["next/core-web-vitals", "next/typescript"],
+ "rules": {
+ "@typescript-eslint/no-unused-vars": "off",
+ "@typescript-eslint/no-explicit-any": "off",
+ "prefer-const": "off"
+ }
}
diff --git a/src/pages/api/optimizeLP.ts b/src/api/optimizeLP.ts
similarity index 100%
rename from src/pages/api/optimizeLP.ts
rename to src/api/optimizeLP.ts
diff --git a/src/pages/api/optimizeMIP.ts b/src/api/optimizeMIP.ts
similarity index 100%
rename from src/pages/api/optimizeMIP.ts
rename to src/api/optimizeMIP.ts
diff --git a/src/pages/api/test.ts b/src/api/test.ts
similarity index 100%
rename from src/pages/api/test.ts
rename to src/api/test.ts
diff --git a/src/app/scripts.ts b/src/app/scripts.ts
index 899be06..f1da568 100644
--- a/src/app/scripts.ts
+++ b/src/app/scripts.ts
@@ -1,6 +1,6 @@
-import * as MIP from "../pages/parseMIP"
-import * as LP from "../pages/parseLP"
-import * as LPAPI from "../pages/api/optimizeLP.js"
+import * as MIP from "../parser/parseMIP"
+import * as LP from "../parser/parseLP"
+import * as LPAPI from "../api/optimizeLP.js"
import * as GLPKAPI from "../solver/glpk.min.js"
import { start } from "repl";
@@ -27,7 +27,7 @@ function customLogClear() {
function walltimeStopAndPrint(startpoint: number) {
// calculating elapsed time as timestamp
- var duration = Date.now() - startpoint;
+ let duration = Date.now() - startpoint;
// Calculate seconds and ms
const seconds = Math.floor(duration / 1000);
@@ -164,7 +164,7 @@ export function calculate_click() {
function run(text: string) {
customLog("Starting problem setup...");
- var lp = GLPKAPI.glp_create_prob();
+ let lp = GLPKAPI.glp_create_prob();
GLPKAPI.glp_read_lp_from_string(lp, null, text);
customLog("Problem created.
");
@@ -173,25 +173,25 @@ function run(text: string) {
customLog("Scaling complete.
");
customLog("Starting simplex optimization...");
- var smcp = new GLPKAPI.SMCP({ presolve: GLPKAPI.GLP_ON });
+ let smcp = new GLPKAPI.SMCP({ presolve: GLPKAPI.GLP_ON });
GLPKAPI.glp_simplex(lp, smcp);
customLog("Simplex optimization complete.
");
customLog("Starting integer optimization...");
- var iocp = new GLPKAPI.IOCP({ presolve: GLPKAPI.GLP_ON });
+ let iocp = new GLPKAPI.IOCP({ presolve: GLPKAPI.GLP_ON });
GLPKAPI.glp_intopt(lp, iocp);
customLog("Integer optimization complete.
");
// customLog("obj: " + GLPKAPI.glp_mip_obj_val(lp));
customLog("Final objective value: " + GLPKAPI.glp_mip_obj_val(lp) + "
");
customLog("Value of each variable:");
- for (var i = 1; i <= GLPKAPI.glp_get_num_cols(lp) - 1; i++) { // "-1" to remove the "End-variable" from logs
+ for (let i = 1; i <= GLPKAPI.glp_get_num_cols(lp) - 1; i++) { // "-1" to remove the "End-variable" from logs
customLog(GLPKAPI.glp_get_col_name(lp, i) + " = " + GLPKAPI.glp_mip_col_val(lp, i));
}
customLog("");
customLog("Dual values of constraints:");
- for (var j = 1; j <= GLPKAPI.glp_get_num_rows(lp); j++) {
+ for (let j = 1; j <= GLPKAPI.glp_get_num_rows(lp); j++) {
const dualValue = GLPKAPI.glp_get_row_dual(lp, j); // fetch dual
const constraintName = GLPKAPI.glp_get_row_name(lp, j);
customLog(constraintName + " dual = " + dualValue);
diff --git a/src/pages/parseLP.ts b/src/parser/parseLP.ts
similarity index 100%
rename from src/pages/parseLP.ts
rename to src/parser/parseLP.ts
diff --git a/src/pages/parseMIP.ts b/src/parser/parseMIP.ts
similarity index 100%
rename from src/pages/parseMIP.ts
rename to src/parser/parseMIP.ts