LLMOPT: Learning to Define and Solve General Optimization Problems from Scratch