Is that Ok to exclude fixed components from an objective function?

Suppose we have the following objective function with one decision variable $$x_i$$ where $$p_i$$ is a fixed parameter for each $$i$$ and also, $$a$$ is a constant for the problem
\begin{align} \label{eq} \max \sum^N_{i=1} p_i(a+1-x_i) = \max \bigg{(}\sum^N_{i=1} p_ia +\sum^N_{i=1}p_i -\sum^N_{i=1} p_i x_i\bigg{)} \end{align}

As the first two components: $$\sum^N_{i=1} p_ia$$ and $$\sum^N_{i=1}p_i$$ are fixed and changing $$x_i$$ won't affect them anyway. Is there any difference if I excluded the fixed components from the objective function and set the objective function to be $$$$\max \sum^N_{i=1} -p_ix_i = \min \sum^N_{i=1} p_ix_i?$$$$

Of course, the objective function value is not the same before and after excluding the fixed components, but will the values of $$x_i$$ be the same in both cases?

1 Answer

Excluding the constant portions of the objective function is perfectly fine. The optimal solutions will be unchanged and it should have no impact on how long the solver needs to solve the model.

• One subtlety to be aware of is that both the solution returned and the solve time can be impacted if a relative objective gap other than 0 is used as a termination criterion. Commented Jun 26, 2021 at 18:38
• @prubin it have no impact on how long the solver needs to solve the model, should not it be faster after excluding the constant portions? Commented Jun 27, 2021 at 1:07
• @ORJunior Not enough to notice. A typical solver will set aside the constant portion anyway, so the number of nodes processed and time to process them will not be affected (other than as noted by Rob, and the effect there can go either way). The time the solver would have spent ignoring the constant stuff is too little matter.
– prubin
Commented Jun 27, 2021 at 20:46
• @prubin Thank you, I got it. And I really appreciate your answer to my question Commented Jun 28, 2021 at 4:44