https://github.com/minizinc/cpp-integration
https://github.com/minizinc/cpp-integration
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/minizinc/cpp-integration
- Owner: MiniZinc
- Created: 2015-09-05T07:27:30.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2023-10-17T00:34:03.000Z (over 2 years ago)
- Last Synced: 2025-12-26T05:56:24.674Z (6 months ago)
- Language: C++
- Size: 506 KB
- Stars: 0
- Watchers: 4
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
#### 1. Create a connector instance
```c++
unsigned int port = 6565;
```
```c++
Connector c(port);
```
#### 2. Establish a connection and start a new search tree
```c++
/// Establishes a socket connection using the port specified above
c.connect();
/// Tells the profiler to start a new tree
c.restart("example");
/// Also used in case of a restart with restart id specified
c.restart("example", 1);
```
#### 3. Send data every time the solver branches/fails/finds a solution
```c++
/// Create a node on a stack with mandatory fields
Node node = c.createNode(node_id, parent_id, alt, kids, status);
```
```c++
// Specify optional fields (whichever available)
node.set_label("b");
```
```c++
// Send the node
c.sendNode(node);
```
Or all in one line:
```c++
c.createNode(node_id, parent_id, alt, kids, status).set_label("b").send();
```
The parameters are:
field | type | description
------ | ---- | -----------
node_id | int | current node's identifier
parent_id | int | identifier of node's parent
alt | int | which of its siblings the node is (0 for the left-most)
kids | int | number of children
status | Profiling::NodeStatus | determines the node's type (solution, failure, branching etc)
label | std::string | some text-based information to go along with the node (ie branching decision
#### 4. Finish the tree and release the socket
```c++
c.done();
c.disconnect();
```