Dear everyone,

I would like to ask you a question, about the constraints in cvx, in my program involves constraints on time, I set the maximum time to Tmax, in the program I will Tmax = 25, and use this constraint to get the solution of the variable, but when using the obtained solution to recalculate the time, I found that the time obtained is slightly larger than the constraint Tmax, which may be caused by error, I want to ask you know how to solve this problem?

Here is my code and the result in pycharm.

*def second_caculate_time_slot_and_fk(pruning_ratio, power):

generate_channel()

timeslot = cp.Variable(device_num, nonneg=True)

f = cp.Variable(device_num, nonneg=True)

constraints = []

print('Tmax is ', Tmax)

for i in range(device_num):

constraints = constraints + [

((local_batchsize[i] * dc * (1 - pruning_ratio[i]) * cp.inv_pos(f[i])) + (q * M * (1 - pruning_ratio[i])) /

(Band * math.log2(1 + power[i] * H[i]/N0)) * cp.inv_pos(timeslot[i])) - Tmax <= 0]

constraints = constraints + [cp.sum(timeslot) <= 1]

constraints = constraints + [f <= fk_max]

constraints = constraints + [fk_min <= f]

constraints = constraints + [timeslot <= [1, 1, 1, 1, 1]]

constraints = constraints + [[0, 0, 0, 0, 0] <= timeslot]

```
convergence_speed = []
for j in range(device_num):
convergence_speed.append(pruning_ratio[j])
energy = []
for k in range(device_num):
energy.append((energy_coefficient * cp.square(f[k]) * dc * local_batchsize[k] * (1 - pruning_ratio[k])) +
(((q * M * (1 - pruning_ratio[k]) * power[k]) / (Band * math.log2(1 + power[k]*H[k]/N0))) * cp.inv_pos(timeslot[k])))
#obj = cp.Minimize(alpha * cp.sum(convergence_speed) + beta * cp.sum(cp.hstack(energy)))
obj = cp.Minimize(beta * cp.sum(energy) + (alpha) * cp.sum(pruning_ratio))
problem = cp.Problem(obj, constraints)
problem.solve(solver=MOSEK, mosek_params={mosek.iparam.intpnt_solve_form: mosek.solveform.primal})
#problem.solve(solver=cp.MOSEK, )
#problem.solve(solver=MOSEK, mosek_params={mosek.iparam.intpnt_solve_form: mosek.solveform.primal})
print('====================================================result in 2', problem.value )
time = np.zeros(device_num)
for z in range(device_num):
time[z] = ((local_batchsize[z] * dc * (1 - pruning_ratio[z]) / f[z].value) + (q * M * (1 - pruning_ratio[z])) /
(Band * math.log2(1 + power[z]*H[z]/N0)) / timeslot[z].value)
print('time in 2', time)*
```

**result in pycharm**

*Tmax is 25
time in 2 [25.00000016 25.00000017 25.00000016 25.00000015 25.00000015]*