Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
100 lines (93 loc) · 2.65 KB

File metadata and controls

100 lines (93 loc) · 2.65 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/**
* For dual variables return an apostrophe.
*
* @param isDual A Boolean representing whether the problem is a dual.
* @return Empty string if isDual = false, string containing an
* apostrophe otherwise.
*/
function dualDash(isDual) {
if (isDual) {
return "'";
} else {
return "";
}
}
/**
* Obtain and return parameters of the problem from the form.
*
* @params None.
* @return [A, b, cj, x, xB, shouldDie]
*/
function getParameters() {
// Initialize globals
var shouldDie = false;
var objVarName = "z";
var sign = +1;
// Change objective function coefficient(s)
if (document.getElementById("changec").checked) {
var [A, b, cj, x, xB, shouldDie] = objectiveChange();
document.getElementById("changec").checked = false;
}
// Add new constraint
else if (document.getElementById("newConstr").checked) {
var [A, b, cj, x, xB, shouldDie] = newConstraint();
uncheck("newConstr");
}
// Resource change (i.e. RHS of constraint)
else if (document.getElementById("rscChg").checked) {
var [A, b, cj, x, xB, shouldDie] = resourceChange();
uncheck("rscChg");
}
// LHS constraint coefficient change
else if (document.getElementById("LHSChg").checked) {
var [A, b, cj, x, xB, shouldDie] = constrCoeffsChange();
uncheck("LHSChg");
}
// New variable
else if (document.getElementById("newVar").checked) {
var [A, b, cj, x, xB, shouldDie] = addVariable();
uncheck("newVar");
}
// Extract relevant values from form
else {
// Set globals
dualCheck = document.getElementById("isDual").checked;
if (document.getElementById("useNonMat").checked || dualCheck) {
var [A, b, cj, x, xB, shouldDie, sign, objVarName] =
readNonMatForm();
uncheck("useNonMat");
uncheck("isDual");
} else {
var [A, b, cj, x, xB] = readInputs();
}
}
// Update globals
updateAInitials(A);
// Uncheck buttons
return [A, b, cj, x, xB, shouldDie, sign, objVarName];
}
/**
* Read inputs from the form.
*
* @params None.
* @return [A, b, cj, x, xB]
*/
function readInputs() {
var A = readA();
var b = readb();
var xB = readxB();
var cj = readc();
var x = readx();
return [A, b, cj, x, xB];
}
/**
* Uncheck specified radio button if it is checked.
*
* @param name Name of the radio button's HTML element.
* @return Nothing.
*/
function uncheck(name) {
if (document.getElementById(name).checked) {
document.getElementById(name).checked = false;
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.