We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f5b91b0 commit 631ab53Copy full SHA for 631ab53
codes/chapter2/general2standard.m
@@ -32,8 +32,6 @@
32
% -- MinMaxLP: the type of optimization
33
34
[m, n] = size(A); % size of matrix A
35
-A = [A zeros(m, n)]; % preallocate matrix A
36
-c = [c; zeros(m, 1)]; % preallocate vector c
37
% if the LP problem is a maximization problem, transform it
38
% to a minimization problem
39
if MinMaxLP == 1
@@ -47,12 +45,14 @@
47
45
if Eqin(i) == -1
48
46
A(i, n + 1) = 1;
49
Eqin(i) = 0;
+ c(n + 1) = 0;
50
n = n + 1;
51
% transform constraints in the form 'greater than or
52
% equal to' to equality constraints
53
elseif Eqin(i) == 1
54
A(i, n + 1) = -1;
55
56
57
end
58
0 commit comments