Skip to content

Commit

Permalink
Address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
vgoliber committed May 24, 2021
1 parent d5ff36b commit ff8f780
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
13 changes: 10 additions & 3 deletions nurse_scheduling.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,16 @@
from dimod import BinaryQuadraticModel
from collections import defaultdict
from copy import deepcopy
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
import matplotlib

try:
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
except ImportError:
matplotlib.use("agg")
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle


# Overall model variables: problem size
# binary variable q_nd is the assignment of nurse n to day d
Expand Down Expand Up @@ -172,7 +180,6 @@ def get_nurse_and_day(index):

# Get the results
smpl = results.first.sample
# energy = results.first.energy

# Graphics
print("\nBuilding schedule and checking constraints...\n")
Expand Down
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
dwave-ocean-sdk>=3.3.0

matplotlib==3.3.4; python_version>'3.5'
matplotlib==3.0.3; python_version=='3.5'
8 changes: 1 addition & 7 deletions tests/test_nurse_scheduling.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,7 @@
example_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

class IntegrationTests(unittest.TestCase):
@unittest.skipIf(os.getenv('SKIP_INT_TESTS'), "Skipping integration test.")
def test_smoke(self):
"""run nurse_scheduling.py and check that nothing crashes"""

demo_file = os.path.join(example_dir, 'nurse_scheduling.py')
subprocess.check_output([sys.executable, demo_file])

@unittest.skipIf(os.getenv('SKIP_INT_TESTS'), "Skipping integration test.")
def test_schedule(self):
file_path = os.path.join(example_dir, 'nurse_scheduling.py')

Expand Down

0 comments on commit ff8f780

Please sign in to comment.