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

From: William Heath <wgheath_at_...6...>
Date: Tue, 11 Dec 2007 18:55:52 -0800
Hi Kish,

I figured it out and it is definitely a memory issue with eclipse-clp.
 What I did to solve it was this:

  java.lang.System.setProperty("eclipse.global-size", "1024");
  java.lang.System.setProperty("eclipse.local-size", "1024");

This increases eclipse's memory consumption.  Ok now I have a harder
question to ask, my program is scheduling tasks but it is taking a
reaaallllyyyy long time.  Can someone help me to please speed up my
eclipse-clp prolog program?

You can see the source at:

http://adempiere.svn.sourceforge.net/viewvc/adempiere/branches/libero/extend/src/test/functional/fcsched_test.pl?view=markup

Any suggestions would be very, very, very welcome.  Keep in mind that
this is for an opensource project and all will benefit.

-Tim

P.S.

I think the main issue is when I convert from an IC_SET to an IC_DOM as follows:

convertIC_SET_to_IC_DOM(Ic_set, Ic_dom):-
   	    writeln('convertIC_SET_to_IC_DOM'),
              ic_sets:(Ic_domVar in Ic_set),
              ic:(get_domain_as_list(Ic_domVar,Ic_setIntegerList)),
              ic:(Ic_dom::Ic_setIntegerList).


createIC_SET(ResourceAvailableTime,1,100000).  Because I intersect
tasks with my ResourceAvailableTime I must switch back and forth
between and IC_SET and an IC_DOM.  This takes a very large amount of
time when I want to schedule in minutes for 2 years, that could be
1000000 minutes.  Can anyone recommend a better or faster way for me
to do this?

-Tim

On Dec 11, 2007 6:23 PM, Kish Shen <kisshen_at_...5...> wrote:
> 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:
> >
> > TestExample3.java  (This file creates tasks and 1 resource then
> > invokes the schedule_tasks predicate in sched_test3.pl)
> > sched_test3.pl  (This file schedules the tasks onto resources)
> >
> > line 59 of TestExample3.java controls how many tasks are sent to the
> > sched_test3.pl 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:
> >
> > echo $CLASSPATH
> > /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 www.eclipse-clp.org website showing
> examples of scheduling tasks, written in ECLiPSe. A simple example is
> the Bridge scheduling problem:
>
> http://www.eclipse-clp.org/examples/bridge.pl.txt
>
> (see www.eclipse-clp.org/examples/ for more example)
>
> Cheers,
>
> Kish
>
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > ECLiPSe-Users mailing list
> > ECLiPSe-Users_at_...2...
> > http://www.crosscoreop.com/mailman/options/eclipse-users
>
Received on Wed Dec 12 2007 - 02:56:05 CET

This archive was generated by hypermail 2.3.0 : Tue Apr 16 2024 - 09:13:20 CEST