Description: The attached workbook demonstrates an optimisation problem with a non-linearity. When using the "LibreOffice Linear Solver" on this problem, Calc reports that "solving successfully finished". But the "solution" violates the constraint that B14=0. To be clear, the bug is not that a linear solver can't solve this problem. The bug is that Calc reports success - what it should do is to detect that the 'solution' violates a constraint, and report that. Steps to Reproduce: Open the attached spreadsheet, and run the model with the given Solver settings (i.e. maximise cell D12 by varying B10 and B11, subject to the constraint B14=0, assuming the variables are non-negative, using “LibreOffice Linear Solver”) Actual Results: Calc reports that “solving successfully finished”, but the “solution” violates the constraint that B14=0. Expected Results: Calc should report that no acceptable solution can be found. (Due to the non-linear dependence of B9 on B10, a linear algorithm is not expected to be able to find a solution - that's not a problem. The problem is that the solver reports that it has succeeded, when it hasn't.) Reproducible: Always User Profile Reset: No Additional Info: Version: 24.8.5.2 (X86_64) Build ID: 480(Build:2) CPU threads: 16; OS: Linux 6.12; UI render: default; VCL: kf6 (cairo+wayland) Locale: en-CA (en_US.UTF-8); UI: en-US Calc: threaded
Created attachment 199869 [details] Spreadsheet with a model that demonstrates the bug
The issue begins with the a bad choice of the solver algorithm, a linear solver applied to a non-linear problem. In logic, if the hypothesis is wrong the results are whatever. The solution could have converged, diverged, get multiple minima or maxima, no one knows. Although I sympathize with the idea of warning user on his mistake, it will require an enormous amount of work/coding to detect a bad-formulated linear problem.
It would indeed take a lot of work to implement generalised logic that detects all cases where a linear solver is applied to a non-linear problem. However, this bug is intended to be much more narrowly defined and tractable than that. The scope is specifically the situation where the "solution" to the problem violates an explicit constraint of the model. In the example attached, the model has a constraint B14=0, but the "solution" produced has B14!=0. In this situation, before presenting the solution to the user and applying it to the sheet, it should be possible to do a final check that evaluates each constraint against the solution produced by the solver. If any constraint is violated, then reject the solution and advise the user that no solution could be found.