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

Method execute

src/nlr/DeepPolyAbsoluteValueElement.cpp:34–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32}
33
34void DeepPolyAbsoluteValueElement::execute(
35 const Map<unsigned, DeepPolyElement *> &deepPolyElementsBefore )
36{
37 log( "Executing..." );
38 ASSERT( hasPredecessor() );
39 allocateMemory();
40
41 // Update the symbolic and concrete upper- and lower- bounds
42 // of each neuron
43 for ( unsigned i = 0; i < _size; ++i )
44 {
45 NeuronIndex sourceIndex = *( _layer->getActivationSources( i ).begin() );
46 DeepPolyElement *predecessor = deepPolyElementsBefore[sourceIndex._layer];
47 double sourceLb = predecessor->getLowerBound( sourceIndex._neuron );
48 double sourceUb = predecessor->getUpperBound( sourceIndex._neuron );
49
50 if ( !FloatUtils::isNegative( sourceLb ) )
51 {
52 // Phase active
53 // Symbolic bound: x_b <= x_f <= x_b
54 // Concrete bound: lb_b <= x_f <= ub_b
55 _symbolicUb[i] = 1;
56 _symbolicUpperBias[i] = 0;
57 _ub[i] = sourceUb;
58
59 _symbolicLb[i] = 1;
60 _symbolicLowerBias[i] = 0;
61 _lb[i] = sourceLb;
62 }
63 else if ( !FloatUtils::isPositive( sourceUb ) )
64 {
65 // Phase inactive
66 // Symbolic bound: -x_b <= x_f <= -x_b
67 // Concrete bound: -ub_b <= x_f <= -lb_b
68 _symbolicUb[i] = -1;
69 _symbolicUpperBias[i] = 0;
70 _ub[i] = -sourceLb;
71
72 _symbolicLb[i] = -1;
73 _symbolicLowerBias[i] = 0;
74 _lb[i] = -sourceUb;
75 }
76 else
77 {
78 // AbsoluteValue not fixed
79 // Naive concretization: 0 <= x_f <= max(-lb, ub)
80 _symbolicUb[i] = 0;
81 double upperBound = FloatUtils::max( -sourceLb, sourceUb );
82 _symbolicUpperBias[i] = upperBound;
83 _ub[i] = upperBound;
84
85 _symbolicLb[i] = 0;
86 _symbolicLowerBias[i] = 0;
87 _lb[i] = 0;
88 }
89 log( Stringf( "Neuron%u LB: %f b + %f, UB: %f b + %f",
90 i,
91 _symbolicLb[i],

Callers

nothing calls this directly

Calls 5

StringfClass · 0.85
getActivationSourcesMethod · 0.80
beginMethod · 0.45
getLowerBoundMethod · 0.45
getUpperBoundMethod · 0.45

Tested by

no test coverage detected