Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ORNL Quantum Computing Institute
xacc
Commits
4d1e6866
Commit
4d1e6866
authored
Feb 04, 2019
by
Mccaskey, Alex
Browse files
updating to include chain_strength option on default param setter
Signed-off-by:
Alex McCaskey
<
mccaskeyaj@ornl.gov
>
parent
8cf587f8
Changes
3
Hide whitespace changes
Inline
Side-by-side
quantum/aqc/compiler/ParameterSetter.hpp
View file @
4d1e6866
...
...
@@ -21,8 +21,7 @@
namespace
xacc
{
namespace
quantum
{
class
__attribute__
((
visibility
(
"default"
)))
ParameterSetter
:
public
Identifiable
{
class
ParameterSetter
:
public
Identifiable
{
public:
virtual
std
::
list
<
std
::
shared_ptr
<
DWQMI
>>
...
...
quantum/aqc/compiler/default/DefaultParameterSetter.cpp
View file @
4d1e6866
...
...
@@ -11,6 +11,7 @@
* Alexander J. McCaskey - initial API and implementation
*******************************************************************************/
#include
"DefaultParameterSetter.hpp"
#include
"XACC.hpp"
namespace
xacc
{
namespace
quantum
{
...
...
@@ -52,6 +53,11 @@ std::list<std::shared_ptr<DWQMI>> DefaultParameterSetter::setParameters(
}
}
double
chain_strength
=
1.0
;
if
(
xacc
::
optionExists
(
"chain_strength"
))
{
chain_strength
=
std
::
stod
(
xacc
::
getOption
(
"chain_strength"
));
}
for
(
int
i
=
0
;
i
<
nHardwareVerts
;
i
++
)
{
for
(
int
j
=
0
;
j
<
nHardwareVerts
;
j
++
)
{
if
(
hardwareGraph
->
edgeExists
(
i
,
j
)
&&
i
<
j
&&
i
!=
j
)
{
...
...
@@ -77,7 +83,7 @@ std::list<std::shared_ptr<DWQMI>> DefaultParameterSetter::setParameters(
std
::
fabs
(
problemGraph
->
getEdgeWeight
(
pi
,
neighbor
));
}
newWeight
+=
std
::
get
<
0
>
(
problemGraph
->
getVertexProperties
(
pi
));
newWeight
*=
-
1.0
;
newWeight
*=
-
1.0
*
chain_strength
;
}
if
(
std
::
fabs
(
newWeight
)
>
1e-4
)
{
...
...
quantum/aqc/compiler/default/DefaultParameterSetter.hpp
View file @
4d1e6866
...
...
@@ -14,13 +14,14 @@
#define QUANTUM_AQC_COMPILER_DefaultParameterSetter_HPP_
#include
"ParameterSetter.hpp"
#include
"OptionsProvider.hpp"
namespace
xacc
{
namespace
quantum
{
/**
*/
class
DefaultParameterSetter
:
public
ParameterSetter
{
class
DefaultParameterSetter
:
public
ParameterSetter
,
public
OptionsProvider
{
public:
/**
...
...
@@ -33,17 +34,29 @@ public:
*/
virtual
~
DefaultParameterSetter
()
{}
virtual
std
::
list
<
std
::
shared_ptr
<
DWQMI
>>
std
::
list
<
std
::
shared_ptr
<
DWQMI
>>
setParameters
(
std
::
shared_ptr
<
DWGraph
>
problemGraph
,
std
::
shared_ptr
<
AcceleratorGraph
>
hardwareGraph
,
Embedding
embedding
);
Embedding
embedding
)
override
;
virtual
const
std
::
string
name
()
const
{
return
"default"
;
}
const
std
::
string
name
()
const
override
{
return
"default"
;
}
virtual
const
std
::
string
description
()
const
{
const
std
::
string
description
()
const
override
{
return
"This ParameterSetter sets Ising parameters as in the JADE "
"publication."
;
}
std
::
shared_ptr
<
options_description
>
getOptions
()
override
{
auto
desc
=
std
::
make_shared
<
options_description
>
(
"Default Parameter Setter Options"
);
desc
->
add_options
()(
"chain-strength"
,
value
<
std
::
string
>
(),
""
);
return
desc
;
}
bool
handleOptions
(
variables_map
&
map
)
override
{
return
false
;
}
};
}
// namespace quantum
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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