Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ int breadthFirstSearchResidual(
std::vector<std::vector<EdgeType>> &adjacency_list, int start_vertex,
std::vector<int> &depth_values, bool reverse = false,
bool print_result = false) {
using capacity_t = typename EdgeType::capacity_type;
// using capacity_t = typename EdgeType::capacity_type;
int num_vertices = adjacency_list.size();
int UNVISITED = num_vertices;
vector_based_queue<int> vertex_queue(num_vertices);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#ifndef IMPLICATION_NETWORK_HPP_INCLUDED
#define IMPLICATION_NETWORK_HPP_INCLUDED

#include <assert.h>
#include "helper_graph_algorithms.hpp"
#include "mapping_policy.hpp"
#include "push_relabel.hpp"
Expand All @@ -36,9 +37,9 @@ template <typename capacity_t> class ImplicationEdge {
ImplicationEdge(int from_vertex, int to_vertex, capacity_t capacity,
capacity_t reverse_capacity, int reverse_edge_index,
int symmetric_edge_index)
: from_vertex(from_vertex), to_vertex(to_vertex), residual(capacity),
: from_vertex(from_vertex), to_vertex(to_vertex),
reverse_edge_index(reverse_edge_index),
symmetric_edge_index(symmetric_edge_index) {
symmetric_edge_index(symmetric_edge_index), residual(capacity) {
assert((!capacity || !reverse_capacity) &&
"Either capacity or reverse edge capacity must be zero.");
_encoded_capacity = (!capacity) ? -reverse_capacity : capacity;
Expand Down Expand Up @@ -116,7 +117,7 @@ class stronglyConnectedComponentsInfo {
stronglyConnectedComponentsInfo(int num_components,
std::vector<int> vertex_to_component_map,
mapper_t &mapper)
: num_components(num_components), num_vertices(mapper.num_vertices()),
: num_vertices(mapper.num_vertices()),num_components(num_components),
vertex_to_component_map(vertex_to_component_map) {
components.resize(num_components);
std::vector<int> component_sizes(num_components, 0);
Expand Down Expand Up @@ -290,7 +291,7 @@ ImplicationNetwork<capacity_t>::ImplicationNetwork(PosiformInfo &posiform) {

for (int variable = 0; variable < _num_variables; variable++) {
int from_vertex = _mapper.variable_to_vertex(variable);
int from_vertex_complement = _mapper.complement(from_vertex);
// int from_vertex_complement = _mapper.complement(from_vertex);
auto quadratic_span = posiform.getQuadratic(variable);
auto it = quadratic_span.first;
auto it_end = quadratic_span.second;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ template <class EdgeType> class PushRelabelSolver {
template <class EdgeType>
PushRelabelSolver<EdgeType>::PushRelabelSolver(
std::vector<std::vector<EdgeType>> &adjacency_list, int source, int sink)
: _adjacency_list(adjacency_list), _source(source), _sink(sink),
_vertex_queue(vector_based_queue<int>(adjacency_list.size())) {
: _sink(sink),_source(source),
_vertex_queue(vector_based_queue<int>(adjacency_list.size())), _adjacency_list(adjacency_list) {
_num_global_relabels = 0;
_num_gap_relabels = 0;
_num_gap_vertices = 0;
Expand Down
8 changes: 5 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@
from distutils.command.build_ext import build_ext as _build_ext

extra_compile_args = {
'msvc': ['/EHsc'],
'unix': ['-std=c++11'],
'msvc': ['/std:c++17', '/EHsc'],
'unix': [
'-std=c++17',
],
}

extra_link_args = {
'msvc': [],
'unix': ['-std=c++11'],
'unix': ['-std=c++17'],
}


Expand Down
14 changes: 9 additions & 5 deletions testscpp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ ROOT := ../
SRC := $(ROOT)/dwave/preprocessing/
CATCH2 := $(ROOT)/testscpp/Catch2/single_include/
DIMOD := $(shell python -c 'import dimod; print(dimod.get_include())')
INCLUDES := -I $(SRC)/include/ -I $(DIMOD) -I $(CATCH2)
FLAGS := -std=c++17 -Wall -Wno-unknown-pragmas -Wno-sign-compare -Wno-deprecated-declarations -fcompare-debug-second -O3

all: catch2 test_main test_main_parallel tests tests_parallel

Expand All @@ -12,13 +14,15 @@ tests_parallel: test_main_parallel.out
./test_main_parallel

test_main: test_main.cpp
g++ -std=c++11 -Wall -c test_main.cpp
g++ -std=c++11 -Wall test_main.o tests/*.cpp -o test_main -I $(SRC)/include/ -I $(DIMOD) -I $(CATCH2)

g++ $(FLAGS) -c test_main.cpp
g++ $(FLAGS) test_main.o tests/*.cpp -o test_main $(INCLUDES)
test_main_parallel: test_main.cpp
g++ -std=c++11 -fopenmp -Wall -c test_main.cpp -o test_main_parallel.o
g++ -std=c++11 -fopenmp -Wall test_main_parallel.o tests/*.cpp -o test_main_parallel -I $(SRC)/include/ -I $(DIMOD) -I $(CATCH2)
g++ $(FLAGS) -fopenmp -c test_main.cpp -o test_main_parallel.o
g++ $(FLAGS) -fopenmp test_main_parallel.o tests/*.cpp -o test_main_parallel $(INCLUDES)

catch2:
git submodule init
git submodule update

clean:
rm -f *.out *.o test_main test_main_parallel