Skip to content

Commit

Permalink
update samples for 2.14.186
Browse files Browse the repository at this point in the history
  • Loading branch information
vlkong committed May 15, 2020
1 parent 82833d0 commit a26c8b0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/cp/basic/plant_location_with_kpis.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
mdl.add(mdl.minimize(obj))

# Add KPIs
if compare_natural(context.model.version, '12.9') >= 0:
if context.model.version is None or compare_natural(context.model.version, '12.9') >= 0:
mdl.add_kpi(mdl.sum(demand) / mdl.scal_prod(open, capacity), "Occupancy")
mdl.add_kpi(mdl.min([load[l] / capacity[l] + (1 - open[l]) for l in range(nbLocation)]), "Min occupancy")

Expand All @@ -113,7 +113,7 @@
msol = mdl.solve(TimeLimit=10, trace_log=False) # Set trace_log=True to have a real-time view of the KPIs
if msol:
print(" Objective value: {}".format(msol.get_objective_values()[0]))
if compare_natural(context.model.version, '12.9') >= 0:
if context.model.version is None or compare_natural(context.model.version, '12.9') >= 0:
print(" KPIs: {}".format(msol.get_kpis()))
else:
print(" No solution")
Expand Down

0 comments on commit a26c8b0

Please sign in to comment.