MCPcopy Create free account
hub / github.com/ShahjalalShohag/code-library / init

Function init

Math/Simplex Algorithm.cpp:85–92  ·  view source on GitHub ↗

nvars = number of variables, f = objective function, flag = MINIMIZE or MAXIMIZE

Source from the content-addressed store, hash-verified

83
84 /// nvars = number of variables, f = objective function, flag = MINIMIZE or MAXIMIZE
85 inline void init(int nvars, long double f[], int flag){
86 solution_flag = 0;
87 ar[0][nvars] = 0.0;
88 m = 0, n = nvars, minmax_flag = flag;
89 for (int i = 0; i < n; i++){
90 ar[0][i] = f[i] * minmax_flag; /// Negating sign of objective function when minimizing
91 }
92 }
93
94 /// C[] = co-efficients of the constraints (LHS), lim = limit in RHS
95 /// cmp = EQUAL for C[] = lim, LESSEQ for C[] <= lim, GREATEQ for C[] >= lim

Callers 4

solveFunction · 0.70
mainFunction · 0.70
expandMethod · 0.50
solveMethod · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected