Bug 128075 - Solver finds solutions for negative goals but "thinks" it has failed
Summary: Solver finds solutions for negative goals but "thinks" it has failed
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
6.1.6.3 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Solver
  Show dependency treegraph
 
Reported: 2019-10-10 13:59 UTC by OfficeUser
Modified: 2023-10-17 03:13 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments
issue_solver.ods (100.71 KB, application/vnd.oasis.opendocument.spreadsheet)
2019-10-10 13:59 UTC, OfficeUser
Details
Test file with missing values in the constraints range. (50.58 KB, application/vnd.oasis.opendocument.spreadsheet)
2021-08-08 09:28 UTC, Todor Balabanov
Details
Test setup screen 1. (421.84 KB, image/png)
2021-08-08 09:29 UTC, Todor Balabanov
Details
Test setup screen 2. (453.80 KB, image/png)
2021-08-08 09:30 UTC, Todor Balabanov
Details
Test setup screen 3. (506.03 KB, image/png)
2021-08-08 09:30 UTC, Todor Balabanov
Details
Test setup screen 4. (508.86 KB, image/png)
2021-08-08 09:31 UTC, Todor Balabanov
Details
Test setup screen 5. (472.21 KB, image/png)
2021-08-08 09:32 UTC, Todor Balabanov
Details
Test setup screen 6. (426.63 KB, image/png)
2021-08-08 09:32 UTC, Todor Balabanov
Details
Test setup screen 7. (455.09 KB, image/png)
2021-08-08 09:33 UTC, Todor Balabanov
Details
Test setup screen 8. (497.57 KB, image/png)
2021-08-08 09:34 UTC, Todor Balabanov
Details
Test setup screen 9. (477.44 KB, image/png)
2021-08-08 09:34 UTC, Todor Balabanov
Details
Minimization of absolute difference. (100.89 KB, application/vnd.oasis.opendocument.spreadsheet)
2021-10-16 10:46 UTC, Georgi Banov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description OfficeUser 2019-10-10 13:59:57 UTC
Created attachment 154900 [details]
issue_solver.ods

Please open the attached spreadsheet. It contains all steps...


Version: 6.3.2.2
Build-ID: 98b30e735bda24bc04ab42594c85f7fd8be07b9c
CPU-Threads: 8; BS: Linux 4.4; UI-Render: Standard; VCL: gtk2; 
Gebietsschema: de-DE (de_DE.UTF-8); UI-Sprache: de-DE
Calc: threaded
Comment 1 Katarina Behrens (Inactive) 2019-10-15 14:18:12 UTC
Yep, as described

Version: 6.1.6.3
Build ID: 6.1.6.3-4.fc29
CPU threads: 8; OS: Linux 5.2; UI render: default; VCL: kde4; 
Locale: en-US (en_US.UTF-8); Calc: group threaded
Comment 2 OfficeUser 2019-10-16 06:58:23 UTC
@Katarina: Thanks for confirming. I think a patch should NOT be very complicated...
Comment 3 Todor Balabanov 2021-08-05 12:18:27 UTC
The bug still exists. I have track it to two possible reasons:

m_success = (m_objectiveCell.getError() == 0 && checkConstraints());

The model has no constraints. It seems that some fake error appears in the objective cell.
Comment 4 Todor Balabanov 2021-08-08 09:28:30 UTC
Created attachment 174132 [details]
Test file with missing values in the constraints range.
Comment 5 Todor Balabanov 2021-08-08 09:29:37 UTC
Created attachment 174133 [details]
Test setup screen 1.
Comment 6 Todor Balabanov 2021-08-08 09:30:08 UTC
Created attachment 174134 [details]
Test setup screen 2.
Comment 7 Todor Balabanov 2021-08-08 09:30:50 UTC
Created attachment 174135 [details]
Test setup screen 3.
Comment 8 Todor Balabanov 2021-08-08 09:31:30 UTC
Created attachment 174136 [details]
Test setup screen 4.
Comment 9 Todor Balabanov 2021-08-08 09:32:13 UTC
Created attachment 174137 [details]
Test setup screen 5.
Comment 10 Todor Balabanov 2021-08-08 09:32:53 UTC
Created attachment 174138 [details]
Test setup screen 6.
Comment 11 Todor Balabanov 2021-08-08 09:33:38 UTC
Created attachment 174139 [details]
Test setup screen 7.
Comment 12 Todor Balabanov 2021-08-08 09:34:06 UTC
Created attachment 174140 [details]
Test setup screen 8.
Comment 13 Todor Balabanov 2021-08-08 09:34:35 UTC
Created attachment 174141 [details]
Test setup screen 9.
Comment 14 Georgi Banov 2021-10-16 10:44:58 UTC
I have checked the functions calls and the problem comes from the fact that the exact value is searched. 

https://github.com/LibreOffice/core/blob/2484de6728bd11bb7949003d112f1ece2223c7a1/sc/source/ui/miscdlgs/optsolver.cxx#L966

The equality target is converted to extra constraint, which gives not found solution after that.

    if ( m_xRbValue->get_active() )
    {
        // handle "value of" with an additional constraint (and then minimize)

        sheet::SolverConstraint aConstraint;
        aConstraint.Left     = aObjective;
        aConstraint.Operator = sheet::SolverConstraintOperator_EQUAL;

        OUString aValStr = m_xEdTargetValue->GetText();
        ScRange aRightRange;
        if ( ParseRef( aRightRange, aValStr, false ) )
            aConstraint.Right <<= table::CellAddress( aRightRange.aStart.Tab(),
                                                      aRightRange.aStart.Col(), aRightRange.aStart.Row() );
        else
        {
            sal_uInt32 nFormat = 0;     //! explicit language?
            double fValue = 0.0;
            if ( mrDoc.GetFormatTable()->IsNumberFormat( aValStr, nFormat, fValue ) )
                aConstraint.Right <<= fValue;
            else
            {
                ShowError( false, m_xEdTargetValue.get() );
                return false;
            }
        }

        aConstraints.realloc( nConstrPos + 1 );
        aConstraints[nConstrPos++] = aConstraint;
    }

The problem does not exists if target is converted to minimization of absolute difference.
Comment 15 Georgi Banov 2021-10-16 10:46:50 UTC
Created attachment 175778 [details]
Minimization of absolute difference.
Comment 16 QA Administrators 2023-10-17 03:13:54 UTC
Dear OfficeUser,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug