From a26c8b05b2ab5dcbe07ded6d4658395b87737743 Mon Sep 17 00:00:00 2001 From: Viu Long Kong Date: Fri, 15 May 2020 13:43:56 +0200 Subject: [PATCH] update samples for 2.14.186 --- examples/cp/basic/plant_location_with_kpis.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/cp/basic/plant_location_with_kpis.py b/examples/cp/basic/plant_location_with_kpis.py index 15a5748..b08d769 100644 --- a/examples/cp/basic/plant_location_with_kpis.py +++ b/examples/cp/basic/plant_location_with_kpis.py @@ -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") @@ -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")