Djsopnet: add cost to segment

Cost was removed from segment during the pysopnet refactor. Now that it
is stable, add a cost field to segment for caching (when weights and
parameters are unchanged) and front-end display.