Add support to generic optimization structure
[optf/has.git] / conductor / conductor / solver / optimizer / greedy.py
index eae1b12..5c82164 100755 (executable)
@@ -2,6 +2,7 @@
 #
 # -------------------------------------------------------------------------
 #   Copyright (c) 2015-2017 AT&T Intellectual Property
+#   Copyright (C) 2020 Wipro Limited.
 #
 #   Licensed under the Apache License, Version 2.0 (the "License");
 #   you may not use this file except in compliance with the License.
@@ -55,6 +56,10 @@ class Greedy(search.Search):
                     if decision_path.total_value < bound_value:
                         bound_value = decision_path.total_value
                         best_resource = candidate
+                elif _objective.goal == "max":
+                    if decision_path.total_value > bound_value:
+                        bound_value = decision_path.total_value
+                        best_resource = candidate
 
             if best_resource is not None:
                 decision_path.decisions[demand.name] = best_resource