in automl21/scs_neural/utils/utils.py [0:0]
def get_cone_boundaries(cones, combined=True):
"""Returns boundaries of different cones in input cone dictionary"""
boundaries = []
for cone_id in ['f', 'l', 'q', 's', 'ep']:
if cone_id in ['f', 'l', 'ep']:
if cones[cone_id] != 0:
factor = 3 if cone_id == 'ep' else 1
new_bound = factor * cones[cone_id]
if combined:
boundaries.append(new_bound)
else:
boundaries.append([new_bound])
if cone_id in ['q']:
constraints = cones[cone_id]
if combined:
boundaries += constraints
else:
boundaries.append(constraints)
if cone_id in ['s']:
if len(cones[cone_id]) > 0:
k = cones[cone_id][0]
new_bound = int(k * (k+1) / 2)
if combined:
boundaries.append(new_bound)
else:
boundaries.append([new_bound])
return boundaries