android linear programming lp_solve library

半世苍凉 提交于 2019-12-13 00:26:52

问题


Can someone help me how to use lpsolve55j.jar on Android device. I tried importing it like every other library (putting it in libs folder and adding it in JavaBuildPath -> Libraries) but I got this error:

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

EDIT

OK, so what I need this for is for solving a system of inequalities. Can someone help me to find alternative for this library that can solve this?


回答1:


Apache Commons Math is a pure Java library that contains for example the Simplex algorithm for solving linear programs. Binaries of this library should probably be possible to use as-is in an Android application, alternatively it should be straightforward to build the library specifically for Android.

The associated unit test cases sufficiently illustrates the usage of the Apache Commons Math SimplexSolver for solving different kinds of smaller LP problems.



来源:https://stackoverflow.com/questions/15273887/android-linear-programming-lp-solve-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!