gurobi和java,在Java中使用Gurobi与在Ampl中使用Gurobi

What are the advantages of using Gurobi with AMPL instead of using Gurobi direct API (java, C#, C++, etc.) for solving large MIP problems? Are there performance benefits when using Gurobi's API instead of AMPL?

解决方案

Up until the mid 90's the only practical options for using a MIP solver with large scale problems (so excluding spreadsheets) were

creating mps files

using the low-level C interface (known as the callable library in cplex)

using a domain specific language like AMPL or GAMS.

At the time, for MIP models of nontrivial complexity, the AMPL models would be much more concise, readable and easier to maintain. Even today and AMPL model is going to look much more like a mathematical formulation than anything else.

One advantage of AMPL is its data structures, however today the standard libraries for C#, Java and C++ all have great data structures. Another advantage of AMPL is that its syntax looks very intuitive

subject to {j in J} sum {i in I} x[i,j] <= b[j]

but the new C++0x and the latest versions of Java have syntax that more closely mimics this.

AMPL is portable between solvers, however the interfaces don't differ that much between solvers. While it's not a trivial task to port an application from one solver to another, for me it hasn't been as big of a deal as trying to switch databases (say from MySQL to Postgres).

There are some specific disadvantages of AMPL. For most business applications, introducing AMPL to a project means adding another programming language to the mix. Time spent learning AMPL will be useful only for writing math programming models. AMPL has a tiny user base compared with Java, C# or even C++ and improvements to the underlying technology come from only one small company (full of very smart people, but a single small company nonetheless). If you want to use a hybrid approach to solving your optimization problem (for example, a column generation strategy with a heuristic to generate additional columns), you are left to some kludges. If you want to do something like run your solver until 1% of optimality, but run for at least 10 seconds, you can't do that with AMPL, but could do it with callbacks using one of the Gurobi APIs.

Python may offer the best of both worlds. It is a general purpose programming language that is a wide variety of application areas. Gurobi has its own Python API, but there are internal domain specific languages like PuLP and Pyomo which portable between solvers.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值