You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
∇z = r.∇z # [n x 1] Cost change when bringing in the base a thruster which is out of the basis (i.e., increasing Yn[i])
312
+
e = r.e
313
+
iBase = r.iBase # [m x 1] Global indices (i.e., within the vector Y) of thrusters in the basis. Initial solution is y = s
314
+
Yn = r.Yn # [n+m x 1] Thrusters out of the basis, either at zero (Yn[i] = 0) or at max (Yn[i] = Ymax[i])
315
+
yb = r.yb # [m x 1] Basis vector (i.e., y of the m thrusters that form the basis)
316
+
Ymax = r.Ymax # [n+m x 1] Parameters upper bounds, 0 <= Y <= Ymax, where Y = [y; s] TODO: Caution, this was creating problems when it was (maximum(yb) + 1.0)
317
+
eNew = r.eNew
318
+
cs = r.cs # [m x 1] Slack variables cost vector
319
+
y = r.y
278
320
279
321
# # Variable change to have ylb = 0
280
322
# off = false;
@@ -284,24 +326,26 @@ function rcsAllocationSimplex!(y, u, My; maxIter=30)
284
326
# off = true;
285
327
# end
286
328
287
-
# maxIter = 30#3m + 1 # was 3m + 10, but needed to heuristically increase a bit
288
-
# cs = 1e3*maximum(c)*ones(m) # [OLD with c] [m x 1] Slack variables cost vector
289
-
cs =1e3*ones(m) # [m x 1] Slack variables cost vector
290
-
291
329
# Setup the initial solution
292
-
E =-xsign.(u).*My # [m x n]
293
-
# ∇z = c + E'*cs # [OLD with c] [n x 1] Cost change when bringing in the base a thruster which is out of the basis (i.e., increasing Yn[i])
294
-
∇z =1.0.+ E'*cs # [n x 1] Cost change when bringing in the base a thruster which is out of the basis (i.e., increasing Yn[i])
295
-
e =zeros(m)
296
-
297
-
iBase =Integer.(n+1:n+m) # [m x 1] Global indices (i.e., within the vector Y) of thrusters in the basis. Initial solution is y = s
298
-
Yn =zeros(n + m) # [n+m x 1] Thrusters out of the basis, either at zero (Yn[i] = 0) or at max (Yn[i] = Ymax[i])
299
-
yb =abs.(u) # [m x 1] Basis vector (i.e., y of the m thrusters that form the basis)
300
-
Ymax = [ones(n); 1e8*ones(m)] # [n+m x 1] Parameters upper bounds, 0 <= Y <= Ymax, where Y = [y; s] TODO: Caution, this was creating problems when it was (maximum(yb) + 1.0)
301
-
eNew =zeros(n)
330
+
# E .= -xsign.(u).*My
331
+
E .= My
332
+
@inboundsfor i in1:m
333
+
if u[i] >0.0
334
+
@inboundsfor j in1:n
335
+
E[i, j] *=-1.0
336
+
end
337
+
end
338
+
iBase[i] = n + i
339
+
yb[i] =abs(u[i])
340
+
end
341
+
mul!(∇z, E', cs)
342
+
∇z .+= c
343
+
e .=0.0
344
+
eNew .=0.0
345
+
Yn .=0.0
302
346
303
347
# Loop until all gradient components are positive
304
-
@inboundsfor _ in1:maxIter
348
+
@inboundsfor _ in1:r.maxIter
305
349
306
350
# Find the non-basis thruster that is candidate to enter the basis
307
351
# The thrusters which maximize '∇z' is invited in the basis
0 commit comments