Пример #1
0
#! /usr/bin/env python

##################################################
# D-Wave quantum machine instruction "assembler" #
# By Scott Pakin <*****@*****.**>                #
##################################################

import qmasm
import os
import os.path
import string
import sys

# Parse the command line.
cl_args = qmasm.parse_command_line()

# Specify the minimum distinguishable difference between energy readings.
min_energy_delta = 0.005

# Parse the original input file(s) into an internal representation.
qmasm.parse_files(cl_args.input)

# Parse the variable pinnings specified on the command line.  Append these to
# the program.
if cl_args.pin != None:
    for pin in cl_args.pin:
        qmasm.program.extend(qmasm.process_pin("[command line]", 1, pin))

# Walk the statements in the program, processing each in turn.
logical_either = qmasm.Problem(cl_args.qubo)
for stmt in qmasm.program:
Пример #2
0
import copy
import os
import os.path
import qmasm
import string
import sys

# Specify the minimum distinguishable difference between energy readings.
min_energy_delta = 0.005

# Define the set of classical solvers we support.
classical_solvers = ["qbsolv", "minizinc"]

# Parse the command line.
cl_args = qmasm.parse_command_line()
qmasm.report_command_line(cl_args)

# Parse the original input file(s) into an internal representation.
fparse = qmasm.FileParser()
fparse.process_files(cl_args.input)

# Parse the variable pinnings specified on the command line.  Append these to
# the program.
if cl_args.pin != None:
    for pin in cl_args.pin:
        qmasm.program.extend(fparse.process_pin("[command line]", 1, pin))

# Walk the statements in the program, processing each in turn.
logical_either = qmasm.Problem(cl_args.qubo)
for stmt in qmasm.program: