JuliaPy / JuliaPy/pyjulia

Dual not supported

Open
#123 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
893
Forks
101
PR merge metrics
No merged PRs in 30d

Description

[I'm cross posting an issue I have when using pyjulia with PATHSolver
](https://github.com/chkwon/PATHSolver.jl/issues/18).

I can't pass over a lambda function (this appears to be a PATHSolver issue)
```
In [1]: import julia
In [2]: j = julia.Julia()
In [3]: j.sind(10) #works as planned
Out[3]: 0.17364817766693036
In [8]: j.using("PATHSolver")
In [9]: M = np.array([[0, 0, -1, -1], [0, 0, 1, -2], [1, -1, 2, -2], [1, 2, -2, 4]])
In [12]: q = np.array([2, 2, -2, -6])
In [13]: myf = lambda x: M*x + q
In [14]: lb = np.zeros((4,))
In [15]: ub = 100*np.ones((4,))
In [16]: j.solveMCP(myf, lb, ub)
RuntimeError: Julia exception: MethodError(PATHSolver.solveMCP,(PyObject at 0x7f6a70eeb048>,[0.0,0.0,0.0,0.0],[100.0,100.0,100.0,100.0]))

```
Workaround doesn't work either (this appears to be a pyjulia issue?)

```
fwrap = j.eval('f -> (args...) -> f(args...)')
In [20]: j.solveMCP(fwrap(myf), lb, ub)
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
in ()
----> 1 j.solveMCP(fwrap(myf), lb, ub)

RuntimeError: Julia exception: MethodError(convert,(Float64,Dual(0.0,1.0,0.0,0.0,0.0)))
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.