简体   繁体   中英

Implementing Scheduling Algorithms with Java

has anyone of you ever dealt with job scheduling problems with Java? I have to work on a resource-constrained project scheduling problem and want to ask for some practical tips. Are there any good libs available for implementing algorithms? What are efficient data structures I should use?

edit :

It seems like i have not explained it right. I want to solve the resource-constrained project scheduling problem (RCPSP) which is known to be NP-complete with different heuristics. The problem is defined as follows:

A project consists of a set A = {1, ..., n} of activities, which must be performed on a set R = {1, ..., m} of resources. An activity j ∈ A requires rjk ≥ 0 units of resource k ∈ R throughout its non-preemptible processing time pj ≥ 0. Each resource k ∈ R has a limited capacity Rk > 0. There exists precedence relations between the activities, such that one activity j ∈ A can not be started before all its immediate predecessors have completed. The objective is to find a precedence and resource-capacity feasible schedule which minimizes the overall makespan.

OpenSymphony Quartz Scheduller is the right tool for the task.

From Quartz's web page:

"What is Quartz?

Quartz is a full-featured, open source job scheduling service that can be integrated with, or used along side virtually any Java EE or Java SE application - from the smallest stand-alone application to the largest e-commerce system. Quartz can be used to create simple or complex schedules for executing tens, hundreds, or even tens-of-thousands of jobs; jobs whose tasks are defined as standard Java components that may executed virtually anything you may program them to do. The Quartz Scheduler includes many enterprise-class features, such as JTA transactions and clustering.

Quartz is freely usable, licensed under the Apache 2.0 license.

Please read our overview for more quick information."

JDK 1.6 already have very good one. look at java.util.concurrent.ScheduledThreadPoolExecutor

AMPL is a modeling language that you can use for this, it can be compiled into a mixed integer linear program and solved with a number of solvers. I would suggest the GNU MathProg modeling language, it is a subset of the AMPL language and you can use it with the GLPK solver. This is a very common problem and you will probably be able to find a example very close to what you want to do.

edit: actually glpk comes with it's own modeling language which is just a subset of AMPL, which would likely make things easier.

NP完整规划问题有几个库: Drools Planner (开源,ASL java),JGap,cpsolver,opents,......

您可以使用backSolver来解决此问题,使用有限容量调度模型

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM