How can I add objective for scheduling model to count the present decision variables to be specific value using CPlex Python?

53 views Asked by At

I am working on the scheduling problem where I want to add an objective according to such condition. So is there any way to count the present interval variables (like presence_of()) to apply some condition for an objective? Thanks in advance!

1

There are 1 answers

2
Alex Fleischer On

In the example CPLEX_Studio221\python\examples\cp\basic you could have a look at the example house_building.py

You will see

# Maximization objective of the model
obj2 = mdl.sum([s.level * mdl.presence_of(wtasks[(h, s)]) for s in SKILLS for h in HOUSES])
mdl.add(mdl.maximize(obj2))