I am working on a problem where there is a free variable.

The objective function of the problem has several terms. I need two of these, say the A term and the B term, to depend on the free variable, based on its sign. That is, when the free variable has a positive value, term A will exist and B will be 0; conversely, when the free variable has a negative value, term B will exist and A will be 0.

How can I model this situation?

Thank you very much!