GCC Code Coverage Report
Directory: . Exec Total Coverage
File: build-coverage/src/options/uf_options.cpp Lines: 6 59 10.2 %
Date: 2021-09-10 Branches: 5 46 10.9 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Mathias Preiner, Aina Niemetz
4
 *
5
 * This file is part of the cvc5 project.
6
 *
7
 * Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
8
 * in the top-level source directory and their institutional affiliations.
9
 * All rights reserved.  See the file COPYING in the top-level source
10
 * directory for licensing information.
11
 * ****************************************************************************
12
 *
13
 * Option template for option modules.
14
 *
15
 * For each <module>_options.toml configuration file, mkoptions.py
16
 * expands this template and generates a <module>_options.cpp file.
17
 */
18
#include "options/uf_options.h"
19
20
#include <iostream>
21
22
#include "base/check.h"
23
#include "options/option_exception.h"
24
25
// clang-format off
26
namespace cvc5::options {
27
28
std::ostream& operator<<(std::ostream& os, UfssMode mode)
29
{
30
  switch(mode) {
31
    case UfssMode::NONE:
32
      return os << "UfssMode::NONE";
33
    case UfssMode::FULL:
34
      return os << "UfssMode::FULL";
35
    case UfssMode::NO_MINIMAL:
36
      return os << "UfssMode::NO_MINIMAL";
37
    default:
38
      Unreachable();
39
  }
40
  return os;
41
}
42
7
UfssMode stringToUfssMode(const std::string& optarg)
43
{
44
7
  if (optarg == "none")
45
  {
46
    return UfssMode::NONE;
47
  }
48
7
  else if (optarg == "full")
49
  {
50
    return UfssMode::FULL;
51
  }
52
7
  else if (optarg == "no-minimal")
53
  {
54
7
    return UfssMode::NO_MINIMAL;
55
  }
56
  else if (optarg == "help")
57
  {
58
    std::cerr << "UF with cardinality options currently supported by the --uf-ss option when\n"
59
         "combined with finite model finding.\n"
60
         "Available modes for --uf-ss are:\n"
61
         "+ none\n"
62
         "  Do not use UF with cardinality to shrink model sizes.\n"
63
         "+ full (default)\n"
64
         "  Default, use UF with cardinality to find minimal models for uninterpreted\n"
65
         "  sorts.\n"
66
         "+ no-minimal\n"
67
         "  Use UF with cardinality to shrink models, but do no enforce minimality.\n";
68
    std::exit(1);
69
  }
70
  throw OptionException(std::string("unknown option for --uf-ss: `") +
71
                        optarg + "'.  Try --uf-ss=help.");
72
}
73
74
namespace uf
75
{
76
// clang-format off
77
void setDefaultUfSymmetryBreaker(Options& opts, bool value)
78
{
79
    if (!opts.uf.ufSymmetryBreakerWasSetByUser) {
80
        opts.uf.ufSymmetryBreaker = value;
81
    }
82
}
83
void setDefaultUfHo(Options& opts, bool value)
84
{
85
    if (!opts.uf.ufHoWasSetByUser) {
86
        opts.uf.ufHo = value;
87
    }
88
}
89
void setDefaultUfHoExt(Options& opts, bool value)
90
{
91
    if (!opts.uf.ufHoExtWasSetByUser) {
92
        opts.uf.ufHoExt = value;
93
    }
94
}
95
void setDefaultUfssAbortCardinality(Options& opts, int64_t value)
96
{
97
    if (!opts.uf.ufssAbortCardinalityWasSetByUser) {
98
        opts.uf.ufssAbortCardinality = value;
99
    }
100
}
101
void setDefaultUfssFairness(Options& opts, bool value)
102
{
103
    if (!opts.uf.ufssFairnessWasSetByUser) {
104
        opts.uf.ufssFairness = value;
105
    }
106
}
107
void setDefaultUfssFairnessMonotone(Options& opts, bool value)
108
{
109
    if (!opts.uf.ufssFairnessMonotoneWasSetByUser) {
110
        opts.uf.ufssFairnessMonotone = value;
111
    }
112
}
113
void setDefaultUfssTotalityLimited(Options& opts, int64_t value)
114
{
115
    if (!opts.uf.ufssTotalityLimitedWasSetByUser) {
116
        opts.uf.ufssTotalityLimited = value;
117
    }
118
}
119
void setDefaultUfssTotalitySymBreak(Options& opts, bool value)
120
{
121
    if (!opts.uf.ufssTotalitySymBreakWasSetByUser) {
122
        opts.uf.ufssTotalitySymBreak = value;
123
    }
124
}
125
void setDefaultUfssMode(Options& opts, UfssMode value)
126
{
127
    if (!opts.uf.ufssModeWasSetByUser) {
128
        opts.uf.ufssMode = value;
129
    }
130
}
131
// clang-format on
132
}
133
134
29502
}  // namespace cvc5::options
135
// clang-format on