Commit 4d1e6866 authored by Mccaskey, Alex's avatar Mccaskey, Alex
Browse files

updating to include chain_strength option on default param setter


Signed-off-by: Mccaskey, Alex's avatarAlex McCaskey <mccaskeyaj@ornl.gov>
parent 8cf587f8
......@@ -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>>
......
......@@ -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) {
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment