如何在Apache Commons Math中执行整数线性编程 [英] How to perform Integer Linear Programming in Apache Commons Math

查看:264
本文介绍了如何在Apache Commons Math中执行整数线性编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

org.apache.commons.math3.optim.linear程序包rel ="nofollow noreferrer"> Apache Commons Math Library 允许线性优化,但返回值是双精度值.有什么方法可以使用此库执行整数线性编程吗?我尝试了谷歌搜索,但似乎在任何地方都没有提到ILP.

The org.apache.commons.math3.optim.linear package in Apache Commons Math Library allows Linear Optimization but the returned values are double. Is there any way to perform Integer Linear Programming using this library? I tried googling but there seems to be no mention of ILP anywhere.

或者,还有其他可以执行ILP的Java库吗?请不要说我需要在android上运行它,以便SCPSolver,GLPK或Or-tools.等是不可能的.

Alternatively, is there any other Java library that can do ILP? please not that I need to run this on android so SCPSolver, GLPK, Or-tools. etc. are not possible.

谢谢.

推荐答案

由于这个问题和"Android线性编程"通常是很少讨论的主题,因此我认为我会将自己的发现发布在这里,以供将来进行搜索的任何人使用.

As this question and 'Linear Programming in Android' in general is a rarely discussed topic, I figured I would post my findings here for anyone searching in the future.

顺便说一句,我最终使用了Ojalgo港口,如下所示.

BTW, I ended up using a port of Ojalgo, given below.

这些是我发现的LP Lib,可以很容易地导入到android项目中:

These are the LP Libs that I found can be readily imported into an android project :

也许是维护最完善的库,该库支持线性优化,但没有"Integer" LP .

Perhaps the most well maintained library, this one supports Linear Optimization but does not have "Integer" LP.

接下来的两个库确实支持Integer LP和/或Mixed Integer LP.

The next two libraries do support Integer LP and/or Mixed Integer LP.

Choco Solver

即使Choco的最新版本(4.0)基于Java 8,也存在版本3.3.3的Java 7变体.您可以在此处.这将毫无问题地导入Android Studio.

Choco Solver

Even though the Latest version of Choco (4.0) is based on Java 8, there is a Java 7 variant of version 3.3.3 . You can find it here. This imports into Android Studio without any issues.

您可能会遇到的另一个问题是,即使在其网站上有版本4的指南和教程,您也将找不到除Javadocs之外的Choco 3的任何指南.但幸运的是,有人制作了旧指南的PDF,您可以通过谷歌搜索 Choco3用户手册" .

Another issue you might run into is that even though there are guides and tutorials on their website for version 4, you wont be able to find any guides for Choco 3 except for the Javadocs. But fortunately someone had made a PDF of the older guides which you can get by Googling "Choco3 User Manual".

还请注意,Choco已获得 Creative Commons署名-NonCommercial-ShareAlike 4.0的许可国际许可证.因此,如果您想在商业项目中使用LP,请考虑下一个选择.

Also note that Choco is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. So if you want to use LP in a commercial project, consider the next option.

Ojalgo是另一个很棒的库,它具有 MIT许可证并支持Java 7.但据我发现,它使用了Android中不可用的几个Java调用.

Ojalgo is another great library which has an MIT Licence and supports Java 7. But as I found out, it uses a couple of Java calls that is not available in Android.

幸运的是, MVP 已将库可在Android中使用: KIC/ojAlgoAndroid

Luckily, an MVP has ported the library to work in Android : KIC/ojAlgoAndroid

此端口运行正常.我已经在Jitpack上创建了一个分支: shahimclt/ojAlgoAndroid .

This port ran with no issues. I have forked and created a release on Jitpack : shahimclt/ojAlgoAndroid.

这篇关于如何在Apache Commons Math中执行整数线性编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆