https://bugs.documentfoundation.org/show_bug.cgi?id=128075

--- Comment #14 from Georgi Banov <gba...@abv.bg> ---
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.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to