I have a number of variables that need to be set to 0. They are positive real numbers so the way I see it I can do this by setting each one to 0 by separate constraints, or I can set their sum to zero. Would that help with the efficiency? Im working on some big problems so I would like the the lowest solving time possible.
I'd recommend setting each variable to 0, rather than trying to do something clever.
This is for two reasons:
You might be too clever and make a mistake. For instance, setting each variable to zero is a different problem than setting the sum of a set of variables to be zero (since this constraint still holds if some of the variables take negative values and others positive values). So, even here, the example you suggest in your question would give the wrong answer. You can waste a lot of time tracking down an error like that.
Simple constraints are easier to process than more complex constraints. You're mentally modeling the cost as "two constraints are much more expensive than one complex constraint". But an alternative cost model is: "many simple constraints are still less expensive than one complex constraint". Without knowing details about the solver, it's hard to judge between these; however, I suspect the latter model is closer to the truth. Parsing a statement like
a+b+c=0requires building something like a parse tree, which is expensive. However, it's likely that a solver would add a couple of lines of code to optimize for the special case where, e.g.,
a=0. Thus, this operation would be relatively much less expensive.