if cl_args.format == "qbsolv": qmasm.write_output(logical_ising, cl_args.output, cl_args.format, cl_args.qubo) sys.exit(0) # As a special case, if the user requested QMASM output we output the # pre-embedded version of the problem. If we weren't asked to run, we can stop # here. if cl_args.format == "qmasm": qmasm.write_output(logical_ising, cl_args.output, cl_args.format, cl_args.qubo) if not cl_args.run: sys.exit(0) # Embed the problem onto the D-Wave. physical = qmasm.embed_problem_on_dwave(logical_ising, cl_args.O, cl_args.verbose) # Set all chains to the user-specified strength then combine user-specified # chains with embedder-created chains. physical = qmasm.update_strengths_from_chains(physical) if cl_args.verbose >= 2: sys.stderr.write("Introduced the following new chains:\n\n") if len(physical.chains) == 0: sys.stderr.write(" [none]\n") else: for c in physical.chains: num1, num2 = c if num1 > num2: num1, num2 = num2, num1 sys.stderr.write(" %4d = %4d\n" % (num1, num2)) sys.stderr.write("\n")
if write_output_file and cl_args.format == "bqpjson" and not cl_args.always_embed: qmasm.write_output(logical_ising, cl_args.output, cl_args.format, cl_args.qubo) if not cl_args.run: sys.exit(0) # Process all classical solvers unless we were told to do so post-embedding. if not cl_args.always_embed and cl_args.format in classical_solvers: qmasm.process_classical(logical_ising, cl_args.format, cl_args.output, cl_args.run, cl_args.extra_args, cl_args.qubo, cl_args.verbose) sys.exit(0) # Embed the problem onto the D-Wave. physical_ising = qmasm.embed_problem_on_dwave(logical_ising, cl_args.O, cl_args.verbose, cl_args.topology_file, cl_args.always_embed, cl_args.embed_method, cl_args.locations_file) # Set all chains to the user-specified strength then combine user-specified # chains with embedder-created chains. physical_ising = qmasm.update_strengths_from_chains(physical_ising) if cl_args.verbose >= 2: sys.stderr.write("Introduced the following new chains:\n\n") if len(physical_ising.chains) == 0: sys.stderr.write(" [none]\n") else: for c in physical_ising.chains: num1, num2 = c if num1 > num2: num1, num2 = num2, num1
if write_output_file and cl_args.format == "bqpjson" and not cl_args.always_embed: qmasm.write_output(logical_ising, cl_args.output, cl_args.format, cl_args.qubo) if not cl_args.run: sys.exit(0) # Process all classical solvers unless we were told to do so post-embedding. if not cl_args.always_embed and cl_args.format in classical_solvers: qmasm.process_classical(logical_ising, cl_args.format, cl_args.output, cl_args.run, cl_args.extra_args, cl_args.qubo, cl_args.verbose) sys.exit(0) # Embed the problem onto the D-Wave. physical_ising = qmasm.embed_problem_on_dwave(logical_ising, cl_args.O, cl_args.verbose, cl_args.topology_file) # Set all chains to the user-specified strength then combine user-specified # chains with embedder-created chains. physical_ising = qmasm.update_strengths_from_chains(physical_ising) if cl_args.verbose >= 2: sys.stderr.write("Introduced the following new chains:\n\n") if len(physical_ising.chains) == 0: sys.stderr.write(" [none]\n") else: for c in physical_ising.chains: num1, num2 = c if num1 > num2: num1, num2 = num2, num1 sys.stderr.write(" %4d = %4d\n" % (num1, num2))
# If the user requested bqpjson output, output it here unless --always-embed # was specified. if write_output_file and cl_args.format == "bqpjson" and not cl_args.always_embed: qmasm.write_output(logical_ising, cl_args.output, cl_args.format, cl_args.qubo) if not cl_args.run: sys.exit(0) # Process all classical solvers unless we were told to do so post-embedding. if not cl_args.always_embed and cl_args.format in classical_solvers: qmasm.process_classical(logical_ising, cl_args) sys.exit(0) # Embed the problem onto the D-Wave. physical_ising = qmasm.embed_problem_on_dwave(logical_ising, cl_args.O, cl_args.verbose, cl_args.topology_file) # Set all chains to the user-specified strength then combine user-specified # chains with embedder-created chains. physical_ising.update_strengths_from_chains() if cl_args.verbose >= 2: sys.stderr.write("Introduced the following new chains:\n\n") if len(physical_ising.embedder_chains) == 0: sys.stderr.write(" [none]\n") else: for c in physical_ising.embedder_chains: num1, num2 = c if num1 > num2: num1, num2 = num2, num1 sys.stderr.write(" %4d = %4d\n" % (num1, num2))