Linear forms over semirings: algorithmic applications and complexity results