GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/arith/dual_simplex.h Lines: 7 7 100.0 %
Date: 2021-03-22 Branches: 0 0 0.0 %

Line Exec Source
1
/*********************                                                        */
2
/*! \file dual_simplex.h
3
 ** \verbatim
4
 ** Top contributors (to current version):
5
 **   Tim King, Mathias Preiner, Morgan Deters
6
 ** This file is part of the CVC4 project.
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.\endverbatim
11
 **
12
 ** \brief This is an implementation of the Simplex Module for the Simplex for
13
 ** DPLL(T) decision procedure.
14
 **
15
 ** This implements the Simplex module for the Simpelx for DPLL(T) decision
16
 ** procedure.
17
 ** See the Simplex for DPLL(T) technical report for more background.(citation?)
18
 ** This shares with the theory a Tableau, and a PartialModel that:
19
 **  - satisfies the equalities in the Tableau, and
20
 **  - the assignment for the non-basic variables satisfies their bounds.
21
 ** This is required to either produce a conflict or satisifying PartialModel.
22
 ** Further, we require being told when a basic variable updates its value.
23
 **
24
 ** During the Simplex search we maintain a queue of variables.
25
 ** The queue is required to contain all of the basic variables that voilate
26
 ** their bounds.
27
 ** As elimination from the queue is more efficient to be done lazily,
28
 ** we do not maintain that the queue of variables needs to be only basic
29
 ** variables or only variables that satisfy their bounds.
30
 **
31
 ** The simplex procedure roughly follows Alberto's thesis. (citation?)
32
 ** There is one round of selecting using a heuristic pivoting rule.
33
 ** (See PreferenceFunction Documentation for the available options.)
34
 ** The non-basic variable is the one that appears in the fewest pivots.
35
 ** (Bruno says that Leonardo invented this first.)
36
 ** After this, Bland's pivot rule is invoked.
37
 **
38
 ** During this proccess, we periodically inspect the queue of variables to
39
 ** 1) remove now extraneous extries,
40
 ** 2) detect conflicts that are "waiting" on the queue but may not be detected
41
 **    by the current queue heuristics, and
42
 ** 3) detect multiple conflicts.
43
 **
44
 ** Conflicts are greedily slackened to use the weakest bounds that still
45
 ** produce the conflict.
46
 **
47
 ** Extra things tracked atm: (Subject to change at Tim's whims)
48
 ** - A superset of all of the newly pivoted variables.
49
 ** - A queue of additional conflicts that were discovered by Simplex.
50
 **   These are theory valid and are currently turned into lemmas
51
 **/
52
53
#include "cvc4_private.h"
54
55
#pragma once
56
57
#include "theory/arith/simplex.h"
58
#include "util/statistics_registry.h"
59
60
namespace CVC4 {
61
namespace theory {
62
namespace arith {
63
64
8992
class DualSimplexDecisionProcedure : public SimplexDecisionProcedure{
65
public:
66
  DualSimplexDecisionProcedure(LinearEqualityModule& linEq, ErrorSet& errors, RaiseConflict conflictChannel, TempVarMalloc tvmalloc);
67
68
1769324
  Result::Sat findModel(bool exactResult) override
69
  {
70
1769324
    return dualFindModel(exactResult);
71
  }
72
73
private:
74
75
  /**
76
   * Maps a variable to how many times they have been used as a pivot in the
77
   * simplex search.
78
   */
79
  DenseMultiset d_pivotsInRound;
80
81
  Result::Sat dualFindModel(bool exactResult);
82
83
  /**
84
   * This is the main simplex for DPLL(T) loop.
85
   * It runs for at most maxIterations.
86
   *
87
   * Returns true iff it has found a conflict.
88
   * d_conflictVariable will be set and the conflict for this row is reported.
89
   */
90
  bool searchForFeasibleSolution(uint32_t maxIterations);
91
92
93
989464
  bool processSignals(){
94
989464
    TimerStat &timer = d_statistics.d_processSignalsTime;
95
989464
    IntStat& conflictStat  = d_statistics.d_recentViolationCatches;
96
989464
    return standardProcessSignals(timer, conflictStat);
97
  }
98
  /** These fields are designed to be accessible to TheoryArith methods. */
99
  class Statistics {
100
  public:
101
    IntStat d_statUpdateConflicts;
102
    TimerStat d_processSignalsTime;
103
    IntStat d_simplexConflicts;
104
    IntStat d_recentViolationCatches;
105
    TimerStat d_searchTime;
106
107
    ReferenceStat<uint32_t> d_finalCheckPivotCounter;
108
109
    Statistics(uint32_t& pivots);
110
    ~Statistics();
111
  } d_statistics;
112
};/* class DualSimplexDecisionProcedure */
113
114
}/* CVC4::theory::arith namespace */
115
}/* CVC4::theory namespace */
116
}/* CVC4 namespace */