Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close Issue #202 #204

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
5 changes: 3 additions & 2 deletions examples/example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@
// limitations under the License.

#include <iostream>
#include "../include/find_embedding.hpp"
#include "../include/find_embedding/find_embedding.hpp"

class MyCppInteractions : public find_embedding::LocalInteraction {
public:
bool _canceled = false;
void cancel() { _canceled = true; }

private:
virtual void displayOutputImpl(const std::string& mess) const { std::cout << mess << std::endl; }
void displayOutputImpl(const std::string& mess) const override { std::cout << mess << std::endl; }
void displayErrorImpl(const std::string& mess) const override { std::cout << mess << std::endl; }
virtual bool cancelledImpl() const { return _canceled; }
};

Expand Down
4 changes: 2 additions & 2 deletions include/find_embedding/find_embedding.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ class parameter_processor {

vector<int> _filter_fixed_vars() {
vector<int> unscrew(num_vars);
assert(var_fixed_unscrewed.size() == num_vars);
assert(num_fixed < num_vars);
iszero(var_fixed_unscrewed.size() == num_vars);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to be a source of problems. Better to change this to minorminer_assert

iszero(num_fixed < num_vars);
for (unsigned int i = 0, front = 0, back = num_vars - num_fixed; i < num_vars; i++) {
if (var_fixed_unscrewed[i]) {
unscrew[back++] = i;
Expand Down
8 changes: 4 additions & 4 deletions include/find_embedding/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ class LocalInteraction {
public:
virtual ~LocalInteraction() {}
//! Print a message through the local output method
void displayOutput(int loglevel, const string& msg) const { displayOutputImpl(loglevel, msg); }
void displayOutput(int loglevel, const string& msg) const { displayOutputImpl(msg); }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not remove loglevel from these functions, as it's used elsewhere in the library. It would be better to add this parameter into the MyCppInteractions overrides and ignore it there.


//! Print an error through the local output method
void displayError(int loglevel, const string& msg) const { displayErrorImpl(loglevel, msg); }
void displayError(int loglevel, const string& msg) const { displayErrorImpl(msg); }

//! Check if someone is trying to cancel the embedding process
int cancelled(const clock::time_point stoptime) const {
Expand All @@ -108,10 +108,10 @@ class LocalInteraction {

private:
//! Print the string to a binding specified sink
virtual void displayOutputImpl(int loglevel, const string&) const = 0;
virtual void displayOutputImpl(const string&) const = 0;

//! Print the error to a binding specified sink
virtual void displayErrorImpl(int loglevel, const string&) const = 0;
virtual void displayErrorImpl(const string&) const = 0;

//! Check if the embedding process has timed out.
virtual bool timedOutImpl(const clock::time_point stoptime) const { return clock::now() >= stoptime; }
Expand Down