@Override
  public List<Command<Ui>> convert() throws CannotConvertModelException {
    List<Command<Ui>> commands = new ArrayList<Command<Ui>>();

    ImmutableLinearObjfunc objfunc = this.model.getObjfunc();
    ImmutableSolution solution = this.model.getCurrentSolution();
    List<ImmutableSolution> solutionHistory = new ArrayList<ImmutableSolution>();
    List<ImmutableLinearConstraint> constraints = this.model.getConstraints();

    // ==> Convertion based on the objective (it must be minimization in a standard linear model)
    if (!this.model.getObjective().equals(Objective.MIN)) {
      objfunc = objfunc.multiply(BigDecimal.valueOf(-1));
      if (solution != null) {
        solution = DefaultImmutableSolution.create(objfunc, solution.getVarsValues(),
            solution.getCoefficient().multiply(BigDecimal.valueOf(-1)));
      }
    }
    // ==> Convertion based on the constraints
    for (int i = 0; i < constraints.size(); i++) {
      // ==> All of the constant-terms must be positive
      ImmutableLinearConstraint constraint = constraints.get(i);
      if (constraint.getConstantTerm().compareTo(BigDecimal.ZERO) == -1) {
        constraint = constraint.multiply(BigDecimal.valueOf(-1));
      }
      // ==> All of the constraints must be disequations
      if (constraint.getSign().equals(ConstraintSign.Equal)) {
        constraints.set(i, constraint.duplicate(null, ConstraintSign.LessEqual, null));
        constraints.add(constraint.duplicate(null, ConstraintSign.GreaterEqual, null));
      }
    }

    solutionHistory.add(solution);

    this.model.setObjfunc(objfunc);
    this.model.setConstraints(constraints);
    this.model.setObjective(Objective.MIN);
    this.model.setSolutionHistory(solutionHistory);

    // { Create the commands
    for (Integer idx = 0; idx < constraints.size(); idx++) {
      ImmutableLinearConstraint constraint = constraints.get(idx);
      for (Variable var : constraint.getVariables()) {
        commands.add(new SetConstraintVariableCommand(idx, var.getId(), var.getCoefficient()));
      }
      commands.add(new SetConstraintSignCommand(idx, constraint.getSign()));
      commands.add(new SetConstraintConstantTermCommand(idx, constraint.getConstantTerm()));
    }

    for (Variable var : objfunc.getVariables()) {
      commands.add(new SetObjfuncVariableCommand(var.getId(), var.getCoefficient()));
    }
    // }

    return commands;
  }