Firstly by difining what weak means.
If you mean lowest approximate duribility then you use the simple minimum algerthim for on the sum of health and shield for all units to select from.
Basically if there is 1 or more valid units to effect, get the first one and then note it as the lowest. The compare the second (if one exists) to the lowest and if it is lower, make it the lowest. Repeat until all units are checked and you will have your lowest.