Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ORNL Quantum Computing Institute
xacc
Commits
f71321e0
Commit
f71321e0
authored
May 12, 2020
by
Nguyen, Thien Minh
Browse files
Added Cppmicroservices boilerplate for QAOA algo
Signed-off-by:
Thien Nguyen
<
nguyentm@ornl.gov
>
parent
ac0a684e
Changes
6
Hide whitespace changes
Inline
Side-by-side
quantum/plugins/algorithms/CMakeLists.txt
View file @
f71321e0
...
@@ -15,6 +15,7 @@ add_subdirectory(rdm)
...
@@ -15,6 +15,7 @@ add_subdirectory(rdm)
add_subdirectory
(
ml
)
add_subdirectory
(
ml
)
add_subdirectory
(
rotoselect
)
add_subdirectory
(
rotoselect
)
add_subdirectory
(
qpt
)
add_subdirectory
(
qpt
)
add_subdirectory
(
qaoa
)
file
(
GLOB PYDECORATORS
${
CMAKE_CURRENT_SOURCE_DIR
}
/vqe/python/*.py
file
(
GLOB PYDECORATORS
${
CMAKE_CURRENT_SOURCE_DIR
}
/vqe/python/*.py
${
CMAKE_CURRENT_SOURCE_DIR
}
/ml/ddcl/python/*.py
)
${
CMAKE_CURRENT_SOURCE_DIR
}
/ml/ddcl/python/*.py
)
...
...
quantum/plugins/algorithms/qaoa/CMakeLists.txt
0 → 100644
View file @
f71321e0
# *******************************************************************************
# Copyright (c) 2019 UT-Battelle, LLC.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# and Eclipse Distribution License v.10 which accompany this distribution.
# The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
# and the Eclipse Distribution License is available at
# https://eclipse.org/org/documents/edl-v10.php
#
# Contributors:
# Thien Nguyen - initial API and implementation
# *******************************************************************************/
set
(
LIBRARY_NAME xacc-algorithm-qaoa
)
file
(
GLOB SRC *.cpp
)
usfunctiongetresourcesource
(
TARGET
${
LIBRARY_NAME
}
OUT SRC
)
usfunctiongeneratebundleinit
(
TARGET
${
LIBRARY_NAME
}
OUT SRC
)
add_library
(
${
LIBRARY_NAME
}
SHARED
${
SRC
}
)
target_include_directories
(
${
LIBRARY_NAME
}
PUBLIC .
)
target_link_libraries
(
${
LIBRARY_NAME
}
PUBLIC xacc CppMicroServices
)
set
(
_bundle_name xacc_algorithm_qaoa
)
set_target_properties
(
${
LIBRARY_NAME
}
PROPERTIES COMPILE_DEFINITIONS
US_BUNDLE_NAME=
${
_bundle_name
}
US_BUNDLE_NAME
${
_bundle_name
}
)
usfunctionembedresources
(
TARGET
${
LIBRARY_NAME
}
WORKING_DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
FILES
manifest.json
)
if
(
APPLE
)
set_target_properties
(
${
LIBRARY_NAME
}
PROPERTIES INSTALL_RPATH
"@loader_path/../lib"
)
set_target_properties
(
${
LIBRARY_NAME
}
PROPERTIES LINK_FLAGS
"-undefined dynamic_lookup"
)
else
()
set_target_properties
(
${
LIBRARY_NAME
}
PROPERTIES INSTALL_RPATH
"$ORIGIN/../lib"
)
set_target_properties
(
${
LIBRARY_NAME
}
PROPERTIES LINK_FLAGS
"-shared"
)
endif
()
if
(
XACC_BUILD_TESTS
)
# TODO: add tests
#add_subdirectory(tests)
endif
()
install
(
TARGETS
${
LIBRARY_NAME
}
DESTINATION
${
CMAKE_INSTALL_PREFIX
}
/plugins
)
quantum/plugins/algorithms/qaoa/QAOAActivator.cpp
0 → 100644
View file @
f71321e0
/*******************************************************************************
* Copyright (c) 2019 UT-Battelle, LLC.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompanies this
* distribution. The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution
*License is available at https://eclipse.org/org/documents/edl-v10.php
*
* Contributors:
* Thien Nguyen - initial API and implementation
*******************************************************************************/
#include "qaoa.hpp"
#include "cppmicroservices/BundleActivator.h"
#include "cppmicroservices/BundleContext.h"
#include "cppmicroservices/ServiceProperties.h"
#include <memory>
#include <set>
using
namespace
cppmicroservices
;
namespace
{
/**
*/
class
US_ABI_LOCAL
QAOAActivator
:
public
BundleActivator
{
public:
QAOAActivator
()
{}
/**
*/
void
Start
(
BundleContext
context
)
{
auto
c
=
std
::
make_shared
<
xacc
::
algorithm
::
QAOA
>
();
context
.
RegisterService
<
xacc
::
Algorithm
>
(
c
);
}
/**
*/
void
Stop
(
BundleContext
/*context*/
)
{}
};
}
// namespace
CPPMICROSERVICES_EXPORT_BUNDLE_ACTIVATOR
(
QAOAActivator
)
quantum/plugins/algorithms/qaoa/manifest.json
0 → 100644
View file @
f71321e0
{
"bundle.symbolic_name"
:
"xacc_algorithm_qaoa"
,
"bundle.activator"
:
true
,
"bundle.name"
:
"XACC QAOA Algorithm"
,
"bundle.description"
:
""
}
quantum/plugins/algorithms/qaoa/qaoa.cpp
0 → 100644
View file @
f71321e0
/*******************************************************************************
* Copyright (c) 2019 UT-Battelle, LLC.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompanies this
* distribution. The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution
*License is available at https://eclipse.org/org/documents/edl-v10.php
*
* Contributors:
* Thien Nguyen - initial API and implementation
*******************************************************************************/
#include "qaoa.hpp"
namespace
xacc
{
namespace
algorithm
{
bool
QAOA
::
initialize
(
const
HeterogeneousMap
&
parameters
)
{
// TODO
return
true
;
}
const
std
::
vector
<
std
::
string
>
QAOA
::
requiredParameters
()
const
{
// TODO
return
{};
}
void
QAOA
::
execute
(
const
std
::
shared_ptr
<
AcceleratorBuffer
>
buffer
)
const
{
// TODO
}
std
::
vector
<
double
>
QAOA
::
execute
(
const
std
::
shared_ptr
<
AcceleratorBuffer
>
buffer
,
const
std
::
vector
<
double
>&
x
)
{
// TODO
return
{};
}
}
// namespace algorithm
}
// namespace xacc
\ No newline at end of file
quantum/plugins/algorithms/qaoa/qaoa.hpp
0 → 100644
View file @
f71321e0
/*******************************************************************************
* Copyright (c) 2019 UT-Battelle, LLC.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompanies this
* distribution. The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution
*License is available at https://eclipse.org/org/documents/edl-v10.php
*
* Contributors:
* Thien Nguyen - initial API and implementation
*******************************************************************************/
#pragma once
#include "Algorithm.hpp"
namespace
xacc
{
namespace
algorithm
{
class
QAOA
:
public
Algorithm
{
public:
bool
initialize
(
const
HeterogeneousMap
&
parameters
)
override
;
const
std
::
vector
<
std
::
string
>
requiredParameters
()
const
override
;
void
execute
(
const
std
::
shared_ptr
<
AcceleratorBuffer
>
buffer
)
const
override
;
std
::
vector
<
double
>
execute
(
const
std
::
shared_ptr
<
AcceleratorBuffer
>
buffer
,
const
std
::
vector
<
double
>
&
parameters
)
override
;
const
std
::
string
name
()
const
override
{
return
"QAOA"
;
}
const
std
::
string
description
()
const
override
{
return
""
;
}
DEFINE_ALGORITHM_CLONE
(
QAOA
)
};
}
// namespace algorithm
}
// namespace xacc
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment