Terahertz Driven Linear Programming