-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathToporExternalTypes.hpp
105 lines (95 loc) · 3.15 KB
/
ToporExternalTypes.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// Copyright(C) 2021-2023 Intel Corporation
// SPDX - License - Identifier: MIT
#pragma once
#include <cstdint>
#include <functional>
#include "ColorPrint.h"
namespace Topor
{
// The solver status
enum class TToporStatus : uint8_t
{
// Status unknown
STATUS_UNDECIDED,
// The latest invocation had returned SAT and no clauses contradicting the model were introduced since
STATUS_SAT,
// The latest invocation returned UNSAT, but this status might be temporary (under assumptions)
STATUS_UNSAT,
// The latest invocation returned USER_INTERRUPT
STATUS_USER_INTERRUPT,
/*
* Only unrecoverable status values below
*/
STATUS_FIRST_UNRECOVERABLE,
// The instance is forever contradictory.
STATUS_CONTRADICTORY = STATUS_FIRST_UNRECOVERABLE,
/*
* Only permanently erroneous values below
*/
STATUS_FIRST_PERMANENT_ERROR,
// The instance is in memory-out state, meaning that one of the allocations fails.
STATUS_ALLOC_FAILED = STATUS_FIRST_PERMANENT_ERROR,
// Data doesn't fit into the buffer
STATUS_INDEX_TOO_NARROW,
// Parameter-related error
STATUS_PARAM_ERROR,
// Error while processing assumption-required queries
STATUS_ASSUMPTION_REQUIRED_ERROR,
// Global timeout reached
STATUS_GLOBAL_TIMEOUT,
// Problem when trying to access/write the DRAT file
STATUS_DRAT_FILE_PROBLEM,
// An explicit-clauses-only function invoked in compressed mode
STATUS_COMPRESSED_MISMATCH,
// So-far: cannot accommodate the last possible variable if sizeof(TLit) == sizeof(size_t), since the allocation will fail
STATUS_EXOTIC_ERROR
};
// Return value of Topor solving functions
enum class TToporReturnVal : uint8_t
{
// Satisfiable
RET_SAT,
// Unsatisfiable
RET_UNSAT,
// Time-out for the last Solve invocation (the run-time is beyond user-provided threshold value in Solve's parameter)
RET_TIMEOUT_LOCAL,
// Conflict-out (the number of conflicts is beyond user's threshold value)
RET_CONFLICT_OUT,
// Memory-out
RET_MEM_OUT,
// Interrupted by the user
RET_USER_INTERRUPT,
// Data doesn't fit into the buffer anymore; Try to compile and run Topor with a wider TUInd, if you get this error
RET_INDEX_TOO_NARROW,
// Parameter-related error
RET_PARAM_ERROR,
// Error while processing assumption-required queries
RET_ASSUMPTION_REQUIRED_ERROR,
// Global time-out (the run-time is beyond user-provided threshold value in /global/overall_timeout parameter: the solver is unusable, if this value is returned)
RET_TIMEOUT_GLOBAL,
// Problem with DRAT file generation
RET_DRAT_FILE_PROBLEM,
// Exotic error: see the error string for more information
RET_EXOTIC_ERROR
};
// Literal value in Topor
enum class TToporLitVal : uint8_t
{
VAL_SATISFIED,
VAL_UNSATISFIED,
VAL_UNASSIGNED,
VAL_DONT_CARE,
};
// Callbacks
// Callbacks return TStopTopor, which indicates, whether the solver should be stopped
enum class TStopTopor : bool
{
VAL_STOP,
VAL_CONTINUE
};
// New learnt clause report callback type
template <typename TLit>
using TCbNewLearntCls = std::function<TStopTopor(const std::span<TLit>)>;
// Stop-now callback type
using TCbStopNow = std::function<TStopTopor()>;
}