API_KEY = "5bd4ecfdc74e6680da7c79998259781431661e5326ae2f88eea95dee8f74b87530ba63fbca8105404de4ffd36e4b484631907acff73c805580928218a5ccf0b3"

import qiskit as q
from qiskit import IBMQ,schedule
import numpy as np

import qiskit.pulse as pulse
from qiskit.circuit import Parameter


%matplotlib inline
import sys
sys.path.insert(0, '..') # Add qiskit_runtime directory to the path

IBMQ.save_account(API_KEY)
# Details in: https://qiskit.org/documentation/install.html 

IBMQ.save_account(API_KEY, overwrite=True)
IBMQ.load_account()

provider = IBMQ.get_provider("ibm-q")

for backend in provider.backends():
    try:
        qubit_count = len(backend.properties().quibits)
    except:
        qubit_count = "simulated"
        
    print(f"{backend.name()} has {backend.status().pending_jobs} queued and { qubit_count} qubits")

from qiskit.tools.monitor import job_monitor
backend = provider.get_backend("ibmq_lima")

provider = IBMQ.get_provider(
	hub='ibm-q',
	group='open',
	project='main'
)

options = {
	'backend_name': 'ibmq_qasm_simulator'
}

runtime_inputs = {
	# An instance of FeatureMap in
  # dictionary format used to map
  # classical data into a quantum
  # state space.
  'feature_map': None, # dict (required)
	
	# NxD array of training data,
  # where N is the number
  # of samples and D is
  # the feature dimension.
  'data': None, # numpy.ndarray (required)
	
	# Nx1 array of +/-1 labels
  # of the N training samples.
  'labels': None, # numpy.ndarray (required)
	
	# Initial parameters of the quantum
  # kernel. If not specified, an
  # array of randomly generated numbers
  # is used.
  'initial_kernel_parameters': None, # numpy.ndarray
	
	# Number of SPSA optimization steps.
  # Default is 1.
  'maxiters': None, # int
	
	# Penalty parameter for the soft-margin
  # support vector machine. Default is
  # 1.
  'C': None, # float
	
	# Initial position of virtual qubits
  # on the physical qubits of
  # the quantum device. Default is
  # None.
  'initial_layout': None # list or dict
}

job = provider.runtime.run(
	program_id='quantum-kernel-alignment',
	options=options,
	inputs=runtime_inputs
)

# Job id
print(job.job_id())
# See job status
print(job.status())

# Get results
result = job.result()