How to formulate that once binary variable equals 1 then other one equals zero forever?

I need to choose objective function under some circumstances.

obj_select = obj1*var1 + obj2*var2
.
.
.
obj.. z =e= obj_select

I need to decide var1 and var2 binary variable values. Conditions;

When var1 = 1 for a condition then var2 =0 no matter it became 1 before, the model just select the obj1 to optimize
When var2 = 1 for a condition then var1 =0 no matter it became 1 before, the model just select the obj1 to optimize

to sum up, I need to choose one objective according to the some conditions in the dataset.

Is there any idea?

if var1 and var2 are binary, you can do this by using the constraint
var1 + var2=e= 1;

However, you would be introducing nonlinearities/nonconvexities in your problem by such a formulation that uses obj1*var1. If var1 depends ‘only’ on data, it would be advisable to calculate it beforehand and use it as a parameter instead.
Also, I don’t understand what you mean by ‘irrespective of it became 1 before’. Are you solving your problem multiple times? You won’t have a value assigned to a variable until you solve it.

  • Atharv

Thanks for answer, actually, I want to code Particle Swarm Opt. in GAMS, so probably I have to run the code iteratively but I dont know that is it possible or not in GAMS? So, I try to be ready for diffculties such as nonlinearity etc.