How to troubleshoot the DEPS Solver initialization error in macro in Calc 7.3?

I want to use the DEPS solver inside a macro and get an error. For this report, I have used an example from https://wiki.openoffice.org/wiki/NLPSolver. The macro blows up on the command:
Solver.Objective = ObjectiveCell with the following message:

Message: [jni_uno bridge error] UNO calling Java method Objective: [map_to_uno0:com.sun.star.table.CellAddress] null-ref given! java stack trace: ./bridges/source/jni_uno/jni_uno2java.cxx:783.

The problem relates to LO Calc version: 7.3.5.2.

Thanks in advance for your advice.

For me, runs to completion, per se, on Calc 7.4.2 on Windows 10 with no special provisions.

Put

If IsNull(ObjectCell) Then MsgBox "ObjectivCell is null."

before the method call to prove to yourself that is the case. Have you modified the ObjectiveCell reference in any way? Are you still going after simple sheet 0, etc.?

1 Like

Thanks for your efforts, but it doesn’t work for me.

  1. I have specially installed LO 7.4.1.2 via snap.

  2. I installed the extension from the nlpsolver.oxt file for this version of LO.

  3. I am getting the same error.

  4. The ObjectCell contains the cell address and is not Null

I’m still looking for a solution.

Have you tried a full install of LO, rather than a snap install? That would be a difference in our systems.

Hi @joshua4,
I have installed version LO 7.4.2.3 on Windows 10 machine, and I confirm - The DEPS solver works fine :slight_smile:.
Now I need to find a solution for Linux Mint 21 Cinnamon. After installing the snap, I have two versions of LO 7.2 and 7.4. In this setup, version 7.4 is extremely slow, so I’m looking for a way to avoid uninstalling version 7.2 permanently. Does anyone have a similar experience?

No progress for me today. But I have an interesting observation. In sequence:

  MsgBox IsNull(oSolver.Variables)
  MsgBox IsNull(oSolver.Constraints)
  MsgBox IsNull(oSolver.Objectives)

the first two statements correctly return False, and the last one informs that Objectives was not found. How to explain it?

It is odd that you have oSolver.Objectives in the plural. Variables and Contraints are arrays, but Objective (singular) is just a CellAddress object.

1 Like

That’s right; it should be oSolver.Objective But after the fix, there is the same exception:

Type: com.sun.star.uno.RuntimeException
Message: [jni_uno bridge error] UNO calling Java method Objective:
[map_to_uno():com.sun.star.table.CellAddress] null-ref given!
java stack trace:
./bridges/source/jni_uno/jni_uno2java.cxx:783. 

I am unsure, but this could be the problem. NLPSolver is bundled in LibreOffice; I know that at least some distros provide separate packages for the solver - see e.g. libreoffice-nlpsolver package in Ubuntu.

So possibly it’s something with the OXT? Where does it come from?

See the history of the solver in LibreOffice source tree.

Likely this is tdf#87074, which was fixed in 2015, and which is still there in the OXT?

The separate package for the solver is available in Software Manager, for me it is Mintinstall. This appears to be the same package as available in the packages.ubuntu.com repository. I tried both ways of installing, and installing the nlpsolver.oxt file is necessary anyway. After this step t here are two nlpsolver extensions in the list of extensions, one from the oxt file and one from the repository. These treatments do not help accessing the Objective attribute - the error is still thrown.
How to make the nlpsolver extension offered by Software Manager visible in LibreOffice and LO Basic?