Here is a pyqgis recipe that will take in points files with centroids (home addresses) and points (restaurants) and a buffer distance, compute the inverse distances and sum them, then write the result as a new file.
Keep in mind the units are tied to the CRS. This example uses decimal degrees (EPSG:4326).
import processing
#specify the buffer size in map units
bdist = 0.45
#specify paths to data
centpath = "C:/path/to/input/centroids.gpkg"
pointpath = "C:/path/to/input/points.gpkg"
#read in data
centroid_layer = QgsVectorLayer(centpath, "centroids", "ogr")
point_layer = QgsVectorLayer(pointpath, "points", "ogr")
#get centroid features
cent_features = centroid_layer.getFeatures()
#add new field for inverse distances if one does not exist
if centroid_layer.dataProvider().fieldNameIndex("sum_inv_dist") == -1:
centroid_layer.dataProvider().addAttributes([QgsField("sum_inv_dist", QVariant.Double)])
centroid_layer.updateFields()
#iterate through centroids
for idx, cent in enumerate(cent_features):
#get point features
point_features = point_layer.getFeatures()
#initialize sum inverse distance variable
inv_dist_sum = 0
#buffer centroid point
buff = cent.geometry().buffer(bdist, 5)
#iterate through points
for index, point in enumerate(point_features):
#get feature geometry
pointgeom = point.geometry()
#check if point fall within buffer
if pointgeom.within(buff):
#Create a measure object
distance = QgsDistanceArea()
#calculate inverse distance between points
invdist = 1 / (distance.measureLine([pointgeom.asPoint(),cent.geometry().asPoint()]))
#add inverse distance to sum variable
inv_dist_sum = inv_dist_sum + invdist
#get column nubmer of new column
col_id = centroid_layer.dataProvider().fieldNameIndex("sum_inv_dist")
#append inverse distance to layer
centroid_layer.startEditing()
centroid_layer.changeAttributeValue(cent.id(), col_id, inv_dist_sum)
centroid_layer.commitChanges()
#write out result
params = {'INPUT': centroid_layer,
'OUTPUT': 'C:/Path/to/output/points_distances.gpkg',
'LAYER_NAME': 'points_distances'}
processing.run("native:savefeatures", params)