@lp
      constraints
        7 == x1 - 1 * x2
        2 * x1 + x3 / 2 <= 7
        x2 + -3 * x3 >= 8
        3 <= x2 - 2 * x1 <= 8
      bounds
        x1 >= 3
        2 <= x2 <= 5
        0 <= x3 <= 8
      objective
        min x1 + 2 * x2 - x3
The first part gives the constraints to the lp. The constraints could be equality, lower bound, upper bound or range for an expression or equality, less or more for two expressions.
The second part gives the bounds for the variables. The bounds could be the same as for the single expression so equality, lower bound, upper bound or range.
The third part is the objective function, it should start with min or max and then a valid linear expression.
If an LP variable does not have name in the writer, then it will automatically created in the writer. This make a slight change in the const variable.
The basic way to write an LP problem is made by the next code:
Of course instead of LemonWriter you can give a GraphWriter to the LpWriter constructor. Also useful that you can mix lp problems and graphs in the same file. #include <lemon/lp_utils.h>

| Public Member Functions | |
| LpWriter (LemonWriter &_writer, const LpSolverBase &_lp, const std::string &_name=std::string()) | |
| Constructor. | |
| virtual | ~LpWriter () | 
| Destructor. | |
| Protected Member Functions | |
| virtual std::string | header () | 
| Gives back true when the SectionWriter can process the section with the given header line. | |
| virtual void | write (std::ostream &os) | 
| Writer function of the section. | |
| LpWriter | ( | LemonWriter & | _writer, | |
| const LpSolverBase & | _lp, | |||
| const std::string & | _name = std::string() | |||
| ) |  [inline] | 
Constructor for LpWriter. It creates the LpWriter and attach it into the given LemonWriter.
| virtual std::string header | ( | ) |  [inline, protected, virtual] | 
It gives back the header line of the @lp section. 
Implements SectionWriter.
| virtual void write | ( | std::ostream & | os | ) |  [inline, protected, virtual] | 
It writes the content of the section.
Implements SectionWriter.
 1.5.9
 1.5.9