Re: [eclipse-users] Java exception is being thrown when invoking an eclipse program scheduling over 300 tasks

From: Kish Shen <>
Date: Wed, 12 Dec 2007 02:23:13 +0000
Hi William,

I was hoping someone with more knowledge of the Java interface would 
answer your question, but as no one have done so, I shall try and give 
some help:

William Heath wrote:
> Hi All,
> I am having a problem dealing with what appears to be a memory
> limitation with either java or eclipse.  I am attaching two files:
>  (This file creates tasks and 1 resource then
> invokes the schedule_tasks predicate in
>  (This file schedules the tasks onto resources)
> line 59 of controls how many tasks are sent to the
> eclipse program.  This works for 300 tasks and lower.
>    for(int i = 0; i<400; i++) {
>     Object [] taskObjects = new Object[7];
>     taskObjects[0] = (Object)(new Atom("Task 1")); //task name (atom)
>     taskObjects[1] = (Object)(new Integer(0));     //index (integer)
>     taskObjects[2] = null;                         //start (integer variable)
>     taskObjects[3] = null;                         //earliest_start (integer)
>     taskObjects[4] = (Object)(new Integer(2));    //duration (integer)
>     taskObjects[5] = null;                         //need (dependent tasks)
>     taskObjects[6] = (Object)(new Integer(0));     //use (resource id to use)
>     CompoundTerm task1 =  new CompoundTermImpl("unscheduled_task", taskObjects);
>     unscheduledTaskList.add(task1);
>     }
If your code is failing here, then it is not because of ECLiPSe, as no 
data have been sent to ECLiPSe yet. In any case, ECLiPSe will have no 
problem coding with a list of hundreds of tasks. So either the problem 
is with the Java Interface, although it seems unlikely to me that it 
can't code with such relatively small data structure, but as I don't 
know the details of the Java interface, I can't say for sure.

> When I took it up to 400 it fails with a just an Exception null.  You
> can execute these programs with something like this:
> /home/wgheath/work/eclipseclp/lib/eclipse.jar:/home/wgheath/work/openprojcvs/openproj_build/functionaltest.jar:/home/wgheath/work/openprojcvs/openproj_contrib/lib/junit.jar
> then:
> java -Xmx1024m test.functional.TestExample3  (I tried increasing the
> jvm memory but that did not help)
> I am creating a finite capacity job shop scheduler for the opensource
> project called Adempiere.  Any help in understanding how to get more
> tasks to be scheduled etc... would be greatly appreciated.
> -Tim
I can say something more about how we intended the Java interface to be 
used -- it is an instance of the generic high-level interface of 
ECLiPSe, and I am familiar with this. The idea is that you should keep 
your communication between your host language (in your case Java) and 
ECLiPSe as simple as possible. ECLiPSe is a general programming language 
(rather than just a constraint library), and you should try to do as 
much as possible in ECLiPSe. In particular, you should avoid building  
complex ECLiPSe data structures in Java -- it is easy to get this wrong. 
and difficult to spot any errors.Thus ideally you should construct the 
task lists in ECLiPSe, for example, if your task data is stored in a 
file, you could just pass the data file name to ECLiPSe from Java, and 
write  ECLiPSe code to read the file and create the tasks. Even if you 
need to generate the task data in Java, it is still better to send the 
data to ECLiPSe (in text form) via peer qeueues, and write ECLiPSe to 
process this data to construct the task structures.

> P.S.
> I am quite impressed with eclipse-clp so far!  Also any advice on how
> to speed up my program and/or prolog enhancment comments would be
> greatly appreciated as I am new to prolog.
There are various examples on the website showing 
examples of scheduling tasks, written in ECLiPSe. A simple example is 
the Bridge scheduling problem:

(see for more example)



> ------------------------------------------------------------------------
> _______________________________________________
> ECLiPSe-Users mailing list
Received on Wed Dec 12 2007 - 02:23:33 CET

This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET