MCPcopy Create free account
hub / github.com/NeuralNetworkVerification/Marabou / createSubQueries

Method createSubQueries

src/engine/LargestIntervalDivider.cpp:28–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26}
27
28void LargestIntervalDivider::createSubQueries( unsigned numNewSubqueries,
29 const String queryIdPrefix,
30 const unsigned previousDepth,
31 const PiecewiseLinearCaseSplit &previousSplit,
32 const unsigned timeoutInSeconds,
33 SubQueries &subQueries )
34{
35 unsigned numBisects = (unsigned)log2( numNewSubqueries );
36
37 List<InputRegion> inputRegions;
38
39 // Create the first input region from the previous case split
40 InputRegion region;
41 List<Tightening> bounds = previousSplit.getBoundTightenings();
42 for ( const auto &bound : bounds )
43 {
44 if ( bound._type == Tightening::LB )
45 {
46 region._lowerBounds[bound._variable] = bound._value;
47 }
48 else
49 {
50 ASSERT( bound._type == Tightening::UB );
51 region._upperBounds[bound._variable] = bound._value;
52 }
53 }
54 inputRegions.append( region );
55
56 // Repeatedly bisect the dimension with the largest interval
57 for ( unsigned i = 0; i < numBisects; ++i )
58 {
59 List<InputRegion> newInputRegions;
60 for ( const auto &inputRegion : inputRegions )
61 {
62 unsigned dimensionToSplit = getLargestInterval( inputRegion );
63 bisectInputRegion( inputRegion, dimensionToSplit, newInputRegions );
64 }
65 inputRegions = newInputRegions;
66 }
67
68 unsigned queryIdSuffix = 1; // For query id
69 // Create a new subquery for each newly created input region
70 for ( const auto &inputRegion : inputRegions )
71 {
72 // Create a new query id
73 String queryId;
74 if ( queryIdPrefix == "" )
75 queryId = queryIdPrefix + Stringf( "%u", queryIdSuffix++ );
76 else
77 queryId = queryIdPrefix + Stringf( "-%u", queryIdSuffix++ );
78
79 // Create a new case split
80 auto split = std::unique_ptr<PiecewiseLinearCaseSplit>( new PiecewiseLinearCaseSplit() );
81 // Add bound as equations for each input variable
82 for ( const auto &variable : _inputVariables )
83 {
84 double lb = inputRegion._lowerBounds[variable];
85 double ub = inputRegion._upperBounds[variable];

Callers

nothing calls this directly

Calls 4

StringfClass · 0.85
TighteningClass · 0.85
storeBoundTighteningMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected