Problem Parameters Solution Timing
r
5 0
ENERGY (TARGET)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Two dashes start a one-line comment. | |
--[[ | |
Adding two ['s and ]'s makes it a | |
multi-line comment. | |
--]] | |
---------------------------------------------------- | |
-- 1. Variables and flow control. | |
---------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Peace |
# Define the graph and binary variables
graph = {('C', 'A'), ('B', 'D'), ('A', 'Y'), ('S', 'C'), ('E', 'R')}
binary_variables = {'A', 'B', 'C', 'D'}
# Create a binary quadratic model (BQM)
bqm = dimod.BinaryQuadraticModel.empty(dimod.BINARY)
'''
Exercise 1
To run the exercise 1 demo from the command-line, type the command:
python two_same.py
Read through the code and take a look at the structure of the program. Notice the basic parts:
- Obtain a sampler/solver
- Define the Q matrix
OlderNewer