GCC Code Coverage Report
Directory: . Exec Total Coverage
File: build-coverage/src/options/uf_options.cpp Lines: 3 37 8.1 %
Date: 2021-09-16 Branches: 3 42 7.1 %

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
namespace cvc5::options {
26
27
// clang-format off
28
std::ostream& operator<<(std::ostream& os, UfssMode mode)
29
{
30
  switch(mode)
31
  {
32
    case UfssMode::NO_MINIMAL: return os << "UfssMode::NO_MINIMAL";
33
    case UfssMode::NONE: return os << "UfssMode::NONE";
34
    case UfssMode::FULL: return os << "UfssMode::FULL";
35
    default: Unreachable();
36
  }
37
  return os;
38
}
39
7
UfssMode stringToUfssMode(const std::string& optarg)
40
{
41
7
  if (optarg == "no-minimal") return UfssMode::NO_MINIMAL;
42
  else if (optarg == "none") return UfssMode::NONE;
43
  else if (optarg == "full") return UfssMode::FULL;
44
  else if (optarg == "help")
45
  {
46
    std::cerr << R"FOOBAR(
47
  UF with cardinality options currently supported by the --uf-ss option when
48
  combined with finite model finding.
49
Available modes for --uf-ss are:
50
+ no-minimal
51
  Use UF with cardinality to shrink models, but do no enforce minimality.
52
+ none
53
  Do not use UF with cardinality to shrink model sizes.
54
+ full (default)
55
  Default, use UF with cardinality to find minimal models for uninterpreted
56
  sorts.
57
)FOOBAR";
58
    std::exit(1);
59
  }
60
  throw OptionException(std::string("unknown option for --uf-ss: `") +
61
                        optarg + "'.  Try --uf-ss=help.");
62
}
63
// clang-format on
64
65
namespace uf
66
{
67
// clang-format off
68
void setDefaultUfSymmetryBreaker(Options& opts, bool value)
69
{
70
    if (!opts.uf.ufSymmetryBreakerWasSetByUser) opts.uf.ufSymmetryBreaker = value;
71
}
72
void setDefaultUfHo(Options& opts, bool value)
73
{
74
    if (!opts.uf.ufHoWasSetByUser) opts.uf.ufHo = value;
75
}
76
void setDefaultUfHoExt(Options& opts, bool value)
77
{
78
    if (!opts.uf.ufHoExtWasSetByUser) opts.uf.ufHoExt = value;
79
}
80
void setDefaultUfssMode(Options& opts, UfssMode value)
81
{
82
    if (!opts.uf.ufssModeWasSetByUser) opts.uf.ufssMode = value;
83
}
84
void setDefaultUfssAbortCardinality(Options& opts, int64_t value)
85
{
86
    if (!opts.uf.ufssAbortCardinalityWasSetByUser) opts.uf.ufssAbortCardinality = value;
87
}
88
void setDefaultUfssFairness(Options& opts, bool value)
89
{
90
    if (!opts.uf.ufssFairnessWasSetByUser) opts.uf.ufssFairness = value;
91
}
92
void setDefaultUfssFairnessMonotone(Options& opts, bool value)
93
{
94
    if (!opts.uf.ufssFairnessMonotoneWasSetByUser) opts.uf.ufssFairnessMonotone = value;
95
}
96
// clang-format on
97
}
98
99
29577
}  // namespace cvc5::options