Optimization problems occur frequently in more sophisticated reasoning problems. Tweety provides bridges to several third-party optimization solvers and distinguishes currently between two important categories of optimization solvers: solvers for linear optimization problems and solver for general optimization problems. It is required that at least one solver for linear problems and one solver for general problems are explicitly configured as default solvers.
For linear optimization problems, Tweety has built-in support for the Apache Commons Simplex solver which is also set as the default solver for linear problems (if there is also no solver for general problems configured). However, whenever you perform a reasoning task that involves a linear optimization solver, a warning message is printed out that no linear solver is configured and ApacheCommonsSimplex is used as a default. If you do not care about performance issues and only want to get rid of the warning message, you should configure ApacheCommonsSimplex as your default solver for linear problems explicitly. To do that, simply add the following lines somewhere before you invoke your reasoning task for the first time:
However, depending on your reasoning tasks it is recommend that you either configure ApacheCommonsSimplex further or set another linear solver as your default solver. Tweety also supports the integration of e.g. LpSolve. If you have LpSolve installed in your system and the binary lp_solve is accessible in your PATH, you can set it as your default solver for linear problems via:
Unfortunately, to the best of our knowledge there is no free, stable, and versatile Java-based solver for general optimization problems available (if you have one please let us know, we tried out a lot of different approaches). Consequently, there is no default solver for general optimization problems available in Tweety. We recommend installing the OpenOpt solver suite (which is freely available and written in Python). If OpenOpt is installed on your system and the binary python is accessible in your PATH, you can set OpenOpt as your default solver for general problems via:
The above given code lines set the corresponding solvers as default solvers with default settings. Please be aware that, depending on your actual problem that is to be solved, the configuration of your solver is a crucial issue and influences the quality of the results significantly.
If your favorite solver is not supported, please have a look at the Solver.java interface in the net.sf.tweety.math.opt package and think about implementing a bridge yourself and contribute it to Tweety.