How to change all desion variables from binary to non-negative and vice versa?

Is it possible to define a model via cplex where all the variables are binary like @variable(model, a, Bin), and run this model, then without any manual modification change all varaibles to nonnegative and run it again?

I have a long lits of variables, all binary, at some points I need to relax the binary assumption and run the relaxation but I don’t want to change the code line by line and run the relaxation then again change it binary and repeat the cycle. Is there any automatic command for that?

This should do the trick: Models · JuMP

2 Likes