Skip to content

Adding time-limit for solver execution using API. #127

Answered by m-fleury
Horef asked this question in Q&A
Discussion options

You must be logged in to vote

In essence (I did not try it though):

  1. Create an instance of the terminator https://github.com/arminbiere/cadical/blob/master/src/cadical.hpp#L1104 that reads a boolean must_terminate set to false.
class MyTerminator : public Terminator {
private:
  bool must_terminate = false;
public:
  virtual ~MyTerminator () {};
  virtual bool terminate () {return must_terminate;};
};

MyTerminator terminator ();
  1. Connect that instance to CaDiCaL
cadical->connect_terminator (terminator);
  1. Launch a thread from your program (see https://stackoverflow.com/questions/44616241/c11-how-to-execute-a-function-in-the-main-thread-after-n-seconds). After sleeping the flag must_terminate should be set to true
  2. C…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Horef
Comment options

@m-fleury
Comment options

@Horef
Comment options

Answer selected by Horef
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants