android线性编程lp_solve库

时间:2013-03-07 14:34:53

标签: android linear-programming lpsolve

有人可以帮助我在Android设备上使用lpsolve55j.jar。我尝试像其他库一样导入它(将它放在libs文件夹中并将其添加到JavaBuildPath - >库中)但是我收到了这个错误:

03-07 15:28:52.910: W/dalvikvm(3421): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Llpsolve/LpSolve;
03-07 15:28:52.910: D/AndroidRuntime(3421): Shutting down VM
03-07 15:28:52.910: W/dalvikvm(3421): threadid=1: thread exiting with uncaught exception (group=0x9e495930)
03-07 15:28:52.910: E/AndroidRuntime(3421): FATAL EXCEPTION: main
03-07 15:28:52.910: E/AndroidRuntime(3421): java.lang.UnsatisfiedLinkError: Couldn't load lpsolve55j from loader dalvik.system.PathClassLoader[dexPath=/data/app/com.app.cutstockan-2.apk,libraryPath=/data/app-lib/com.app.cutstockan-2]: findLibrary returned null
03-07 15:28:52.910: E/AndroidRuntime(3421):     at java.lang.Runtime.loadLibrary(Runtime.java:365)
03-07 15:28:52.910: E/AndroidRuntime(3421):     at java.lang.System.loadLibrary(System.java:535)
03-07 15:28:52.910: E/AndroidRuntime(3421):     at lpsolve.LpSolve.<clinit>(LpSolve.java:275)
03-07 15:28:52.910: E/AndroidRuntime(3421):     at com.app.cutstockan.Calculate.generateEquations(Calculate.java:123)
03-07 15:28:52.910: E/AndroidRuntime(3421):     at com.app.cutstockan.Calculate.<init>(Calculate.java:52)
03-07 15:28:52.910: E/AndroidRuntime(3421):     at com.app.cutstockan.Main$1.onClick(Main.java:37)
03-07 15:28:52.910: E/AndroidRuntime(3421):     at android.view.View.performClick(View.java:4204)
03-07 15:28:52.910: E/AndroidRuntime(3421):     at android.view.View$PerformClick.run(View.java:17355)
03-07 15:28:52.910: E/AndroidRuntime(3421):     at android.os.Handler.handleCallback(Handler.java:725)
03-07 15:28:52.910: E/AndroidRuntime(3421):     at android.os.Handler.dispatchMessage(Handler.java:92)
03-07 15:28:52.910: E/AndroidRuntime(3421):     at android.os.Looper.loop(Looper.java:137)
03-07 15:28:52.910: E/AndroidRuntime(3421):     at android.app.ActivityThread.main(ActivityThread.java:5202)
03-07 15:28:52.910: E/AndroidRuntime(3421):     at java.lang.reflect.Method.invokeNative(Native Method)
03-07 15:28:52.910: E/AndroidRuntime(3421):     at java.lang.reflect.Method.invoke(Method.java:511)
03-07 15:28:52.910: E/AndroidRuntime(3421):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
03-07 15:28:52.910: E/AndroidRuntime(3421):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
03-07 15:28:52.910: E/AndroidRuntime(3421):     at dalvik.system.NativeStart.main(Native Method)
03-07 15:28:54.650: I/Process(3421): Sending signal. PID: 3421 SIG: 9

修改

好的,所以我需要的是解决一个不平等的系统。有人可以帮我找到可以解决这个问题的库吗?

1 个答案:

答案 0 :(得分:2)

Apache Commons Math是一个纯Java库,包含例如用于求解线性程序的Simplex算法。这个库的二进制文件应该可以在Android应用程序中原样使用,或者可以直接构建专门用于Android的库。

关联的unit test cases充分说明了使用 Apache Commons Math SimplexSolver来解决不同类型的小型LP问题。