How to treat variable as binary in some points of model?

I have a decision variable PRODAMOUNT and it is of Int type. I need it as binary in some points of the model, like here in the objective function second PRODAMOUNT should be used as 1 when there is a positive value in it otherwise is should be 0 (as it is)

             sum((u["cap"] - PRODAMOUNT[op_k, u_k, t] * _PRODUCTs_ALL[op["product"]]["bagSize"]) * u["util_cost1"]
           + sum(t / _ORDERs_ALL[op["order"]]["details"]["deadline"] * PRODAMOUNT[op_k, u_k, t] * 10000
                for (op_k, op) in _ORDER_PRODUCTs_ALL, (u_k, u) in UNITS, t in TIME) 

I am not sure if I understand the question, do you have a variable that should be a continuous or integer variable in the constraints, but in the objective function it should only matter if it has a positive value or not?

If I guessed right, one solution is: create a second variable, PRODAMOUNT_IS_POSITIVE, it is equal to PRODAMOUNT except it is binary, in the formulation add the constraint PRODAMOUNT_IS_POSITIVE >= PRODAMOUNT/MAX_VALUE_PRODAMOUNT_CAN_ASSUME. If PRODAMOUNT assumes any positive value, then PRODAMOUNT_IS_POSITIVE that is binary will be forced to assume value 1, if you do not divide PRODAMOUNT by the maximum value PRODAMOUNT may assume then the model may become unfeasible (as the binary variable cannot assume values higher than one). Use PRODAMOUNT_IS_POSITIVE in the objective function (and keep PRODAMOUNT in the constraints as it already is).


thank you for your answer, but I don’t know max value of PRODAMOUNT because that is the goal of the model itself. I will try to eliminate all dependent variables from the model and change the logic behind it. BTW I am working on the model that was already created as it is.

Note that if you do not know the max value of PRODAMOUNT you can try using the tighter upper bound you have.