You X values are binary, 0 or 1. Your A, B, C, etc., you say are non-linear. But there are only two possible inputs for them, so they are each implicitly
input is 0: constant1
input is 1: constant2
which can also be expressed as
constant1 + input * (constant2-constant1)
which is linear. Your formula can be rewritten as
A_constant1 + B_constant1 + C_constant1 ... + (A_constant2-A_constant1)*X1 + (B_constant2-B_constant1)*X2 + ...
and you consolidate the values to arrive at
constant + Adiff * X1 + Bdiff * X2 + Cdiff * X3 ....
If you do not have any constraints, this can be minimized immediately by setting the X* for a negative difference to 1 and setting the X* for a positive difference to 0.