I have been using the LpSolve package to solve a minimization problem in my final course work, but I need to reconcile this problem with a maximization problem. Conducting several researches, I believe that the problem is Multi-objective, more precisely Multi-objective linear programming (MOLP). I would like to know if it is possible to work in LpSolve using two different objective functions, my restrictions are exactly the same for both cases. If there is no way to do this using LpSolve, what is recommended to solve this problem?

The expected output for my problem is a vector of 0's and 1's, this is a problem whose solution is yes or no. However, as an objective I need to maximize a certain index and minimize another.


1 Answer 1


There are a variety of ways to deal with multiple objectives, so the answer is "it depends".

Probably the most common approach is to optimize a weighted sum or difference of the individual objective functions (where the weights serve the twin purposes of scaling the individual objective functions to be commensurable and assigning relative priorities). Since you are just replacing one linear objective function with a different (hybrid) linear objective function, lpSolve can definitely handle this.

Another approach, sometimes called lexicographic optimization, assigns preemptive priorities to the individual objective functions. You optimize the highest priority objective first, then lock in the value of that objective and optimize the second highest priority objective, and so on. Not very many solvers support this directly (CPLEX does), and in any case lpSolve does not seem to provide for it. You can still do it, by solving multiple models. After the first model, add a constraint saying that the highest priority objective cannot be worse than its optimal value, and with that added constraint optimize the second highest priority objective. You can do this with lpSolve.

A third approach is to set a cutoff for one objective ("don't do worse than ___") and then optimize the other one. Again, this is straightforward with lpSolve.

So you will need either to figure out weights (first method) or priorities (second and third methods) and maybe a cutoff value (third method), but you can do any of the in lpSolve.

  • $\begingroup$ I've found lexicographic optimization to be quite simple in ompr. Never tried it with lpsolve. I never actually knew the term for it before today... $\endgroup$ Commented Jun 4, 2022 at 0:30
  • $\begingroup$ I greatly appreciate the answer, I have just implemented this solution, in this case I am performing a minimization of a certain attribute, then I select the highest value among the result, and then use it as a constraint for the next optimization. $\endgroup$ Commented Jun 13, 2022 at 14:59
  • $\begingroup$ Did you mean lowest value (since you are minimizing)? $\endgroup$
    – prubin
    Commented Jun 13, 2022 at 16:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.