In order to avoid the creation of variables that are not really necessary in my problem, I’d like to insert a IF in the declaration of the variables. Like this :
@variable(model, x_prod[l in localization, inst in inst_by_localisation[l], c in commodities_installation[inst] if commodity_class[c]=="Grid", t in timeslice, dy in div_years, y in years]>=0)
where commodity_class is a Dict that contains the association commodity => type of commodity.
I know I could create a dict before creating the variable that contains all the relationship allowed but I’d like to try to find a way to do it by using a IF because it can be useful for other situations. Also I would like to avoid to write many nested loops as the conventional way.
Anyone know if is it possible ? I’ve tried many different syntax without a good result. Thanks in advance.