> Discrete Optimization > Transport: Piecewise Linear Optimization > Solving the Problem

If the problem satisfies the special conditions of a simple linear program, as outlined in Special Considerations about Solving with IloPiecewiseLinear, then an instance of IloCplex (documented in the ILOG CPLEX Reference Manual) will solve the problem with a simplex linear optimizer.

On the other hand, if the problem fits the more general case, and thus requires a mixed integer programming (MIP) for its solution, an instance of IloCplex will solve the problem with a MIP optimizer using branch & bound techniques.

In either case (LP or MIP), the application needs only the following few lines. They create an algorithm (an instance of IloCplex documented in the ILOG CPLEX Reference Manual) in an environment (an instance of IloEnv documented in the ILOG Concert Reference Manual) and extract the model (an instance of IloModel also documented in the Concert Reference Manual) for that algorithm to find a solution.

    IloCplex cplex(env);
    cplex.extract(model);
    cplex.solve();