Download The Omega Library - Computer Science
Transcript
F_And *S1_root = S1.add_and()
GEQ_Handle tmin = S1_root->add_GEQ()
// t-1 >= 0
tmin.update_coef(t, 10)
tmin.update_coef(t, -9)
// t now has coef. 1
tmin.update_const(-1)
GEQ_Handle tmax = S1_root->add_GEQ()
// n-t >= 0
tmax.update_coef(S1s_n,1)
tmax.update_coef(t, -1)
F_Or *S2_root = S2.add_or()
F_And *part1 = S2_root->add_and()
GEQ_Handle xmin = part1->add_GEQ()
xmin.update_coef(x,1)
GEQ_Handle xmax = part1->add_GEQ()
xmax.update_coef(x,-1)
xmax.update_const(100)
F_Exists *exists_y = part1->add_exists()
Variable_ID y = exists_y->declare("y")
F_And *y_stuff = exists_y->add_and()
GEQ_Handle ymin = y_stuff->add_GEQ()
ymin.update_coef(y,1)
ymin.update_coef(S2s_n,-2)
GEQ_Handle ymax = y_stuff->add_GEQ()
ymax.update_coef(x,1)
ymax.update_coef(y,-1)
Stride_Handle y_even = y_stuff->add_stride(2)
y_even.update_coef(y,1)
y_even.update_const(1)
F_And *part2 = S2_root->add_and()
EQ_Handle xvalue = part2->add_EQ()
xvalue.update_coef(x,1)
xvalue.update_const(-17)
Figure 4.2: Example, Part 2: Adding Constraints to S1 and S2
17