diff --git a/.gitignore b/.gitignore
index 0c1615723..9fec616e3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,3 +36,4 @@ src/PLASMA/TinyXml/test/textfile.txt
src/PLASMA/Utils/test/writeTest.xml
src/Java/PSEngine/generated/*
\#*#
+PSEngineAdditionalClasses
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 000000000..59c0b11dd
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,17 @@
+language: cpp
+compiler:
+ - gcc
+ - clang
+env:
+ - OPTIMIZE=0 COVERAGE=0
+ - OPTIMIZE=1 COVERAGE=0
+ - OPTIMIZE=0 COVERAGE=1
+matrix:
+ exclude:
+ - compiler: clang
+ env: OPTIMIZE=0 COVERAGE=1
+before_install: sudo pip install cpp-coveralls
+install: sudo add-apt-repository --yes ppa:kalakris/cmake && sudo apt-get update -qq && sudo apt-get install cmake libboost-dev libcppunit-dev libantlr3c-dev antlr swig
+script: mkdir build && cd build && cmake -DOPTIMIZE=$OPTIMIZE -DCOVERAGE=$COVERAGE .. && make -j2 && ctest
+after_success:
+ - coveralls --gcov-options '\-lp'
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 25ad07517..a4ab32a48 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,11 +1,42 @@
-cmake_minimum_required(VERSION 2.6)
-if(COMMAND cmake_policy)
- cmake_policy(SET CMP0003 NEW)
-cmake_policy(SET CMP0042 OLD) #TODO: figure out what this means
-endif(COMMAND cmake_policy)
+cmake_minimum_required(VERSION 2.8.8)
+if((CMAKE_MAJOR_VERSION GREATER 3) OR (CMAKE_MAJOR_VERSION EQUAL 3))
+ if(COMMAND cmake_policy)
+ cmake_policy(SET CMP0003 NEW)
+ cmake_policy(SET CMP0042 OLD) #TODO: figure out what this means
+ endif(COMMAND cmake_policy)
+endif((CMAKE_MAJOR_VERSION GREATER 3) OR (CMAKE_MAJOR_VERSION EQUAL 3))
+
+set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake")
+project(Europa2 C CXX Java)
add_definitions(-DTIXML_USE_STL=1)
enable_testing()
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
+#Options to support:
+# * optimized/not
+option(OPTIMIZE "Build optimized" FALSE)
+# * shared/not
option(SHARED "Build shared libraries" TRUE)
set(BUILD_SHARED_LIBS ${SHARED})
-add_subdirectory(src)
\ No newline at end of file
+# * 64/32-bit
+if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
+ set(SIXTYFOUR TRUE)
+endif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
+option(SIXTYFOUR "Build for 64-bit" ${SIXTYFOUR})
+# * modules?
+# * coverage
+option(COVERAGE "Build with coverage info" FALSE)
+
+set(EUROPA_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
+set(CppUnit_FIND_QUIETLY TRUE)
+
+if(OPTIMIZE)
+ set(EUROPA_SUFFIX "_o")
+else()
+ set(EUROPA_SUFFIX "_g")
+endif(OPTIMIZE)
+
+add_subdirectory(src)
+install(EXPORT Europa2 DESTINATION ${EUROPA_ROOT}/dist/europa)
+install(DIRECTORY ${EUROPA_ROOT}/bin DESTINATION ${EUROPA_ROOT}/dist/europa)
+install(DIRECTORY ${EUROPA_ROOT}/config DESTINATION ${EUROPA_ROOT}/dist/europa)
+install(DIRECTORY ${EUROPA_ROOT}/bin/.makeproject DESTINATION ${EUROPA_ROOT}/dist/bin)
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 000000000..f393661de
--- /dev/null
+++ b/README.md
@@ -0,0 +1,29 @@
+# EUROPA
+
+[](https://travis-ci.org/nasa/europa)
+
+
+[](https://coveralls.io/r/nasa/europa)
+
+**EUROPA is available under [NASA's Open Source Agreement (NOSA) ](http://opensource.arc.nasa.gov/page/nosa-software-agreement)**
+
+Welcome! EUROPA is a framework to model and tackle problems in Planning, Scheduling and Constraint Programming. EUROPA is typically embedded in a host application. It is designed to be expressive, efficient, extendable and configurable. It includes:
+
+- **A Plan Database:** The technology cornerstone of EUROPA for storage and manipulation of plans as they are initialized and refined. The EUROPA Plan Database integrates a rich representation for actions, states, objects and constraints with powerful algorithms for automated reasoning, propagation, querying and manipulation.
+- **A Problem Solver:** A core solver to automatically find and fix flaws in the plan database. It can be configured to plan, schedule or both. It can be easily customized to integrate specialized heuristics and resolution operations.
+- **A Tool Box:** Europa includes a debugger for instrumentation and visualization of applications. It also includes a very high-level, declarative modeling language for describing problem domains and partial-plans.
+
+[Learn more...](//github.com/nasa/europa/wiki/What-Is-Europa)
+
+EUROPA was developed at NASA's Ames Research Center and is available under NASA's open source agreement [(NOSA)](http://opensource.arc.nasa.gov/page/nosa-software-agreement)
+
+|**Getting Started**|**Documentation**|**Development**|
+|-------------------|-----------------|---------------|
+|[Download](https://github.com/nasa/europa/wiki/Europa-Download)|[Background/Overview](https://github.com/nasa/europa/wiki/Europa-Background)|[Building EUROPA](https://github.com/nasa/europa/wiki/Building-Europa)|
+|[Installation](https://github.com/nasa/europa/wiki/Europa-Installation)|[User Documentation](https://github.com/nasa/europa/wiki/Europa-Docs)|[Automated Builds](https://github.com/nasa/europa/wiki/Nightly-Builds)|
+|[Quick Start](https://github.com/nasa/europa/wiki/Quick-Start)|[Examples](https://github.com/nasa/europa/wiki/Europa-Examples)|[Developer Notes](https://github.com/nasa/europa/wiki/Misc-Development)|
+||[Publications](https://github.com/nasa/europa/wiki/Europa-Publications)|[Product Roadmap](https://github.com/nasa/europa/wiki/Europa-Roadmap)|
+|||[People](https://github.com/nasa/europa/wiki/Europa-Team)|
+
+For questions, please use the [europa-users](http://groups.google.com/group/europa-users) google group.
diff --git a/bin/.makeproject/CMakeLists.txt b/bin/.makeproject/CMakeLists.txt
new file mode 100644
index 000000000..4fb23f5f6
--- /dev/null
+++ b/bin/.makeproject/CMakeLists.txt
@@ -0,0 +1,72 @@
+cmake_minimum_required(VERSION 2.8.8)
+set(PROJECT %%Project%%)
+
+project(${PROJECT})
+include($ENV{EUROPA_HOME}/Europa2.cmake)
+
+if(${APPLE})
+ set(JNI_INCLUDE_DIRS /System/Library/Frameworks/JavaVM.framework/Versions/A/Headers)
+else(${APPLE})
+ find_package(JNI REQUIRED)
+endif(${APPLE})
+include_directories(${JNI_INCLUDE_DIRS})
+
+if(OPTIMIZE)
+ set(EUROPA_SUFFIX "_o")
+else()
+ set(EUROPA_SUFFIX "_g")
+endif(OPTIMIZE)
+
+file(GLOB children RELATIVE $ENV{EUROPA_HOME} $ENV{EUROPA_HOME}/*)
+foreach(child ${children})
+ if(IS_DIRECTORY $ENV{EUROPA_HOME}/${child})
+ include_directories($ENV{EUROPA_HOME}/${child})
+ include_directories($ENV{EUROPA_HOME}/${child}/base)
+ include_directories($ENV{EUROPA_HOME}/${child}/component)
+ endif(IS_DIRECTORY $ENV{EUROPA_HOME}/${child})
+endforeach(child)
+
+#project-swig
+find_package(SWIG REQUIRED)
+include(${SWIG_USE_FILE})
+set(CMAKE_SWIG_OUTDIR ${CMAKE_SOURCE_DIR})
+set_source_files_properties(${PROJECT}.i PROPERTIES CPLUSPLUS ON)
+set_source_files_properties(${PROJECT}.i PROPERTIES SWIG_FLAGS "-package;psengine;-includeall")
+swig_add_module(${PROJECT} java ${PROJECT}.i)
+
+
+#project-lib
+add_library(${PROJECT}${EUROPA_SUFFIX} ${swig_generated_file_fullname} ${PROJECT}CustomCode.cc Module${PROJECT}.cc)
+
+
+#project-rt
+add_executable(${PROJECT}-planner${EUROPA_SUFFIX}_rt ${PROJECT}-Main.cc ${PROJECT}CustomCode.cc Module${PROJECT}.cc)
+target_link_libraries(${PROJECT}-planner${EUROPA_SUFFIX}_rt System${EUROPA_SUFFIX} Resource${EUROPA_SUFFIX} Solvers${EUROPA_SUFFIX} NDDL${EUROPA_SUFFIX} TemporalNetwork${EUROPA_SUFFIX} RulesEngine${EUROPA_SUFFIX} ConstraintEngine${EUROPA_SUFFIX} Utils${EUROPA_SUFFIX} TinyXml${EUROPA_SUFFIX})
+
+#run-project
+add_custom_target(run-project
+ DEPENDS ${PROJECT}-planner${EUROPA_SUFFIX}_rt
+ COMMAND ./${PROJECT}-planner${EUROPA_SUFFIX}_rt ${PROJECT}-initial-state.nddl PlannerConfig.xml > RUN_${PROJECT}-planner${EUROPA_SUFFIX}_rt.${PROJECT}-initial-state.nddl.PlannerConfig.xml.output)
+
+#project_jar
+find_package(Java REQUIRED)
+include(UseJava RESULT_VARIABLE java_included)
+if(NOT java_included)
+ message(FATAL_ERROR "Failed to include UseJava")
+endif(NOT java_included)
+
+#find_jar(europa_jar PSEngine.jar PATHS $ENV{EUROPA_HOME})
+add_jar(${PROJECT}Jar
+ SOURCES
+ ${PROJECT}.java
+ ${PROJECT}JNI.java
+ ${CMAKE_CURRENT_SOURCE_DIR}/java/${PROJECT}/Main.java
+ INCLUDE_JARS
+ $ENV{EUROPA_HOME}/PSEngine.jar
+ $ENV{EUROPA_HOME}/PSUISwing.jar
+ OUTPUT_NAME ${PROJECT}
+ ENTRY_POINT ${PROJECT}/Main
+ )
+
+add_dependencies(${PROJECT}Jar ${PROJECT}${EUROPA_SUFFIX})
+
diff --git a/bin/.makeproject/ModuleTemplate.cc b/bin/.makeproject/ModuleTemplate.cc
index cde93b71d..855ac8db9 100644
--- a/bin/.makeproject/ModuleTemplate.cc
+++ b/bin/.makeproject/ModuleTemplate.cc
@@ -12,9 +12,9 @@ namespace EUROPA {
// static C init method to get handle when loading module as shared library
extern "C"
{
- ModuleId initializeModule()
+ Module* initializeModule()
{
- return (new Module%%Project%%())->getId();
+ return (new Module%%Project%%());
}
}
diff --git a/bin/.makeproject/Template-Main.cc b/bin/.makeproject/Template-Main.cc
index 2f6117c8d..61d9fb576 100644
--- a/bin/.makeproject/Template-Main.cc
+++ b/bin/.makeproject/Template-Main.cc
@@ -51,10 +51,14 @@ bool solve(const char* plannerConfig,
PSEngine* engine = PSEngine::makeInstance();
engine->start();
- #ifndef USE_EUROPA_DLL
- engine->addModule((new Module%%Project%%()));
- #endif
- engine->executeScript("nddl",nddlFile,true/*isFile*/);
+#ifndef USE_EUROPA_DLL
+ engine->addModule((new Module%%Project%%()));
+#endif
+ std::string errors = engine->executeScript("nddl",nddlFile,true/*isFile*/);
+ if(!errors.empty()) {
+ std::cout << errors << std::endl;
+ return false;
+ }
PSSolver* solver = engine->createSolver(plannerConfig);
runSolver(solver,startHorizon,endHorizon,maxSteps);
diff --git a/bin/checkreqs b/bin/checkreqs
deleted file mode 100755
index e190bb62b..000000000
--- a/bin/checkreqs
+++ /dev/null
@@ -1,366 +0,0 @@
-#!/bin/sh
-#
-# The checkreqs script checks for the EUROPA2 build requirements
-# (jam, java, gcc, doxygen) and runs them to check that the correct
-# versions are in the path.
-#
-JAMVERSTR="Minimum Jam version is 2.4"
-MINJAM_I=2
-MINJAM_J=4
-JAMPATH="/usr/local/beta/bin"
-BADJAM=0
-BADOSTYPE=1
-GCCVERSTR="Minimum gcc version is 3.3.3"
-MINGCC_I=3
-MINGCC_J=3
-MINGCC_K=3
-GCCPATH="/usr/local/beta/gcc-3.3.3/bin"
-BADGCC=0
-JAVAVERSTR="Minimum Java version is 1.5.0"
-MINJAVA_I=1
-MINJAVA_J=5
-MINJAVA_K=0
-JAVAPATH="/usr/local/jdk1.5.0/bin"
-BADJAVA=0
-DOXVERSTR="Minimum Doxygen version is 1.2.14"
-MINDOX_I=1
-MINDOX_J=2
-MINDOX_K=14
-DOXPATH="/usr/local/bin"
-BADDOX=0
-BADPATH=0
-BADENVV=0
-BADJH=0
-BADBAL=0
-BADLL=0
-
-echo "Checking for required software versions:"
-
-
-# $OSTYPE can have multiple vals in Linux so handle it in one place (here)
-os=$OSTYPE
-case $OSTYPE in *linux* )
- os="linux" ;;
-esac
-
-#Check for minimum Jam version
-JAMVER=`jam -v | egrep "Jam [0-9]\.[0-9]+" | cut -d" " -f2`
-if [ -n "$JAMVER" ]
-then
- i=`echo $JAMVER | cut -d. -f1`
- j=`echo $JAMVER | cut -d. -f2`
-# ignore version info after the "r" as in 2.5rc3
- j=`echo $j | cut -dr -f1`
- if [ $i -lt $MINJAM_I ]
- then
- BADJAM=1
- else
- if [ $i -eq $MINJAM_I -a $j -lt $MINJAM_J ]
- then
- BADJAM=1
- fi
- fi
- if [ $BADJAM -eq 1 ]
- then
- echo " Jam version found is too old for build: version " $JAMVER
- echo " " $JAMVERSTR
- fi
-else
- echo "Did not find any version of Jam in search path"
- BADJAM=1
-fi
-if [ $BADJAM -eq 0 ]
-then
- echo " Found Jam version $JAMVER"
-fi
-
-#Check for minimum gcc version
-GCCVER=`gcc -v 2>&1 | egrep 'gcc version [0-9]\.[0-9]+' | cut -d" " -f3`
-if [ -n "$GCCVER" ]
-then
- i=`echo $GCCVER | cut -d. -f1`
- j=`echo $GCCVER | cut -d. -f2`
- k=`echo $GCCVER | cut -d. -f3`
-# ignore version info after the "_" as in 3.3.3_01
- k=`echo $k | cut -d_ -f1`
- if [ $i -lt $MINGCC_I ]
- then
- BADGCC=1
- else
- if [ $i -le $MINGCC_I -a $j -lt $MINGCC_J ]
- then
- BADGCC=1
- else
- if [ $os != darwin ]
- then
- if [ $i -le $MINGCC_I -a $j -le $MINGCC_J -a $k -lt $MINGCC_K ]
- then
- BADGCC=1
- fi
- fi
- fi
- fi
- if [ $BADGCC -eq 1 ]
- then
- echo " gcc version found is too old for build: version " $GCCVER
- echo " " $GCCVERSTR
- fi
-else
- BADGCC=1
- echo "Did not find any version of gcc in search path"
-fi
-if [ $BADGCC -eq 0 ]
-then
- echo " Found gcc version $GCCVER"
-fi
-
-
-#Check for minimum Java version
-JAVAVER=`java -version 2>&1 | egrep 'java version .[0-9]\.[0-9]+\.[0-9]+' | cut -d"\"" -f2`
-if [ -n "$JAVAVER" ]
-then
- i=`echo $JAVAVER | cut -d. -f1`
- j=`echo $JAVAVER | cut -d. -f2`
- k=`echo $JAVAVER | cut -d. -f3`
-# ignore version info after the "_" as in 1.4.2_05
- k=`echo $k | cut -d_ -f1`
- if [ $i -lt $MINJAVA_I ]
- then
- BADJAVA=1
- else
- if [ $i -le $MINJAVA_I -a $j -lt $MINJAVA_J ]
- then
- BADJAVA=1
- else
- if [ $i -le $MINJAVA_I -a $j -le $MINJAVA_J -a $k -lt $MINJAVA_K ]
- then
- BADJAVA=1
- fi
- fi
- fi
- if [ $BADJAVA -eq 1 ]
- then
- echo " Java version found is too old for build: version " $JAVAVER
- echo " " $JAVAVERSTR
- fi
-else
- BADJAVA=1
- echo "Did not find any version of java in search path"
-fi
-
-if [ $BADJAVA -eq 0 ]
-then
- echo " Found java version $JAVAVER"
-fi
-
-#Check for minimum Doxygen version
-DOXVER=`doxygen -h 2>&1 | egrep 'Doxygen version [0-9]\.[0-9]+\.[0-9]+' | cut -d" " -f3`
-if [ -n "$DOXVER" ]
-then
- i=`echo $DOXVER | cut -d. -f1`
- j=`echo $DOXVER | cut -d. -f2`
- k=`echo $DOXVER | cut -d. -f3`
-# ignore version info after the "_" as in 1.2.16_xx
- k=`echo $k | cut -d_ -f1`
- if [ $i -lt $MINDOX_I ]
- then
- BADDOX=1
- else
- if [ $i -le $MINDOX_I -a $j -lt $MINDOX_J ]
- then
- BADDOX=1
- else
- if [ $i -le $MINDOX_I -a $j -le $MINDOX_J -a $k -lt $MINDOX_K ]
- then
- BADDOX=1
- fi
- fi
- fi
- if [ $BADDOX -eq 1 ]
- then
- echo " Doxygen version found is too old for build: version " $DOXVER
- echo " " $DOXVERSTR
- fi
-else
- BADDOX=1
- echo "Did not find any version of Doxygen in search path"
-fi
-
-if [ $BADDOX -eq 0 ]
-then
- echo " Found doxygen version $DOXVER"
-fi
-
-#These are some suggested actions if version is missing or too old
-if [ $BADJAM -eq 1 ]
-then
- echo "Your path to Jam may be set wrong."
- if [ $os = solaris ]
- then
- echo "Be sure to include $JAMPATH in your path."
- else
- if [ $os = linux ]
- then
- echo "Use: find /usr -name 'jam2.*'"
- echo "to help locate the required Jam executable."
- fi
- fi
-fi
-
-
-if [ $BADGCC -eq 1 ]
-then
- echo "Your path to gcc may be set wrong."
- if [ $os = solaris ]
- then
- echo "Be sure to include $GCCPATH in your path."
- else
- if [ $os = linux ]
- then
- echo "Use: find /usr -name gcc-3.3.3"
- echo "to help locate the required gcc executable."
- fi
- fi
-fi
-
-
-if [ $BADJAVA -eq 1 ]
-then
- echo "Your path to Java may be set wrong."
- if [ $os = solaris ]
- then
- echo "Be sure to include $JAVAPATH in your path."
- else
- if [ $os = linux ]
- then
- echo "Use: find /usr -name 'jdk1.*'"
- echo "to help locate the required gcc executable."
- fi
- fi
-fi
-
-if [ $BADDOX -eq 1 ]
-then
- echo "Your path to Doxygen may be set wrong."
- if [ $os = solaris ]
- then
- echo "Be sure to include $DOXPATH in your path."
- else
- if [ $os = linux ]
- then
- echo "Use: find /usr -name doxygen"
- echo "to help locate the required doxygen executable."
- fi
- fi
-fi
-
-if [ $BADJAM -eq 1 -o $BADGCC -eq 1 -o $BADJAVA -eq 1 -o $BADDOX -eq 1 ]
-then
- BADPATH=1
-else
- echo "Path includes required versions to build EUROPA2"
-fi
-
-echo "Checking for required environment variables:"
-
-#Check OS type set to a known OS
-if [ $os = darwin ]
-then
- BADOSTYPE=0
-fi
-
-if [ $os = solaris ]
-then
- BADOSTYPE=0
-fi
-
-if [ $os = linux ]
-then
- BADOSTYPE=0
-fi
-
-if [ $BADOSTYPE -eq 1 ]
-then
- echo " [PROBLEM!] Unknown OSTYPE " $os
- echo " Known values are darwin, solaris, and *linux* (ie gnu-linux, linux, linux-gnu, etc)."
-else
- echo " OSTYPE is set to " $os
-fi
-
-if [ -z "$ANT_HOME" ]
-then
- ANT_HOME_SET=0
- ANT_HOME=$PWD/ext/ant
- echo "ANT_HOME is not set, using $ANT_HOME"
-else
- ANT_HOME_SET=1
- echo "ANT_HOME is set to $ANT_HOME"
-fi
-
-ANTTEST=`$ANT_HOME/bin/ant -f "checkant.xml"`
-if [ $? -eq 0 ]
-then
- echo " Ant self test successful."
-else
- echo "$ANTTEST"
- if [ $ANT_HOME_SET -eq 1 ]
- then
- echo " Suggest unsetting \$ANT_HOME"
- else
- echo " Suggest installing Apache Ant from http://ant.apache.org and setting \$ANT_HOME accordingly"
- fi
-fi
-
-if [ -z "$JAVA_HOME" ]
-then
- echo "JAVA_HOME environment variable missing or not set"
- BADJH=1
-else
- echo " JAVA_HOME is set to " $JAVA_HOME
-fi
-
-#check load library
-if [ $os = darwin ]
-then
- if [ -z "$DYLD_LIBRARY_PATH" ]
- then
- echo " DYLD_LIBRARY_PATH environment variable missing or not set"
- BADLL=1
- else
- echo " DYLD_LIBRARY_PATH is set to " $DYLD_LIBRARY_PATH
- fi
-else
- if [ -z "$LD_LIBRARY_PATH" ]
- then
- echo " LD_LIBRARY environment variable missing or not set"
- BADLL=1
- else
- echo " LD_LIBRARY_PATH is set to " $LD_LIBRARY_PATH
- fi
-fi
-
-if [ $os = darwin ]
-then
- if [ "$DYLD_BIND_AT_LAUNCH" != YES ]
- then
- echo "DYLD_BIND_AT_LAUNCH environment variable missing or not set to YES"
- BADENV=1
- else
- echo " DYLD_BIND_AT_LAUNCH is set to " $DYLD_BIND_AT_LAUNCH
- fi
-fi
-
-if [ $BADJH -eq 1 -o $BADPATH -eq 1 -o $BADLL -eq 1 ]
-then
- BADENVV=1
- echo "Environment variables may not be set correctly to build EUROPA2"
-else
- echo "Required environment variables are present"
-fi
-
-if [ $BADPATH -eq 1 -o $BADENVV -eq 1 ]
-then
- exit 1
-fi
-
-exit 0
diff --git a/build.xml b/build.xml
deleted file mode 100644
index b84047d26..000000000
--- a/build.xml
+++ /dev/null
@@ -1,625 +0,0 @@
-
-
- EUROPA's Master build file
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/circle.yml b/circle.yml
new file mode 100644
index 000000000..4bf2c3a25
--- /dev/null
+++ b/circle.yml
@@ -0,0 +1,12 @@
+dependencies:
+ pre:
+ - sudo apt-get update; sudo pip install cpp-coveralls; sudo add-apt-repository --yes ppa:kalakris/cmake && sudo apt-get update -qq && sudo apt-get install cmake libboost-dev libcppunit-dev antlr swig; sudo apt-get install jam doxygen libantlr3c-3.2-0 libcppunit-1.13-0 ant subversion gcc-4.8 swig;
+ - wget http://www.antlr3.org/download/C/libantlr3c-3.4.tar.gz -O /tmp/libantlr3c-3.4.tar.gz
+ - tar -zxf /tmp/libantlr3c-3.4.tar.gz
+ - pushd libantlr3c-3.4 && ./configure --prefix=/usr --enable-64bit && make && sudo make install && popd
+ post:
+ - mkdir build && cd build && cmake -DOPTIMIZE=0 -DCOVERAGE=1 .. && make -j2
+ - cd $HOME && tar -zcvf europa.zip europa && cp europa.zip $CIRCLE_ARTIFACTS
+test:
+ override:
+ - cd build && ctest;
diff --git a/config/PlannerConfig.xml b/config/PlannerConfig.xml
index 4a75e61f2..b4dc7b16a 100644
--- a/config/PlannerConfig.xml
+++ b/config/PlannerConfig.xml
@@ -1,6 +1,13 @@
+
+
+
+
+
+
+
diff --git a/documentation/doxygen.cfg b/documentation/doxygen.cfg
index 349129ae3..9aeb3a1e5 100644
--- a/documentation/doxygen.cfg
+++ b/documentation/doxygen.cfg
@@ -1219,3 +1219,6 @@ DOT_CLEANUP = YES
# used. If set to NO the values of all tags below this one will be ignored.
SEARCHENGINE = NO
+
+INCLUDE_GRPAH = YES
+INCLUDED_BY_GRAPH = YES
diff --git a/examples/BlocksWorld/CMakeLists.txt b/examples/BlocksWorld/CMakeLists.txt
new file mode 100644
index 000000000..13e486193
--- /dev/null
+++ b/examples/BlocksWorld/CMakeLists.txt
@@ -0,0 +1,72 @@
+cmake_minimum_required(VERSION 2.8.8)
+set(PROJECT BlocksWorld)
+
+project(${PROJECT})
+include($ENV{EUROPA_HOME}/Europa2.cmake)
+
+if(${APPLE})
+ set(JNI_INCLUDE_DIRS /System/Library/Frameworks/JavaVM.framework/Versions/A/Headers)
+else(${APPLE})
+ find_package(JNI REQUIRED)
+endif(${APPLE})
+include_directories(${JNI_INCLUDE_DIRS})
+
+if(OPTIMIZE)
+ set(EUROPA_SUFFIX "_o")
+else()
+ set(EUROPA_SUFFIX "_g")
+endif(OPTIMIZE)
+
+file(GLOB children RELATIVE $ENV{EUROPA_HOME} $ENV{EUROPA_HOME}/*)
+foreach(child ${children})
+ if(IS_DIRECTORY $ENV{EUROPA_HOME}/${child})
+ include_directories($ENV{EUROPA_HOME}/${child})
+ include_directories($ENV{EUROPA_HOME}/${child}/base)
+ include_directories($ENV{EUROPA_HOME}/${child}/component)
+ endif(IS_DIRECTORY $ENV{EUROPA_HOME}/${child})
+endforeach(child)
+
+#project-swig
+find_package(SWIG REQUIRED)
+include(${SWIG_USE_FILE})
+set(CMAKE_SWIG_OUTDIR ${CMAKE_SOURCE_DIR})
+set_source_files_properties(${PROJECT}.i PROPERTIES CPLUSPLUS ON)
+set_source_files_properties(${PROJECT}.i PROPERTIES SWIG_FLAGS "-package;psengine;-includeall")
+swig_add_module(${PROJECT} java ${PROJECT}.i)
+
+
+#project-lib
+add_library(${PROJECT}${EUROPA_SUFFIX} ${swig_generated_file_fullname} ${PROJECT}CustomCode.cc Module${PROJECT}.cc)
+
+
+#project-rt
+add_executable(${PROJECT}-planner${EUROPA_SUFFIX}_rt ${PROJECT}-Main.cc ${PROJECT}CustomCode.cc Module${PROJECT}.cc)
+target_link_libraries(${PROJECT}-planner${EUROPA_SUFFIX}_rt System${EUROPA_SUFFIX} Resource${EUROPA_SUFFIX} Solvers${EUROPA_SUFFIX} NDDL${EUROPA_SUFFIX} TemporalNetwork${EUROPA_SUFFIX} RulesEngine${EUROPA_SUFFIX} ConstraintEngine${EUROPA_SUFFIX} Utils${EUROPA_SUFFIX} TinyXml${EUROPA_SUFFIX})
+
+#run-project
+add_custom_target(run-project
+ DEPENDS ${PROJECT}-planner${EUROPA_SUFFIX}_rt
+ COMMAND ./${PROJECT}-planner${EUROPA_SUFFIX}_rt ${PROJECT}-initial-state.nddl PlannerConfig.xml > RUN_${PROJECT}-planner${EUROPA_SUFFIX}_rt.${PROJECT}-initial-state.nddl.PlannerConfig.xml.output)
+
+#project_jar
+find_package(Java REQUIRED)
+include(UseJava RESULT_VARIABLE java_included)
+if(NOT java_included)
+ message(FATAL_ERROR "Failed to include UseJava")
+endif(NOT java_included)
+
+#find_jar(europa_jar PSEngine.jar PATHS $ENV{EUROPA_HOME})
+add_jar(${PROJECT}Jar
+ SOURCES
+ ${PROJECT}.java
+ ${PROJECT}JNI.java
+ ${CMAKE_CURRENT_SOURCE_DIR}/java/BlocksWorld/Main.java
+ INCLUDE_JARS
+ $ENV{EUROPA_HOME}/PSEngine.jar
+ $ENV{EUROPA_HOME}/PSUISwing.jar
+ OUTPUT_NAME ${PROJECT}
+ ENTRY_POINT BlocksWorld/Main
+ )
+
+add_dependencies(${PROJECT}Jar ${PROJECT}${EUROPA_SUFFIX})
+
diff --git a/examples/BlocksWorld/ModuleBlocksWorld.cc b/examples/BlocksWorld/ModuleBlocksWorld.cc
index bda6fefd0..19fb02715 100644
--- a/examples/BlocksWorld/ModuleBlocksWorld.cc
+++ b/examples/BlocksWorld/ModuleBlocksWorld.cc
@@ -10,9 +10,9 @@ namespace EUROPA {
// static C init method to get handle when loading module as shared library
extern "C"
{
- ModuleId initializeModule()
+ Module* initializeModule()
{
- return (new ModuleBlocksWorld())->getId();
+ return new ModuleBlocksWorld();
}
}
diff --git a/examples/BlocksWorld/java/BlocksWorld/BlockHistoryEntry.java b/examples/BlocksWorld/java/BlocksWorld/BlockHistoryEntry.java
index d69c06da7..5da521636 100644
--- a/examples/BlocksWorld/java/BlocksWorld/BlockHistoryEntry.java
+++ b/examples/BlocksWorld/java/BlocksWorld/BlockHistoryEntry.java
@@ -6,7 +6,7 @@ public class BlockHistoryEntry
protected Integer step_;
protected String towers_;
protected String opHistory_;
-
+
public BlockHistoryEntry(Integer idx,Integer step,String towers,String opHistory)
{
idx_ = idx;
@@ -14,7 +14,7 @@ public BlockHistoryEntry(Integer idx,Integer step,String towers,String opHistory
towers_ = towers;
opHistory_ = opHistory;
}
-
+
public Integer getIndex() { return idx_; }
public Integer getStepNumber() { return step_; }
public String getTowers() { return towers_; }
diff --git a/examples/BlocksWorld/java/BlocksWorld/BlockWorld.java b/examples/BlocksWorld/java/BlocksWorld/BlockWorld.java
index 3eff102ed..95b677404 100644
--- a/examples/BlocksWorld/java/BlocksWorld/BlockWorld.java
+++ b/examples/BlocksWorld/java/BlocksWorld/BlockWorld.java
@@ -10,22 +10,22 @@ public class BlockWorld
{
protected List> towers_;
protected Map> blockToTower_;
-
+
public BlockWorld()
{
towers_ = new Vector();
blockToTower_ = new HashMap();
}
-
+
public List> getTowers() { return towers_; }
-
+
public void addBlock(String name,String state,String bottomBlock, PSToken a)
{
//System.out.println("BlockWorld.add("+name+","+state+","+bottomBlock+")");
List tower = blockToTower_.get(name);
if (tower == null) {
- tower = new Vector();
+ tower = new Vector();
towers_.add(tower);
blockToTower_.put(name, tower);
}
@@ -35,16 +35,16 @@ public void addBlock(String name,String state,String bottomBlock, PSToken a)
buf.append(name).append("=").append(state).append(bottomBlock != null ? "-"+bottomBlock : "")
.append("(").append(getBounds(a)).append(")");
String towerValue = buf.toString();
-
+
if (state.equals("OnTable")) {
- if (idx == -1)
+ if (idx == -1)
tower.add(0,towerValue);
else
tower.set(idx,towerValue);
}
-
+
if (state.equals("On")) {
-
+
// Add Bottom if we need to
int bottomIdx = -1;
for (int i=0;i tower : towers_) {
buf.append("{");
for (int i=0;i 0)
buf.append(",");
- buf.append(tower.get(i));
+ buf.append(tower.get(i));
}
buf.append("} ");
}
-
+
return buf.toString();
}
@@ -92,32 +92,32 @@ public static Object safeBound(int bound)
return "-INF";
if (bound > INF)
return "INF";
-
+
return bound;
}
public static String valueToString(PSVarValue v)
{
String type = v.getType().toString();
-
+
if ("STRING".equals(type))
return v.asString();
if ("INTEGER".equals(type))
- return new Integer(v.asInt()).toString();
+ return new Integer(v.asInt()).toString();
if ("DOUBLE".equals(type))
return new Double(v.asDouble()).toString();
if ("BOOLEAN".equals(type))
return new Boolean(v.asBoolean()).toString();
if ("OBJECT".equals(type))
return v.asObject().getEntityName();
-
+
return "ERROR!!! UNKNOWN TYPE :" + type;
}
public static String varValueToString(PSVariable var)
- {
- if (var.isSingleton())
- return valueToString(var.getSingletonValue());
+ {
+ if (var.isSingleton())
+ return valueToString(var.getSingletonValue());
else if (var.isInterval()) {
StringBuffer buf = new StringBuffer();
buf.append("[").append(var.getLowerBound()).append(",")
@@ -136,20 +136,20 @@ else if (var.isEnumerated()) {
buf.append("]");
return buf.toString();
}
-
+
throw new RuntimeException("Unexpected ERROR: variable "+var.getEntityName()+" is not one of {Singleton, Interval, Enumeration}");
}
public static String getBounds(PSToken t)
{
StringBuffer buf = new StringBuffer();
-
+
buf.append("[")
.append(varValueToString(t.getStart()))
.append(",")
.append(varValueToString(t.getEnd()))
.append("]");
-
+
return buf.toString();
- }
+ }
}
diff --git a/examples/BlocksWorld/java/BlocksWorld/BlockWorldHistoryPanel.java b/examples/BlocksWorld/java/BlocksWorld/BlockWorldHistoryPanel.java
index dd9688d71..d75d94251 100644
--- a/examples/BlocksWorld/java/BlocksWorld/BlockWorldHistoryPanel.java
+++ b/examples/BlocksWorld/java/BlocksWorld/BlockWorldHistoryPanel.java
@@ -24,15 +24,15 @@ public class BlockWorldHistoryPanel
protected int currentIdx_;
protected JTextField gotoIdx_;
protected JLabel status_;
-
+
public BlockWorldHistoryPanel()
{
history_ = new Vector();
blockWorldHistory_ = new Vector();
-
+
historyTable_ = new JTable();
currentIdx_ = -1;
-
+
JPanel buttonPanel = new JPanel(new FlowLayout());
JButton b;
b = new JButton("<<"); b.addActionListener(this);b.setActionCommand("prev"); buttonPanel.add(b);
@@ -40,29 +40,29 @@ public BlockWorldHistoryPanel()
b = new JButton("Go To Step"); b.addActionListener(this);b.setActionCommand("goto"); buttonPanel.add(b);
gotoIdx_ = new JTextField(6);
buttonPanel.add(gotoIdx_);
-
+
status_ = new JLabel("");
JPanel statusPanel = new JPanel(new FlowLayout());
statusPanel.add(status_);
-
+
setLayout(new BorderLayout());
add(BorderLayout.NORTH,buttonPanel);
- add(BorderLayout.CENTER,new JScrollPane(historyTable_));
+ add(BorderLayout.CENTER,new JScrollPane(historyTable_));
add(BorderLayout.SOUTH,statusPanel);
-
+
updateStatus();
}
public List getHistory() { return history_; }
public List getBlockWorldHistory() { return blockWorldHistory_; }
-
- protected void updateStatus()
- {
- status_.setText("Currently showing step "+(currentIdx_+1)+" out of "+blockWorldHistory_.size()+" available");
+
+ protected void updateStatus()
+ {
+ status_.setText("Currently showing step "+(currentIdx_+1)+" out of "+blockWorldHistory_.size()+" available");
}
-
- public void showStep(int step)
- {
+
+ public void showStep(int step)
+ {
if (step>=0 && step rowIndex)
diff --git a/examples/BlocksWorld/java/BlocksWorld/Main.java b/examples/BlocksWorld/java/BlocksWorld/Main.java
index 98265df96..426a3d1de 100644
--- a/examples/BlocksWorld/java/BlocksWorld/Main.java
+++ b/examples/BlocksWorld/java/BlocksWorld/Main.java
@@ -6,14 +6,14 @@
import org.ops.ui.main.swing.PSDesktop;
import bsh.Interpreter;
-class Main
+class Main
{
protected static PSEngine psEngine_;
-
- public static void main(String args[])
+
+ public static void main(String args[])
{
String debugMode = args[0];
- PSUtil.loadLibraries(debugMode);
+ PSUtil.loadLibraries(debugMode);
psEngine_ = PSEngine.makeInstance();
psEngine_.start();
@@ -29,7 +29,7 @@ public static void main(String args[])
}
catch (Exception e) {
throw new RuntimeException(e);
- }
+ }
}
else
{
@@ -42,28 +42,28 @@ protected static void loadCustomCode(String debugMode)
{
//Load module with any custom code if it exists:
String libName = "BlocksWorld_" + debugMode;
- String fullLibName = LibraryLoader.getResolvedName(libName);
+ String fullLibName = LibraryLoader.getResolvedName(libName);
if(fullLibName == null) {
// Run 'make' to compile the library if you need it:
- System.out.println("INFO: Custom library " + libName + " wasn't found and won't be loaded.");
+ System.out.println("INFO: Custom library " + libName + " wasn't found and won't be loaded.");
}
else {
// WARNING: Shared library loaded twice (see ticket #164)
System.load(fullLibName);
psEngine_.loadModule(fullLibName);
- }
+ }
}
-
- static class ShutdownHook extends Thread
+
+ static class ShutdownHook extends Thread
{
public ShutdownHook()
{
super("ShutdownHook");
}
-
- public void run()
+
+ public void run()
{
psEngine_.shutdown();
}
- }
+ }
}
diff --git a/examples/Light/CMakeLists.txt b/examples/Light/CMakeLists.txt
new file mode 100644
index 000000000..132bd7d16
--- /dev/null
+++ b/examples/Light/CMakeLists.txt
@@ -0,0 +1,72 @@
+cmake_minimum_required(VERSION 2.8.8)
+set(PROJECT Light)
+
+project(${PROJECT})
+include($ENV{EUROPA_HOME}/Europa2.cmake)
+
+if(${APPLE})
+ set(JNI_INCLUDE_DIRS /System/Library/Frameworks/JavaVM.framework/Versions/A/Headers)
+else(${APPLE})
+ find_package(JNI REQUIRED)
+endif(${APPLE})
+include_directories(${JNI_INCLUDE_DIRS})
+
+if(OPTIMIZE)
+ set(EUROPA_SUFFIX "_o")
+else()
+ set(EUROPA_SUFFIX "_g")
+endif(OPTIMIZE)
+
+file(GLOB children RELATIVE $ENV{EUROPA_HOME} $ENV{EUROPA_HOME}/*)
+foreach(child ${children})
+ if(IS_DIRECTORY $ENV{EUROPA_HOME}/${child})
+ include_directories($ENV{EUROPA_HOME}/${child})
+ include_directories($ENV{EUROPA_HOME}/${child}/base)
+ include_directories($ENV{EUROPA_HOME}/${child}/component)
+ endif(IS_DIRECTORY $ENV{EUROPA_HOME}/${child})
+endforeach(child)
+
+#project-swig
+find_package(SWIG REQUIRED)
+include(${SWIG_USE_FILE})
+set(CMAKE_SWIG_OUTDIR ${CMAKE_SOURCE_DIR})
+set_source_files_properties(${PROJECT}.i PROPERTIES CPLUSPLUS ON)
+set_source_files_properties(${PROJECT}.i PROPERTIES SWIG_FLAGS "-package;psengine;-includeall")
+swig_add_module(${PROJECT} java ${PROJECT}.i)
+
+
+#project-lib
+add_library(${PROJECT}${EUROPA_SUFFIX} ${swig_generated_file_fullname} ${PROJECT}CustomCode.cc Module${PROJECT}.cc)
+
+
+#project-rt
+add_executable(${PROJECT}-planner${EUROPA_SUFFIX}_rt ${PROJECT}-Main.cc ${PROJECT}CustomCode.cc Module${PROJECT}.cc)
+target_link_libraries(${PROJECT}-planner${EUROPA_SUFFIX}_rt System${EUROPA_SUFFIX} Resource${EUROPA_SUFFIX} Solvers${EUROPA_SUFFIX} NDDL${EUROPA_SUFFIX} TemporalNetwork${EUROPA_SUFFIX} RulesEngine${EUROPA_SUFFIX} ConstraintEngine${EUROPA_SUFFIX} Utils${EUROPA_SUFFIX} TinyXml${EUROPA_SUFFIX})
+
+#run-project
+add_custom_target(run-project
+ DEPENDS ${PROJECT}-planner${EUROPA_SUFFIX}_rt
+ COMMAND ./${PROJECT}-planner${EUROPA_SUFFIX}_rt ${PROJECT}-initial-state.nddl PlannerConfig.xml > RUN_${PROJECT}-planner${EUROPA_SUFFIX}_rt.${PROJECT}-initial-state.nddl.PlannerConfig.xml.output)
+
+#project_jar
+find_package(Java REQUIRED)
+include(UseJava RESULT_VARIABLE java_included)
+if(NOT java_included)
+ message(FATAL_ERROR "Failed to include UseJava")
+endif(NOT java_included)
+
+#find_jar(europa_jar PSEngine.jar PATHS $ENV{EUROPA_HOME})
+add_jar(${PROJECT}Jar
+ SOURCES
+ ${PROJECT}.java
+ ${PROJECT}JNI.java
+ ${CMAKE_CURRENT_SOURCE_DIR}/java/Light/Main.java
+ INCLUDE_JARS
+ $ENV{EUROPA_HOME}/PSEngine.jar
+ $ENV{EUROPA_HOME}/PSUISwing.jar
+ OUTPUT_NAME ${PROJECT}
+ ENTRY_POINT Light/Main
+ )
+
+add_dependencies(${PROJECT}Jar ${PROJECT}${EUROPA_SUFFIX})
+
diff --git a/examples/Light/ModuleLight.cc b/examples/Light/ModuleLight.cc
index 4c71b686f..c5f0e6874 100644
--- a/examples/Light/ModuleLight.cc
+++ b/examples/Light/ModuleLight.cc
@@ -10,9 +10,9 @@ namespace EUROPA {
// static C init method to get handle when loading module as shared library
extern "C"
{
- ModuleId initializeModule()
+ Module* initializeModule()
{
- return (new ModuleLight())->getId();
+ return (new ModuleLight());
}
}
diff --git a/examples/Light/java/Light/Main.java b/examples/Light/java/Light/Main.java
index ec303c835..f4731a0db 100644
--- a/examples/Light/java/Light/Main.java
+++ b/examples/Light/java/Light/Main.java
@@ -6,20 +6,20 @@
import org.ops.ui.main.swing.PSDesktop;
import bsh.Interpreter;
-class Main
+class Main
{
protected static PSEngine psEngine_;
-
- public static void main(String args[])
+
+ public static void main(String args[])
{
String debugMode = args[0];
- PSUtil.loadLibraries(debugMode);
+ PSUtil.loadLibraries(debugMode);
psEngine_ = PSEngine.makeInstance();
psEngine_.start();
Runtime.getRuntime().addShutdownHook(new ShutdownHook());
loadCustomCode(debugMode);
-
+
if(args.length > 2 && args[2].equals("nogui"))
{
Interpreter bshInterpreter_ = new bsh.Interpreter();
@@ -29,7 +29,7 @@ public static void main(String args[])
}
catch (Exception e) {
throw new RuntimeException(e);
- }
+ }
}
else
{
@@ -42,28 +42,28 @@ protected static void loadCustomCode(String debugMode)
{
//Load module with any custom code if it exists:
String libName = "Light_" + debugMode;
- String fullLibName = LibraryLoader.getResolvedName(libName);
+ String fullLibName = LibraryLoader.getResolvedName(libName);
if(fullLibName == null) {
// Run 'make' to compile the library if you need it:
- System.out.println("INFO: Custom library " + libName + " wasn't found and won't be loaded.");
+ System.out.println("INFO: Custom library " + libName + " wasn't found and won't be loaded.");
}
else {
// WARNING: Shared library loaded twice (see ticket #164)
System.load(fullLibName);
psEngine_.loadModule(fullLibName);
- }
+ }
}
-
- static class ShutdownHook extends Thread
+
+ static class ShutdownHook extends Thread
{
public ShutdownHook()
{
super("ShutdownHook");
}
-
- public void run()
+
+ public void run()
{
psEngine_.shutdown();
}
- }
+ }
}
diff --git a/examples/NQueens/CMakeLists.txt b/examples/NQueens/CMakeLists.txt
new file mode 100644
index 000000000..d34c7c940
--- /dev/null
+++ b/examples/NQueens/CMakeLists.txt
@@ -0,0 +1,72 @@
+cmake_minimum_required(VERSION 2.8.8)
+set(PROJECT NQueens)
+
+project(${PROJECT})
+include($ENV{EUROPA_HOME}/Europa2.cmake)
+
+if(${APPLE})
+ set(JNI_INCLUDE_DIRS /System/Library/Frameworks/JavaVM.framework/Versions/A/Headers)
+else(${APPLE})
+ find_package(JNI REQUIRED)
+endif(${APPLE})
+include_directories(${JNI_INCLUDE_DIRS})
+
+if(OPTIMIZE)
+ set(EUROPA_SUFFIX "_o")
+else()
+ set(EUROPA_SUFFIX "_g")
+endif(OPTIMIZE)
+
+file(GLOB children RELATIVE $ENV{EUROPA_HOME} $ENV{EUROPA_HOME}/*)
+foreach(child ${children})
+ if(IS_DIRECTORY $ENV{EUROPA_HOME}/${child})
+ include_directories($ENV{EUROPA_HOME}/${child})
+ include_directories($ENV{EUROPA_HOME}/${child}/base)
+ include_directories($ENV{EUROPA_HOME}/${child}/component)
+ endif(IS_DIRECTORY $ENV{EUROPA_HOME}/${child})
+endforeach(child)
+
+#project-swig
+find_package(SWIG REQUIRED)
+include(${SWIG_USE_FILE})
+set(CMAKE_SWIG_OUTDIR ${CMAKE_SOURCE_DIR})
+set_source_files_properties(${PROJECT}.i PROPERTIES CPLUSPLUS ON)
+set_source_files_properties(${PROJECT}.i PROPERTIES SWIG_FLAGS "-package;psengine;-includeall")
+swig_add_module(${PROJECT} java ${PROJECT}.i)
+
+
+#project-lib
+add_library(${PROJECT}${EUROPA_SUFFIX} ${swig_generated_file_fullname} ${PROJECT}CustomCode.cc Module${PROJECT}.cc)
+
+
+#project-rt
+add_executable(${PROJECT}-planner${EUROPA_SUFFIX}_rt ${PROJECT}-Main.cc ${PROJECT}CustomCode.cc Module${PROJECT}.cc)
+target_link_libraries(${PROJECT}-planner${EUROPA_SUFFIX}_rt System${EUROPA_SUFFIX} Resource${EUROPA_SUFFIX} Solvers${EUROPA_SUFFIX} NDDL${EUROPA_SUFFIX} TemporalNetwork${EUROPA_SUFFIX} RulesEngine${EUROPA_SUFFIX} ConstraintEngine${EUROPA_SUFFIX} Utils${EUROPA_SUFFIX} TinyXml${EUROPA_SUFFIX})
+
+#run-project
+add_custom_target(run-project
+ DEPENDS ${PROJECT}-planner${EUROPA_SUFFIX}_rt
+ COMMAND ./${PROJECT}-planner${EUROPA_SUFFIX}_rt ${PROJECT}-initial-state.nddl PlannerConfig.xml > RUN_${PROJECT}-planner${EUROPA_SUFFIX}_rt.${PROJECT}-initial-state.nddl.PlannerConfig.xml.output)
+
+#project_jar
+find_package(Java REQUIRED)
+include(UseJava RESULT_VARIABLE java_included)
+if(NOT java_included)
+ message(FATAL_ERROR "Failed to include UseJava")
+endif(NOT java_included)
+
+#find_jar(europa_jar PSEngine.jar PATHS $ENV{EUROPA_HOME})
+add_jar(${PROJECT}Jar
+ SOURCES
+ ${PROJECT}.java
+ ${PROJECT}JNI.java
+ ${CMAKE_CURRENT_SOURCE_DIR}/java/NQueens/Main.java
+ INCLUDE_JARS
+ $ENV{EUROPA_HOME}/PSEngine.jar
+ $ENV{EUROPA_HOME}/PSUISwing.jar
+ OUTPUT_NAME ${PROJECT}
+ ENTRY_POINT NQueens/Main
+ )
+
+add_dependencies(${PROJECT}Jar ${PROJECT}${EUROPA_SUFFIX})
+
diff --git a/examples/NQueens/java/NQueens/Main.java b/examples/NQueens/java/NQueens/Main.java
index f83ad6a2c..6d356f606 100644
--- a/examples/NQueens/java/NQueens/Main.java
+++ b/examples/NQueens/java/NQueens/Main.java
@@ -6,20 +6,20 @@
import org.ops.ui.main.swing.PSDesktop;
import bsh.Interpreter;
-class Main
+class Main
{
protected static PSEngine psEngine_;
-
- public static void main(String args[])
+
+ public static void main(String args[])
{
String debugMode = args[0];
- PSUtil.loadLibraries(debugMode);
+ PSUtil.loadLibraries(debugMode);
psEngine_ = PSEngine.makeInstance();
psEngine_.start();
Runtime.getRuntime().addShutdownHook(new ShutdownHook());
loadCustomCode(debugMode);
-
+
if(args.length > 2 && args[2].equals("nogui"))
{
Interpreter bshInterpreter_ = new bsh.Interpreter();
@@ -29,7 +29,7 @@ public static void main(String args[])
}
catch (Exception e) {
throw new RuntimeException(e);
- }
+ }
}
else
{
@@ -42,28 +42,28 @@ protected static void loadCustomCode(String debugMode)
{
//Load module with any custom code if it exists:
String libName = "NQueens_" + debugMode;
- String fullLibName = LibraryLoader.getResolvedName(libName);
+ String fullLibName = LibraryLoader.getResolvedName(libName);
if(fullLibName == null) {
// Run 'make' to compile the library if you need it:
- System.out.println("INFO: Custom library " + libName + " wasn't found and won't be loaded.");
+ System.out.println("INFO: Custom library " + libName + " wasn't found and won't be loaded.");
}
else {
// WARNING: Shared library loaded twice (see ticket #164)
System.load(fullLibName);
psEngine_.loadModule(fullLibName);
- }
+ }
}
-
- static class ShutdownHook extends Thread
+
+ static class ShutdownHook extends Thread
{
public ShutdownHook()
{
super("ShutdownHook");
}
-
- public void run()
+
+ public void run()
{
psEngine_.shutdown();
}
- }
+ }
}
diff --git a/examples/NQueens/java/NQueens/NQueensPanel.java b/examples/NQueens/java/NQueens/NQueensPanel.java
index 5ff1af285..c727aa95e 100644
--- a/examples/NQueens/java/NQueens/NQueensPanel.java
+++ b/examples/NQueens/java/NQueens/NQueensPanel.java
@@ -11,7 +11,7 @@
import psengine.*;
-public class NQueensPanel
+public class NQueensPanel
extends MouseAdapter
implements TSNQueensSolver.SolverObserver
{
@@ -25,9 +25,9 @@ public class NQueensPanel
protected List solutions_;
protected int curSolution_;
protected JButton nextBtn_,prevBtn_;
-
+
public NQueensPanel(PSEngine psengine,
- int queenCnt,
+ int queenCnt,
JTextArea mouseInfo)
{
createUIPanel(psengine,queenCnt,mouseInfo);
@@ -36,9 +36,9 @@ public NQueensPanel(PSEngine psengine,
solutions_ = new Vector();
curSolution_ = -1;
}
-
+
public JPanel getUIPanel() { return uiPanel_; }
-
+
public void createUIPanel(PSEngine psengine,int queenCnt, JTextArea mouseInfo)
{
uiPanel_ = new JPanel(new BorderLayout());
@@ -65,24 +65,24 @@ public void createUIPanel(PSEngine psengine,int queenCnt, JTextArea mouseInfo)
prevBtn_.setEnabled(false);
bottomPanel.add(prevBtn_);
bottomPanel.add(nextBtn_);
-
+
solverPanel.add(BorderLayout.NORTH,topPanel);
solverPanel.add(BorderLayout.CENTER,solverBoard_);
solverPanel.add(BorderLayout.SOUTH,bottomPanel);
-
+
tabbedPane_ = new JTabbedPane();
tabbedPane_.addTab("Current State",new NQueensBoard(psengine,queenCnt,mouseInfo,false));
tabbedPane_.addTab("Solver",solverPanel);
- uiPanel_.add(tabbedPane_);
+ uiPanel_.add(tabbedPane_);
}
-
+
public void mouseClicked(MouseEvent e)
{
try {
- if (e.getSource()==solveBtn_) {
+ if (e.getSource()==solveBtn_) {
SolverRunner handler = new SolverRunner();
- handler.start();
+ handler.start();
}
if (e.getSource()==nextBtn_) {
setCurrentSolution(curSolution_+1);
@@ -94,12 +94,12 @@ public void mouseClicked(MouseEvent e)
catch (Exception ex) {
throw new RuntimeException(ex);
}
- }
-
+ }
+
class SolverRunner
extends Thread
{
- public void run()
+ public void run()
{
solveBtn_.setEnabled(false);
tabbedPane_.setEnabledAt(0,false);
@@ -107,15 +107,15 @@ public void run()
solver_.solve(maxIter);
tabbedPane_.setEnabledAt(0,true);
solveBtn_.setEnabled(true);
- }
+ }
}
- public void iterationCompleted(int iteration)
+ public void iterationCompleted(int iteration)
{
SwingUtilities.invokeLater(new Updater1(iteration));
}
- public void newSolutionFound(int iteration, List queenPositions, List queenViolations)
+ public void newSolutionFound(int iteration, List queenPositions, List queenViolations)
{
solutions_.add(new Object[]{new Integer(iteration),queenPositions,queenViolations});
SwingUtilities.invokeLater(new Updater2());
@@ -125,7 +125,7 @@ protected void setCurrentSolution(int i)
{
if (i >= solutions_.size() || i < 0)
return;
-
+
curSolution_=i;
if (curSolution_==solutions_.size()-1)
@@ -140,22 +140,22 @@ protected void setCurrentSolution(int i)
solverBoard_.setSolution((Object[])solutions_.get(curSolution_));
}
-
+
class Updater1 implements Runnable
{
int iteration_;
-
+
public Updater1(int i) { iteration_ = i; }
-
+
public void run() {
- iterationCount_.setText("Iteration : "+iteration_);
- }
+ iterationCount_.setText("Iteration : "+iteration_);
+ }
}
-
+
class Updater2 implements Runnable
{
public void run() {
setCurrentSolution(solutions_.size()-1);
- }
+ }
}
}
diff --git a/examples/NQueens/java/NQueens/TSNQueensSolver.java b/examples/NQueens/java/NQueens/TSNQueensSolver.java
index b6a14906f..f48dba2c1 100644
--- a/examples/NQueens/java/NQueens/TSNQueensSolver.java
+++ b/examples/NQueens/java/NQueens/TSNQueensSolver.java
@@ -21,16 +21,16 @@ public class TSNQueensSolver
protected List observers_;
protected int bestIter_;
protected double bestCost_;
-
+
public interface SolverObserver
{
public void iterationCompleted(int iteration);
public void newSolutionFound(int iteration,List queenPositions,List queenViolations);
}
-
+
public TSNQueensSolver(int n,PSEngine engine)
{
- psengine_ = engine;
+ psengine_ = engine;
tabuList_ = new HashMap();
queenCnt_ = n;
observers_ = new Vector();
@@ -38,22 +38,22 @@ public TSNQueensSolver(int n,PSEngine engine)
public void addObserver(SolverObserver o) { observers_.add(o); }
public void removeObserver(SolverObserver o) { observers_.remove(o); }
-
+
void notifyIterationCompleted(int iteration)
{
- dbgout(iteration+":"+queensToString());
+ dbgout(iteration+":"+queensToString());
for (int i=0;i queenValues = new Vector();
List queenViolations = new Vector();
-
- PSVariableList l = psengine_.getGlobalVariables();
-
+
+ PSVariableList l = psengine_.getGlobalVariables();
+
for (int i=0;i maxViolation) {
maxVar = i;
maxViolation = v.getViolation();
}
- }
-
+ }
+
return l.get(maxVar);
}
@@ -116,13 +116,13 @@ static class Move
{
public int slot_;
public double violation_;
-
+
public Move(int slot,double violation)
{
slot_ = slot;
violation_ = violation;
}
- public int compareTo(Object obj)
+ public int compareTo(Object obj)
{
Move rhs = (Move)obj;
@@ -130,15 +130,15 @@ public int compareTo(Object obj)
return -1;
else if (violation_ > rhs.violation_)
return 1;
- else
+ else
return 0;
- }
+ }
}
-
+
SortedSet getMoves(PSVariable queen,int curPos)
{
SortedSet moves = new TreeSet();
-
+
for (int i=0;i getMoves(PSVariable queen,int curPos)
moves.add(new Move(i,v));
}
}
-
+
return moves;
}
public void solve(int maxIter)
{
init();
-
+
for (int i=0;psengine_.getViolation() > 0 && i < maxIter;i++) {
PSVariable queenToMove = getQueenWithMaxViolation();
int curPos = queenToMove.getSingletonValue().asInt();
-
+
boolean moved = false;
- SortedSet moves = getMoves(queenToMove,curPos);
+ SortedSet moves = getMoves(queenToMove,curPos);
for (Move m : moves) {
moved = makeMove(queenToMove,curPos,m,false);
if (moved)
break;
}
-
- if (!moved)
+
+ if (!moved)
makeMove(queenToMove,curPos,moves.first(),true);
-
- checkSolution(); // See if we have a new best solution
+
+ checkSolution(); // See if we have a new best solution
notifyIterationCompleted(curIteration_++);
-
- if (curIteration_-bestIter_ > 50)
+
+ if (curIteration_-bestIter_ > 50)
restart();
}
}
-
+
protected void checkSolution()
{
double cost = psengine_.getViolation();
@@ -185,25 +185,25 @@ protected void checkSolution()
bestCost_ = cost;
bestIter_ = curIteration_;
notifyNewSolutionFound(curIteration_);
- }
+ }
}
-
+
void addToTabuList(PSVariable queenToMove,int orig,int dest)
{
String key = queenToMove.getEntityName() + "_" +orig+"_"+dest;
- tabuList_.put(key,curIteration_+tabuTenure_);
+ tabuList_.put(key,curIteration_+tabuTenure_);
}
-
+
boolean isTabu(PSVariable queenToMove,int orig,int dest)
{
String key = queenToMove.getEntityName() + "_" +orig+"_"+dest;
Integer iteration = (Integer)tabuList_.get(key);
if (iteration == null)
return false;
-
+
return (iteration.intValue() > curIteration_);
}
-
+
boolean makeMove(PSVariable queenToMove,int curPos,Move m,boolean force)
{
if (force)
@@ -212,18 +212,18 @@ boolean makeMove(PSVariable queenToMove,int curPos,Move m,boolean force)
if (force || !isTabu(queenToMove,curPos,m.slot_)) {
PSVarValue value = PSVarValue.getInstance(m.slot_);
queenToMove.specifyValue(value);
- dbgout("Moved queen "+queenToMove.getEntityName()+" from "+curPos+" to "+m.slot_);
+ dbgout("Moved queen "+queenToMove.getEntityName()+" from "+curPos+" to "+m.slot_);
addToTabuList(queenToMove,curPos,m.slot_);
return true;
}
-
+
return false;
}
-
+
String queensToString()
{
StringBuffer buf = new StringBuffer();
-
+
buf.append("{");
for (int i=0; i0)
@@ -232,8 +232,8 @@ String queensToString()
}
buf.append("}");
buf.append(" violation:").append(psengine_.getViolation());
-
+
return buf.toString();
- }
+ }
}
diff --git a/examples/Rover/CMakeLists.txt b/examples/Rover/CMakeLists.txt
new file mode 100644
index 000000000..e0696d50d
--- /dev/null
+++ b/examples/Rover/CMakeLists.txt
@@ -0,0 +1,72 @@
+cmake_minimum_required(VERSION 2.8.8)
+set(PROJECT Rover)
+
+project(${PROJECT})
+include($ENV{EUROPA_HOME}/Europa2.cmake)
+
+if(${APPLE})
+ set(JNI_INCLUDE_DIRS /System/Library/Frameworks/JavaVM.framework/Versions/A/Headers)
+else(${APPLE})
+ find_package(JNI REQUIRED)
+endif(${APPLE})
+include_directories(${JNI_INCLUDE_DIRS})
+
+if(OPTIMIZE)
+ set(EUROPA_SUFFIX "_o")
+else()
+ set(EUROPA_SUFFIX "_g")
+endif(OPTIMIZE)
+
+file(GLOB children RELATIVE $ENV{EUROPA_HOME} $ENV{EUROPA_HOME}/*)
+foreach(child ${children})
+ if(IS_DIRECTORY $ENV{EUROPA_HOME}/${child})
+ include_directories($ENV{EUROPA_HOME}/${child})
+ include_directories($ENV{EUROPA_HOME}/${child}/base)
+ include_directories($ENV{EUROPA_HOME}/${child}/component)
+ endif(IS_DIRECTORY $ENV{EUROPA_HOME}/${child})
+endforeach(child)
+
+#project-swig
+find_package(SWIG REQUIRED)
+include(${SWIG_USE_FILE})
+set(CMAKE_SWIG_OUTDIR ${CMAKE_SOURCE_DIR})
+set_source_files_properties(${PROJECT}.i PROPERTIES CPLUSPLUS ON)
+set_source_files_properties(${PROJECT}.i PROPERTIES SWIG_FLAGS "-package;psengine;-includeall")
+swig_add_module(${PROJECT} java ${PROJECT}.i)
+
+
+#project-lib
+add_library(${PROJECT}${EUROPA_SUFFIX} ${swig_generated_file_fullname} ${PROJECT}CustomCode.cc Module${PROJECT}.cc)
+
+
+#project-rt
+add_executable(${PROJECT}-planner${EUROPA_SUFFIX}_rt ${PROJECT}-Main.cc ${PROJECT}CustomCode.cc Module${PROJECT}.cc)
+target_link_libraries(${PROJECT}-planner${EUROPA_SUFFIX}_rt System${EUROPA_SUFFIX} Resource${EUROPA_SUFFIX} Solvers${EUROPA_SUFFIX} NDDL${EUROPA_SUFFIX} TemporalNetwork${EUROPA_SUFFIX} RulesEngine${EUROPA_SUFFIX} ConstraintEngine${EUROPA_SUFFIX} Utils${EUROPA_SUFFIX} TinyXml${EUROPA_SUFFIX})
+
+#run-project
+add_custom_target(run-project
+ DEPENDS ${PROJECT}-planner${EUROPA_SUFFIX}_rt
+ COMMAND ./${PROJECT}-planner${EUROPA_SUFFIX}_rt ${PROJECT}-initial-state.nddl PlannerConfig.xml > RUN_${PROJECT}-planner${EUROPA_SUFFIX}_rt.${PROJECT}-initial-state.nddl.PlannerConfig.xml.output)
+
+#project_jar
+find_package(Java REQUIRED)
+include(UseJava RESULT_VARIABLE java_included)
+if(NOT java_included)
+ message(FATAL_ERROR "Failed to include UseJava")
+endif(NOT java_included)
+
+#find_jar(europa_jar PSEngine.jar PATHS $ENV{EUROPA_HOME})
+add_jar(${PROJECT}Jar
+ SOURCES
+ ${PROJECT}.java
+ ${PROJECT}JNI.java
+ ${CMAKE_CURRENT_SOURCE_DIR}/java/Rover/Main.java
+ INCLUDE_JARS
+ $ENV{EUROPA_HOME}/PSEngine.jar
+ $ENV{EUROPA_HOME}/PSUISwing.jar
+ OUTPUT_NAME ${PROJECT}
+ ENTRY_POINT Rover/Main
+ )
+
+add_dependencies(${PROJECT}Jar ${PROJECT}${EUROPA_SUFFIX})
+
diff --git a/examples/Rover/ModuleRover.cc b/examples/Rover/ModuleRover.cc
index b94e5546e..bb9893230 100644
--- a/examples/Rover/ModuleRover.cc
+++ b/examples/Rover/ModuleRover.cc
@@ -10,9 +10,9 @@ namespace EUROPA {
// static C init method to get handle when loading module as shared library
extern "C"
{
- ModuleId initializeModule()
+ Module* initializeModule()
{
- return (new ModuleRover())->getId();
+ return new ModuleRover();
}
}
diff --git a/examples/Rover/java/Rover/Main.java b/examples/Rover/java/Rover/Main.java
index 31f6bc415..dc60f5303 100644
--- a/examples/Rover/java/Rover/Main.java
+++ b/examples/Rover/java/Rover/Main.java
@@ -6,20 +6,20 @@
import org.ops.ui.main.swing.PSDesktop;
import bsh.Interpreter;
-class Main
+class Main
{
protected static PSEngine psEngine_;
-
- public static void main(String args[])
+
+ public static void main(String args[])
{
String debugMode = args[0];
- PSUtil.loadLibraries(debugMode);
+ PSUtil.loadLibraries(debugMode);
psEngine_ = PSEngine.makeInstance();
psEngine_.start();
Runtime.getRuntime().addShutdownHook(new ShutdownHook());
loadCustomCode(debugMode);
-
+
if(args.length > 2 && args[2].equals("nogui"))
{
Interpreter bshInterpreter_ = new bsh.Interpreter();
@@ -29,7 +29,7 @@ public static void main(String args[])
}
catch (Exception e) {
throw new RuntimeException(e);
- }
+ }
}
else
{
@@ -42,28 +42,28 @@ protected static void loadCustomCode(String debugMode)
{
//Load module with any custom code if it exists:
String libName = "Rover_" + debugMode;
- String fullLibName = LibraryLoader.getResolvedName(libName);
+ String fullLibName = LibraryLoader.getResolvedName(libName);
if(fullLibName == null) {
// Run 'make' to compile the library if you need it:
- System.out.println("INFO: Custom library " + libName + " wasn't found and won't be loaded.");
+ System.out.println("INFO: Custom library " + libName + " wasn't found and won't be loaded.");
}
else {
// WARNING: Shared library loaded twice (see ticket #164)
System.load(fullLibName);
psEngine_.loadModule(fullLibName);
- }
+ }
}
-
- static class ShutdownHook extends Thread
+
+ static class ShutdownHook extends Thread
{
public ShutdownHook()
{
super("ShutdownHook");
}
-
- public void run()
+
+ public void run()
{
psEngine_.shutdown();
}
- }
+ }
}
diff --git a/examples/Shopping/CMakeLists.txt b/examples/Shopping/CMakeLists.txt
new file mode 100644
index 000000000..ef74f1406
--- /dev/null
+++ b/examples/Shopping/CMakeLists.txt
@@ -0,0 +1,72 @@
+cmake_minimum_required(VERSION 2.8.8)
+set(PROJECT Shopping)
+
+project(${PROJECT})
+include($ENV{EUROPA_HOME}/Europa2.cmake)
+
+if(${APPLE})
+ set(JNI_INCLUDE_DIRS /System/Library/Frameworks/JavaVM.framework/Versions/A/Headers)
+else(${APPLE})
+ find_package(JNI REQUIRED)
+endif(${APPLE})
+include_directories(${JNI_INCLUDE_DIRS})
+
+if(OPTIMIZE)
+ set(EUROPA_SUFFIX "_o")
+else()
+ set(EUROPA_SUFFIX "_g")
+endif(OPTIMIZE)
+
+file(GLOB children RELATIVE $ENV{EUROPA_HOME} $ENV{EUROPA_HOME}/*)
+foreach(child ${children})
+ if(IS_DIRECTORY $ENV{EUROPA_HOME}/${child})
+ include_directories($ENV{EUROPA_HOME}/${child})
+ include_directories($ENV{EUROPA_HOME}/${child}/base)
+ include_directories($ENV{EUROPA_HOME}/${child}/component)
+ endif(IS_DIRECTORY $ENV{EUROPA_HOME}/${child})
+endforeach(child)
+
+#project-swig
+find_package(SWIG REQUIRED)
+include(${SWIG_USE_FILE})
+set(CMAKE_SWIG_OUTDIR ${CMAKE_SOURCE_DIR})
+set_source_files_properties(${PROJECT}.i PROPERTIES CPLUSPLUS ON)
+set_source_files_properties(${PROJECT}.i PROPERTIES SWIG_FLAGS "-package;psengine;-includeall")
+swig_add_module(${PROJECT} java ${PROJECT}.i)
+
+
+#project-lib
+add_library(${PROJECT}${EUROPA_SUFFIX} ${swig_generated_file_fullname} ${PROJECT}CustomCode.cc Module${PROJECT}.cc)
+
+
+#project-rt
+add_executable(${PROJECT}-planner${EUROPA_SUFFIX}_rt ${PROJECT}-Main.cc ${PROJECT}CustomCode.cc Module${PROJECT}.cc)
+target_link_libraries(${PROJECT}-planner${EUROPA_SUFFIX}_rt System${EUROPA_SUFFIX} Resource${EUROPA_SUFFIX} Solvers${EUROPA_SUFFIX} NDDL${EUROPA_SUFFIX} TemporalNetwork${EUROPA_SUFFIX} RulesEngine${EUROPA_SUFFIX} ConstraintEngine${EUROPA_SUFFIX} Utils${EUROPA_SUFFIX} TinyXml${EUROPA_SUFFIX})
+
+#run-project
+add_custom_target(run-project
+ DEPENDS ${PROJECT}-planner${EUROPA_SUFFIX}_rt
+ COMMAND ./${PROJECT}-planner${EUROPA_SUFFIX}_rt ${PROJECT}-initial-state.nddl PlannerConfig.xml > RUN_${PROJECT}-planner${EUROPA_SUFFIX}_rt.${PROJECT}-initial-state.nddl.PlannerConfig.xml.output)
+
+#project_jar
+find_package(Java REQUIRED)
+include(UseJava RESULT_VARIABLE java_included)
+if(NOT java_included)
+ message(FATAL_ERROR "Failed to include UseJava")
+endif(NOT java_included)
+
+#find_jar(europa_jar PSEngine.jar PATHS $ENV{EUROPA_HOME})
+add_jar(${PROJECT}Jar
+ SOURCES
+ ${PROJECT}.java
+ ${PROJECT}JNI.java
+ ${CMAKE_CURRENT_SOURCE_DIR}/java/Shopping/Main.java
+ INCLUDE_JARS
+ $ENV{EUROPA_HOME}/PSEngine.jar
+ $ENV{EUROPA_HOME}/PSUISwing.jar
+ OUTPUT_NAME ${PROJECT}
+ ENTRY_POINT Shopping/Main
+ )
+
+add_dependencies(${PROJECT}Jar ${PROJECT}${EUROPA_SUFFIX})
+
diff --git a/examples/Shopping/java/Shopping/Main.java b/examples/Shopping/java/Shopping/Main.java
index 44d471293..7f2e6dac0 100644
--- a/examples/Shopping/java/Shopping/Main.java
+++ b/examples/Shopping/java/Shopping/Main.java
@@ -6,20 +6,20 @@
import org.ops.ui.main.swing.PSDesktop;
import bsh.Interpreter;
-class Main
+class Main
{
protected static PSEngine psEngine_;
-
- public static void main(String args[])
+
+ public static void main(String args[])
{
String debugMode = args[0];
- PSUtil.loadLibraries(debugMode);
+ PSUtil.loadLibraries(debugMode);
psEngine_ = PSEngine.makeInstance();
psEngine_.start();
Runtime.getRuntime().addShutdownHook(new ShutdownHook());
loadCustomCode(debugMode);
-
+
if(args.length > 2 && args[2].equals("nogui"))
{
Interpreter bshInterpreter_ = new bsh.Interpreter();
@@ -29,7 +29,7 @@ public static void main(String args[])
}
catch (Exception e) {
throw new RuntimeException(e);
- }
+ }
}
else
{
@@ -42,28 +42,28 @@ protected static void loadCustomCode(String debugMode)
{
//Load module with any custom code if it exists:
String libName = "Shopping_" + debugMode;
- String fullLibName = LibraryLoader.getResolvedName(libName);
+ String fullLibName = LibraryLoader.getResolvedName(libName);
if(fullLibName == null) {
// Run 'make' to compile the library if you need it:
- System.out.println("INFO: Custom library " + libName + " wasn't found and won't be loaded.");
+ System.out.println("INFO: Custom library " + libName + " wasn't found and won't be loaded.");
}
else {
// WARNING: Shared library loaded twice (see ticket #164)
System.load(fullLibName);
psEngine_.loadModule(fullLibName);
- }
+ }
}
-
- static class ShutdownHook extends Thread
+
+ static class ShutdownHook extends Thread
{
public ShutdownHook()
{
super("ShutdownHook");
}
-
- public void run()
+
+ public void run()
{
psEngine_.shutdown();
}
- }
+ }
}
diff --git a/examples/UBO/CMakeLists.txt b/examples/UBO/CMakeLists.txt
new file mode 100644
index 000000000..c75b86b01
--- /dev/null
+++ b/examples/UBO/CMakeLists.txt
@@ -0,0 +1,89 @@
+cmake_minimum_required(VERSION 2.8.8)
+set(PROJECT UBO)
+
+project(${PROJECT})
+include($ENV{EUROPA_HOME}/Europa2.cmake)
+
+if(${APPLE})
+ set(JNI_INCLUDE_DIRS /System/Library/Frameworks/JavaVM.framework/Versions/A/Headers)
+else(${APPLE})
+ find_package(JNI REQUIRED)
+endif(${APPLE})
+include_directories(${JNI_INCLUDE_DIRS})
+
+if(OPTIMIZE)
+ set(EUROPA_SUFFIX "_o")
+else()
+ set(EUROPA_SUFFIX "_g")
+endif(OPTIMIZE)
+
+file(GLOB children RELATIVE $ENV{EUROPA_HOME} $ENV{EUROPA_HOME}/*)
+foreach(child ${children})
+ if(IS_DIRECTORY $ENV{EUROPA_HOME}/${child})
+ include_directories($ENV{EUROPA_HOME}/${child})
+ include_directories($ENV{EUROPA_HOME}/${child}/base)
+ include_directories($ENV{EUROPA_HOME}/${child}/component)
+ endif(IS_DIRECTORY $ENV{EUROPA_HOME}/${child})
+endforeach(child)
+
+#project-swig
+find_package(SWIG REQUIRED)
+include(${SWIG_USE_FILE})
+set(CMAKE_SWIG_OUTDIR ${CMAKE_SOURCE_DIR})
+set_source_files_properties(${PROJECT}.i PROPERTIES CPLUSPLUS ON)
+set_source_files_properties(${PROJECT}.i PROPERTIES SWIG_FLAGS "-package;psengine;-includeall")
+swig_add_module(${PROJECT} java ${PROJECT}.i)
+
+
+#project-lib
+add_library(${PROJECT}${EUROPA_SUFFIX} ${swig_generated_file_fullname} ${PROJECT}CustomCode.cc Module${PROJECT}.cc)
+
+
+#project-rt
+add_executable(${PROJECT}-planner${EUROPA_SUFFIX}_rt ${PROJECT}-Main.cc ${PROJECT}CustomCode.cc Module${PROJECT}.cc)
+target_link_libraries(${PROJECT}-planner${EUROPA_SUFFIX}_rt System${EUROPA_SUFFIX} Resource${EUROPA_SUFFIX} Solvers${EUROPA_SUFFIX} NDDL${EUROPA_SUFFIX} TemporalNetwork${EUROPA_SUFFIX} RulesEngine${EUROPA_SUFFIX} ConstraintEngine${EUROPA_SUFFIX} Utils${EUROPA_SUFFIX} TinyXml${EUROPA_SUFFIX})
+
+#run-project
+add_custom_target(run-project
+ DEPENDS ${PROJECT}-planner${EUROPA_SUFFIX}_rt
+ COMMAND ./${PROJECT}-planner${EUROPA_SUFFIX}_rt ${PROJECT}-initial-state.nddl PlannerConfig.xml > RUN_${PROJECT}-planner${EUROPA_SUFFIX}_rt.${PROJECT}-initial-state.nddl.PlannerConfig.xml.output)
+
+#project_jar
+find_package(Java REQUIRED)
+include(UseJava RESULT_VARIABLE java_included)
+if(NOT java_included)
+ message(FATAL_ERROR "Failed to include UseJava")
+endif(NOT java_included)
+
+#find_jar(europa_jar PSEngine.jar PATHS $ENV{EUROPA_HOME})
+add_jar(${PROJECT}Jar
+ SOURCES
+ ${PROJECT}.java
+ ${PROJECT}JNI.java
+ ${CMAKE_CURRENT_SOURCE_DIR}/java/UBO/ExhaustiveSolver.java
+ ${CMAKE_CURRENT_SOURCE_DIR}/java/UBO/HybridSolver.java
+ ${CMAKE_CURRENT_SOURCE_DIR}/java/UBO/IFlatIRelaxSolver.java
+ ${CMAKE_CURRENT_SOURCE_DIR}/java/UBO/Main.java
+ ${CMAKE_CURRENT_SOURCE_DIR}/java/UBO/PSResourceWrapper.java
+ ${CMAKE_CURRENT_SOURCE_DIR}/java/UBO/PlanHistoryEntry.java
+ ${CMAKE_CURRENT_SOURCE_DIR}/java/UBO/Precedence.java
+ ${CMAKE_CURRENT_SOURCE_DIR}/java/UBO/RCPSPResource.java
+ ${CMAKE_CURRENT_SOURCE_DIR}/java/UBO/RCPSPSolver.java
+ ${CMAKE_CURRENT_SOURCE_DIR}/java/UBO/RCPSPSolverBase.java
+ ${CMAKE_CURRENT_SOURCE_DIR}/java/UBO/RCPSPUtil.java
+ ${CMAKE_CURRENT_SOURCE_DIR}/java/UBO/Resource.java
+ ${CMAKE_CURRENT_SOURCE_DIR}/java/UBO/ResourceBase.java
+ ${CMAKE_CURRENT_SOURCE_DIR}/java/UBO/ResourceProfile.java
+ ${CMAKE_CURRENT_SOURCE_DIR}/java/UBO/ResourceViolationInfo.java
+ ${CMAKE_CURRENT_SOURCE_DIR}/java/UBO/SolDistExhaustiveSolver.java
+ ${CMAKE_CURRENT_SOURCE_DIR}/java/UBO/UBOSolverListener.java
+ ${CMAKE_CURRENT_SOURCE_DIR}/java/UBO/Main.java
+ INCLUDE_JARS
+ $ENV{EUROPA_HOME}/PSEngine.jar
+ $ENV{EUROPA_HOME}/PSUISwing.jar
+ OUTPUT_NAME ${PROJECT}
+ ENTRY_POINT UBO/Main
+ )
+
+add_dependencies(${PROJECT}Jar ${PROJECT}${EUROPA_SUFFIX})
+
diff --git a/examples/UBO/ModuleUBO.cc b/examples/UBO/ModuleUBO.cc
index 98cb9117c..7c35aa18d 100644
--- a/examples/UBO/ModuleUBO.cc
+++ b/examples/UBO/ModuleUBO.cc
@@ -10,9 +10,9 @@ namespace EUROPA {
// static C init method to get handle when loading module as shared library
extern "C"
{
- ModuleId initializeModule()
+ Module* initializeModule()
{
- return (new ModuleUBO())->getId();
+ return (new ModuleUBO());
}
}
diff --git a/examples/UBO/java/UBO/ExhaustiveSolver.java b/examples/UBO/java/UBO/ExhaustiveSolver.java
index 41d857f7d..dd7b895e6 100644
--- a/examples/UBO/java/UBO/ExhaustiveSolver.java
+++ b/examples/UBO/java/UBO/ExhaustiveSolver.java
@@ -5,7 +5,7 @@
* This is an exhaustive solver used by the Hybrid solver, it uses :
* - The incoming precedenceOracle to guide precedence selection at each decision point
* - the incoming upper bound to prune the search tree faster.
- * TODO: this was a very quick implementation to try the hybrid idea, it doesn't scale very well.
+ * TODO: this was a very quick implementation to try the hybrid idea, it doesn't scale very well.
* use ideas from best performing B&B solvers for this problem, combined with the oracle and strengthened bound, it should kick ass.
*/
import java.util.List;
@@ -19,27 +19,27 @@
import psengine.util.SimpleTimer;
public class ExhaustiveSolver
- extends RCPSPSolverBase
+ extends RCPSPSolverBase
{
List decisionStack_ = new Vector();
int lowerBound_;
int upperBound_;
SortedSet precedenceOracle_;
DecisionPoint curDP_;
-
+
public ExhaustiveSolver()
- {
+ {
}
-
+
public void solve(
- PSEngine psengine,
- long timeout,
+ PSEngine psengine,
+ long timeout,
int bound,
- boolean usePSResources)
+ boolean usePSResources)
{
// TODO: get this to work
solve(psengine,timeout,bound,Integer.MAX_VALUE,null,null,null);
- }
+ }
public void solve(
PSEngine psengine,
@@ -54,7 +54,7 @@ public void solve(
init(psengine,timeout,lowerBound,upperBound,activities,resources,precedenceOracle);
doSolve();
}
-
+
protected void doSolve()
{
for (;;) {
@@ -78,29 +78,29 @@ protected void doSolve()
bestSolution_.clear();
bestSolution_.addAll(precedences_);
timeToBest_ = timer_.getElapsed();
- RCPSPUtil.dbgout("ExhaustiveSolver found new best makespan "+bestMakespan_+" "+getSolutionAsString());
- }
+ RCPSPUtil.dbgout("ExhaustiveSolver found new best makespan "+bestMakespan_+" "+getSolutionAsString());
+ }
// if upper and lower bound cross, we're done
if (upperBound_ <= lowerBound_) {
doSolveFinished("Bounds crossed");
break;
- }
+ }
if (decisionStack_.isEmpty()) {
doSolveFinished("exhausted");
break;
}
- else
+ else
doBacktrack("Backtracking after finding solution");
}
else {
if (curDP_.hasNext()) {
executeDecision(curDP_);
- if (psengine_.getViolation() > 0)
+ if (psengine_.getViolation() > 0)
doBacktrack("Backtracking because of violation");
- else if (getMakespan() > upperBound_)
+ else if (getMakespan() > upperBound_)
doBacktrack("Backtracking because of upper bound "+getMakespan()+" vs. "+upperBound_);
}
else if (decisionStack_.isEmpty()) {
@@ -111,9 +111,9 @@ else if (decisionStack_.isEmpty()) {
doBacktrack("Backtracking because decision point exhausted choices");
}
}
- }
+ }
}
-
+
protected void doSolveFinished(String msg)
{
timer_.stop();
@@ -124,7 +124,7 @@ protected void doSolveFinished(String msg)
restoreBestSolution();
resetState();
}
-
+
public void init(
PSEngine psengine,
long timeout,
@@ -135,7 +135,7 @@ public void init(
List precedenceOracle)
{
timer_ = new SimpleTimer();
- timer_.start();
+ timer_.start();
psengine_ = psengine;
timeout_ = timeout;
@@ -143,44 +143,44 @@ public void init(
resources_ = resources;
lowerBound_ = lowerBound;
upperBound_ = upperBound;
-
+
precedenceOracle_ = new TreeSet();
for (Precedence p : precedenceOracle)
precedenceOracle_.add(p.toString());
-
+
resetSolution();
resetState();
}
-
+
void resetState()
{
- curDP_ = null;
+ curDP_ = null;
}
-
+
int lastIdx_ = 0;
-
+
protected DecisionPoint getNextDecisionPoint()
{
double lowestLevel = Double.MAX_VALUE;
Resource maxViolatedResource = null;
int maxViolatedTime = Integer.MIN_VALUE;
-
+
int start = lastIdx_;
for (int i=lastIdx_;;) {
Resource r = resources_.get(i);
ResourceViolationInfo rvi = r.getMaxViolation();
-
+
if ((rvi.level < lowestLevel) && (rvi.level < 0)) {
lowestLevel = rvi.level;
maxViolatedResource = r;
maxViolatedTime = rvi.time;
}
-
+
i = (i+1) % resources_.size();
if (i == start)
break;
- }
-
+ }
+
if (maxViolatedResource == null) {
//RCPSPUtil.dbgout("No violations found!");
return null;
@@ -188,27 +188,27 @@ protected DecisionPoint getNextDecisionPoint()
else
return new DecisionPoint(maxViolatedResource,maxViolatedTime);
}
-
+
protected void executeDecision(DecisionPoint dp)
{
decisionStack_.add(dp);
- dp.execute();
+ dp.execute();
curDP_ = null;
}
-
+
protected void doBacktrack(String reason)
{
curDP_ = decisionStack_.remove(decisionStack_.size()-1);
- curDP_.undo();
+ curDP_.undo();
//RCPSPUtil.dbgout(reason+" new stack size:"+decisionStack_.size());
}
-
+
protected class DecisionPoint
{
TreeSet choices_;
SortedSet executedChoices_;
Precedence lastExecutedChoice_;
-
+
public DecisionPoint(Resource r, int t)
{
choices_ = new TreeSet();
@@ -216,55 +216,55 @@ public DecisionPoint(Resource r, int t)
if (conflictSet.size() < 2)
RCPSPUtil.dbgout("ERROR!!: conflictSet size is :"+conflictSet.size());
-
+
for (int i=0;i oracle = new Vector();
oracle.addAll(ifirSolver_.getBestSolution());
- ifirSolver_.undoSolve();
-
+ ifirSolver_.undoSolve();
+
exhSolver_ = new ExhaustiveSolver();
exhSolver_.solve(
psengine,
@@ -63,7 +63,7 @@ public void solve(PSEngine psengine,
ifirSolver_.getActivityMap(),
ifirSolver_.getResources(),
oracle
- );
+ );
timer_.stop();
if (exhSolver_.getBestMakespan() < Integer.MAX_VALUE)
lastSolver_ = exhSolver_;
diff --git a/examples/UBO/java/UBO/IFlatIRelaxSolver.java b/examples/UBO/java/UBO/IFlatIRelaxSolver.java
index 2fc692cfb..45d9636e7 100644
--- a/examples/UBO/java/UBO/IFlatIRelaxSolver.java
+++ b/examples/UBO/java/UBO/IFlatIRelaxSolver.java
@@ -13,47 +13,47 @@
import psengine.util.SimpleTimer;
/*
- * This is a solver based on the Iterative flattening and relaxation algorithm.
+ * This is a solver based on the Iterative flattening and relaxation algorithm.
* It has been enhanced to be able to deal with general min/max precedence constraints
*/
-public class IFlatIRelaxSolver
- extends RCPSPSolverBase
+public class IFlatIRelaxSolver
+ extends RCPSPSolverBase
{
int curIteration_ = 0;
- int nbStable_ = 0;
+ int nbStable_ = 0;
int maxStable_ = 10000;
int makespanBound_;
-
+
boolean usePSResources_;
Set criticalPath_;
Map noGoods_;
boolean hasViolations_;
-
+
public void solve(PSEngine psengine,
long timeout, // in msecs
- int bound,
+ int bound,
boolean usePSResources)
{
init(psengine,timeout,bound,usePSResources);
-
+
for (int i=0; true ; i++) {
flatten();
updateSolution(i);
updateCriticalPrecedences();
-
+
if ((nbStable_ > maxStable_) || (bestMakespan_ <= makespanBound_))
break;
-
+
if (timer_.getElapsed() > timeout) {
timedOut_ = true;
break;
}
-
+
relax();
curIteration_++;
- }
+ }
restoreBestSolution();
timer_.stop();
@@ -62,7 +62,7 @@ public void solve(PSEngine psengine,
}
public boolean timedOut() { return timedOut_; }
-
+
protected Resource makeResource(PSResource r,int capacity)
{
if (usePSResources_)
@@ -70,23 +70,23 @@ protected Resource makeResource(PSResource r,int capacity)
else
return new RCPSPResource(psengine_,r,capacity);
}
-
+
protected void init(PSEngine psengine,long timeout,int bound, boolean usePSResources)
{
timer_ = new SimpleTimer();
timer_.start();
-
+
timeout_ = timeout;
timedOut_ = false;
timeToBest_=timeout;
-
+
psengine_ = psengine;
makespanBound_ = bound;
usePSResources_ = usePSResources;
-
+
List res = PSUtil.toResourceList(psengine.getObjectsByType("CapacityResource"));
resources_ = new Vector();
-
+
for (PSResource r : res) {
PSResourceProfile prof = r.getCapacity();
int t = prof.getTimes().get(0);
@@ -94,7 +94,7 @@ protected void init(PSEngine psengine,long timeout,int bound, boolean usePSResou
resources_.add(makeResource(r,capacity));
//RCPSPUtil.dbgout("capacity for resource "+r.getName()+" is "+capacity);
}
-
+
PSTokenList tokens = psengine.getTokens();
activities_ = new TreeMap();
for (int i=0;i();
noGoods_ = new HashMap();
-
+
curIteration_ = 0;
nbStable_ = 0;
-
+
resetSolution();
// Completely relax finish time
PSVariable v = psengine_.getVariableByName("maxDuration");
- v.specifyValue(PSVarValue.getInstance(100000));
+ v.specifyValue(PSVarValue.getInstance(100000));
}
public void flatten()
{
hasViolations_ = true;
boolean addedConstraint = true;
-
+
while (hasViolations_) {
hasViolations_ = false;
addedConstraint = false;
for (Resource r : resources_) {
//RCPSPUtil.dbgout("Before flatten() step : "+r.toString());
-
+
ResourceViolationInfo rvi = r.getMaxViolation();
int t = rvi.time;
- if (t >= 0) {
+ if (t >= 0) {
hasViolations_ = true;
- if (addPrecedenceConstraint(r,t))
+ if (addPrecedenceConstraint(r,t))
addedConstraint = true;
}
- //RCPSPUtil.dbgout("After flatten() step : "+r.toString());
+ //RCPSPUtil.dbgout("After flatten() step : "+r.toString());
}
-
+
if (!addedConstraint)
break;
-
+
if (timer_.getElapsed() > timeout_) {
timedOut_ = true;
break;
- }
+ }
}
-
+
//if (hasViolations_)
- // RCPSPUtil.dbgout("WARNING:unable to remove all violations");
+ // RCPSPUtil.dbgout("WARNING:unable to remove all violations");
//RCPSPUtil.dbgout("flatten() finished "+timer_.getElapsedString());
}
-
+
public void relax()
{
- double probOfDeletion = 0.3;
+ double probOfDeletion = 0.3;
int before = precedences_.size();
-
+
boolean removed = false;
psengine_.setAutoPropagation(false);
@@ -165,52 +165,52 @@ public void relax()
List precs = new Vector();
precs.addAll(precedences_);
for (Precedence p : precs) {
- if (p.isCritical && (Math.random() < probOfDeletion)) {
- removePrecedence(p);
+ if (p.isCritical && (Math.random() < probOfDeletion)) {
+ removePrecedence(p);
removed = true;
}
-
+
if (timer_.getElapsed() > timeout_) {
timedOut_ = true;
break;
- }
+ }
}
-
+
// make sure we remove at least one precedence
if (!removed) {
for (Precedence p : precs) {
if (p.isCritical) {
- removePrecedence(p);
- break;
+ removePrecedence(p);
+ break;
}
}
}
- psengine_.setAutoPropagation(true);
-
+ psengine_.setAutoPropagation(true);
+
//RCPSPUtil.dbgout("Removed "+(before-precedences_.size())+" out of "+before+" precedences");
//RCPSPUtil.dbgout("after relax. makespan (current,best)=("+getMakespan()+","+bestMakespan_+")");
//RCPSPUtil.dbgout("relax() finished "+timer_.getElapsedString());
}
-
+
/*
* Try to fix capacity violation on resource r at time t by adding a precedence constraint
*/
protected boolean addPrecedenceConstraint(Resource r,int t)
- {
+ {
List conflictSet = r.getConflictSet(t);
-
+
if (conflictSet.size() < 2) {
RCPSPUtil.dbgout(r.getName()+": conflict set has less than 2 elements, bailing out without adding precedence constraint");
return false;
}
-
+
TreeSet candidates = new TreeSet();
-
+
// look for the pair of tokens with max(succ.LatestStart-pred.EarliestFinish)
for (int i=0;i 0) {
- removePrecedence(p);
- addNoGood(p.pred,p.succ); // this can happen because of the max distance constraints, add a no-good
- }
+ removePrecedence(p);
+ addNoGood(p.pred,p.succ); // this can happen because of the max distance constraints, add a no-good
+ }
else
return true;
}
-
+
//RCPSPUtil.dbgout("WARNING!: for "+r.getName()+" could not find activity pair with positive slack, bailing out without adding precedence constraint");
return false;
}
-
+
String getNoGoodKey(PSToken pred,PSToken succ)
{
int actPred = RCPSPUtil.getActivity(pred);
int actSucc = RCPSPUtil.getActivity(succ);
- return actPred + "<" + actSucc;
+ return actPred + "<" + actSucc;
}
-
+
int tabuTenure_ = 1;
-
+
void addNoGood(PSToken pred,PSToken succ)
{
String key = getNoGoodKey(pred,succ);
- noGoods_.put(key,curIteration_+tabuTenure_);
+ noGoods_.put(key,curIteration_+tabuTenure_);
//RCPSPUtil.dbgout(curIteration_+" added noGood:{"+key+"}");
}
-
+
boolean isNoGood(PSToken pred,PSToken succ)
{
String key = getNoGoodKey(pred,succ);
Integer iteration = noGoods_.get(key);
-
+
if (iteration == null)
return false;
-
+
return (iteration.intValue() > curIteration_);
}
-
+
protected void addPrecedence(Precedence p)
{
//RCPSPUtil.dbgout("adding {"+RCPSPUtil.getActivity(p.pred)+"<"+RCPSPUtil.getActivity(p.succ)+"} because of "+p.res.getName());
@@ -275,15 +275,15 @@ protected void removePrecedence(Precedence p)
//RCPSPUtil.dbgout("removing {"+RCPSPUtil.getActivity(p.pred)+"<"+RCPSPUtil.getActivity(p.succ)+"} because of "+p.res.getName());
p.res.removePrecedence(p.pred,p.succ);
precedences_.remove(p);
- //RCPSPUtil.dbgout("removed {"+RCPSPUtil.getActivity(p.pred)+"<"+RCPSPUtil.getActivity(p.succ)+"} because of "+p.res.getName());
+ //RCPSPUtil.dbgout("removed {"+RCPSPUtil.getActivity(p.pred)+"<"+RCPSPUtil.getActivity(p.succ)+"} because of "+p.res.getName());
}
-
+
protected void updateSolution(int iteration)
- {
+ {
int newMakespan = getMakespan();
String violationMsg = (hasViolations_ ? " with violations" : "");
//RCPSPUtil.dbgout("Iteration "+iteration+": found makespan "+newMakespan+violationMsg);
-
+
if (newMakespan < bestMakespan_ && !hasViolations_) {
bestMakespan_ = newMakespan;
bestSolution_.clear();
@@ -296,36 +296,36 @@ protected void updateSolution(int iteration)
nbStable_++;
}
}
-
- public SortedMap getActivityMap() { return activities_; }
+
+ public SortedMap getActivityMap() { return activities_; }
/* (non-Javadoc)
* @see UBO.RCPSPSolver#getActivities()
*/
-
+
protected void updateCriticalPrecedences()
{
// TODO: this only works if we're working with a solution that doesn't have any temporal violations
/*
int savedUb = RCPSPUtil.getUb(getProjectFinish());
-
+
// TODO: mark activities on the critical path
- for (Precedence p : precs) {
+ for (Precedence p : precs) {
if (criticalPath_.contains(pred.getKey) || criticalPath_.contains(pred.getKey))
p.isCritical = true;
else
p.isCritical = false;
- }
- */
+ }
+ */
}
-
+
public String printResources()
{
StringBuffer buf = new StringBuffer();
-
+
for (Resource r : resources_) {
buf.append(r.toString()).append("\n");
}
-
- return buf.toString();
- }
+
+ return buf.toString();
+ }
}
diff --git a/examples/UBO/java/UBO/Main.java b/examples/UBO/java/UBO/Main.java
index 4fa9fe9b4..facc56e64 100644
--- a/examples/UBO/java/UBO/Main.java
+++ b/examples/UBO/java/UBO/Main.java
@@ -13,7 +13,7 @@
class Main
{
protected static PSEngine psEngine_;
-
+
public static void main(String args[])
{
if ((args.length >= 4) && !(args[3].equals(""))) {
@@ -21,13 +21,13 @@ public static void main(String args[])
}
else {
String debugMode = args[0];
- PSUtil.loadLibraries(debugMode);
+ PSUtil.loadLibraries(debugMode);
psEngine_ = PSEngine.makeInstance();
psEngine_.start();
Runtime.getRuntime().addShutdownHook(new ShutdownHook());
loadCustomCode(debugMode);
-
+
if((args.length >= 3) && args[2].equals("nogui")) {
Interpreter bshInterpreter_ = new bsh.Interpreter();
try {
@@ -36,7 +36,7 @@ public static void main(String args[])
}
catch (Exception e) {
throw new RuntimeException(e);
- }
+ }
}
else {
PSDesktop d = PSDesktop.makeInstance(psEngine_,args);
@@ -44,50 +44,50 @@ public static void main(String args[])
}
}
}
-
+
protected static void loadCustomCode(String debugMode)
{
//Load module with any custom code if it exists:
String libName = "UBO_" + debugMode;
- String fullLibName = LibraryLoader.getResolvedName(libName);
+ String fullLibName = LibraryLoader.getResolvedName(libName);
if(fullLibName == null) {
// Run 'make' to compile the library if you need it:
- System.out.println("INFO: Custom library " + libName + " wasn't found and won't be loaded.");
+ System.out.println("INFO: Custom library " + libName + " wasn't found and won't be loaded.");
}
else {
// WARNING: Shared library loaded twice (see ticket #164)
System.load(fullLibName);
psEngine_.loadModule(fullLibName);
- }
+ }
}
-
-
- static class ShutdownHook extends Thread
+
+
+ static class ShutdownHook extends Thread
{
public ShutdownHook()
{
super("ShutdownHook");
}
-
- public void run()
+
+ public void run()
{
psEngine_.shutdown();
}
- }
-
-
+ }
+
+
public static void runBatchTest(String args[])
{
try {
String debugMode = args[0];
String test = args[3];
Integer bound = new Integer(args[4]);
- long timeoutMsecs = (new Integer(args[5])).intValue() * 1000;
+ long timeoutMsecs = (new Integer(args[5])).intValue() * 1000;
String solver = args[6];
System.out.println("Running batch test: "+debugMode+" "+test+" "+bound+" "+timeoutMsecs+" "+solver);
- LibraryLoader.loadLibrary("System_"+debugMode);
+ LibraryLoader.loadLibrary("System_"+debugMode);
PSEngine engine = PSEngine.makeInstance();
engine.start();
String nddlModel = "UBO-gen-initial-state.nddl";
@@ -102,21 +102,21 @@ else if ("Hybrid".equals(solver))
else
throw new RuntimeException("Unknown solver:"+solver);
- //engine.shutdown(); TODO: this is causing problems
+ //engine.shutdown(); TODO: this is causing problems
}
catch (Exception e) {
- throw new RuntimeException(e);
+ throw new RuntimeException(e);
}
- }
-
+ }
+
public static void runBuiltInSolver(PSEngine engine,String solverName, String test,Integer bound, long timeoutMsecs)
{
PSVariable v = engine.getVariableByName("maxDuration");
v.specifyValue(PSVarValue.getInstance(bound));
PSSolver solver = engine.createSolver("PlannerConfig.xml"/*config*/);
- solver.configure(0/*horizonStart*/,1000/*horizonEnd*/);
-
+ solver.configure(0/*horizonStart*/,1000/*horizonEnd*/);
+
SimpleTimer timer = new SimpleTimer();
timer.start();
boolean timedOut = false;
@@ -128,7 +128,7 @@ public static void runBuiltInSolver(PSEngine engine,String solverName, String te
}
}
timer.stop();
-
+
// Save results
// test-name bound best-makespan time-in-msecs solution stepCount
int makespan = ((timedOut || solver.isExhausted()) ? 0 : bound); // TODO: this could be lower, ground solution and find out
@@ -141,17 +141,17 @@ public static void runBuiltInSolver(PSEngine engine,String solverName, String te
//.append(s.getSolutionAsString()) // TODO: extract solution
.append(solver.getStepCount()).append(separator)
.append("\n");
-
- writeToFile("Solver-"+solverName+"-"+timeoutMsecs+".txt",buf.toString());
+
+ writeToFile("Solver-"+solverName+"-"+timeoutMsecs+".txt",buf.toString());
}
public static void runRCPSPSolver(PSEngine engine,RCPSPSolver s, String test,Integer bound, long timeoutMsecs)
- {
+ {
// TODO: since this is randomized, run several times an get avg
boolean usePSResources = false; // TODO: eventually switch to true
s.solve(engine,timeoutMsecs,bound,usePSResources);
//RCPSPUtil.ground(s.getActivities());
-
+
// Save results
// test-name bound best-makespan time-in-msecs solution
int makespan = (s.getBestMakespan() != Integer.MAX_VALUE ? s.getBestMakespan() : 0);
@@ -164,20 +164,20 @@ public static void runRCPSPSolver(PSEngine engine,RCPSPSolver s, String test,Int
.append(s.getTimeToBest()).append(separator)
.append(s.getSolutionAsString())
.append("\n");
-
+
String filename = "Solver-"+s.getName()+"-"+(s.getActivities().size()-2)+".txt";
writeToFile(filename,buf.toString());
- }
-
+ }
+
protected static void writeToFile(String filename,String str)
{
try {
BufferedWriter out = new BufferedWriter(new FileWriter(filename,true/*append*/));
out.write(str);
out.close();
- }
+ }
catch (Exception e) {
throw new RuntimeException(e);
- }
+ }
}
}
diff --git a/examples/UBO/java/UBO/PSResourceWrapper.java b/examples/UBO/java/UBO/PSResourceWrapper.java
index 2dd64344b..1a4e4cd11 100644
--- a/examples/UBO/java/UBO/PSResourceWrapper.java
+++ b/examples/UBO/java/UBO/PSResourceWrapper.java
@@ -8,13 +8,13 @@
/*
* This is a thin wrapper around PSResource
*/
-public class PSResourceWrapper extends ResourceBase
+public class PSResourceWrapper extends ResourceBase
{
public PSResourceWrapper(PSEngine pse,PSResource r, int capacity)
{
super(pse,r,capacity);
}
-
+
public List getConflictSet(int t)
{
List retval = new Vector();
@@ -24,15 +24,15 @@ public List getConflictSet(int t)
PSToken tok = psengine_.getTokenByKey(tokKeys.get(i));
retval.add(tok);
}
-
+
return retval;
}
-
+
public ResourceViolationInfo getMaxViolation()
{
int t = -1;
double lowestLevel = Double.MAX_VALUE;
-
+
PSResourceProfile prof = res_.getVDLevels();
PSTimePointList times = prof.getTimes();
for (int i=0; i=0)
RCPSPUtil.dbgout("MaxViolation for "+res_.getEntityName()+" "+lowestLevel+" at time "+t);
-
- return new ResourceViolationInfo(t,lowestLevel);
- }
+
+ return new ResourceViolationInfo(t,lowestLevel);
+ }
}
diff --git a/examples/UBO/java/UBO/PlanHistoryEntry.java b/examples/UBO/java/UBO/PlanHistoryEntry.java
index 34e1d652d..8fab6db55 100644
--- a/examples/UBO/java/UBO/PlanHistoryEntry.java
+++ b/examples/UBO/java/UBO/PlanHistoryEntry.java
@@ -6,7 +6,7 @@ public class PlanHistoryEntry
Long remainingTreeSize_;
String currentTree_;
String currentPlan_;
-
+
public PlanHistoryEntry(
Integer step,
Long remainingTreeSize,
@@ -18,19 +18,19 @@ public PlanHistoryEntry(
currentTree_ = currentTree;
currentPlan_ = currentPlan;
}
-
+
public Integer getStepNumber() { return step_; }
public Long getRemainingTreeSize() { return remainingTreeSize_; }
public String getCurrentTree() { return currentTree_; }
- public String getCurrentPlan() { return currentPlan_; }
-
+ public String getCurrentPlan() { return currentPlan_; }
+
public String toString()
{
StringBuffer buf = new StringBuffer();
buf.append(step_).append(": ")
.append("(").append(remainingTreeSize_).append(")")
.append(currentTree_)
- .append(currentPlan_);
+ .append(currentPlan_);
return buf.toString();
}
}
diff --git a/examples/UBO/java/UBO/Precedence.java b/examples/UBO/java/UBO/Precedence.java
index 647ec0574..2e1769fd3 100644
--- a/examples/UBO/java/UBO/Precedence.java
+++ b/examples/UBO/java/UBO/Precedence.java
@@ -17,28 +17,28 @@ public Precedence(PSResource r,PSToken p,PSToken s)
this(r,p,s,0);
int succStart = RCPSPUtil.getUb(succ.getStart());
int predFinish = RCPSPUtil.getLb(pred.getEnd());
- buffer = succStart-predFinish;
+ buffer = succStart-predFinish;
}
public Precedence(PSResource r,PSToken p,PSToken s, int b)
{
res = r;
pred = p;
- succ = s;
+ succ = s;
isCritical = true;
buffer = b;
- }
+ }
public int compareTo(Object o)
{
Precedence rhs = (Precedence)o;
return rhs.buffer - buffer;
}
-
+
public String toString()
{
StringBuffer buf = new StringBuffer();
buf.append(RCPSPUtil.getActivity(pred)).append("<").append(RCPSPUtil.getActivity(succ));
return buf.toString();
}
-}
+}
diff --git a/examples/UBO/java/UBO/RCPSPResource.java b/examples/UBO/java/UBO/RCPSPResource.java
index a76ac443e..c328fc5e9 100644
--- a/examples/UBO/java/UBO/RCPSPResource.java
+++ b/examples/UBO/java/UBO/RCPSPResource.java
@@ -9,13 +9,13 @@
/*
* This is a version of Resource that performs much more computation outside EUROPA than PSResourceWrapper
*/
-public class RCPSPResource extends ResourceBase
-{
+public class RCPSPResource extends ResourceBase
+{
public RCPSPResource(PSEngine pse,PSResource r, int capacity)
{
super(pse,r,capacity);
}
-
+
public List getConflictSet(int t)
{
List conflictSet = new Vector();
@@ -23,7 +23,7 @@ public List getConflictSet(int t)
PSTokenList toks = res_.getTokens();
for (int i=0;i getConflictSet(int t)
// Don't try to order tokens that can't be ordered
int predEndLb = RCPSPUtil.getLb(pred.getEnd());
int succStartUb = RCPSPUtil.getUb(pred.getStart());
-
+
if ((pred != succ) && (predEndLb <= succStartUb)) {
retval.add(pred);
retval.add(succ);
}
}
}
-
+
return retval;
}
-
+
public ResourceViolationInfo getMaxViolation()
{
int lowestTime = -1;
double lowestLevel = Double.MAX_VALUE;
-
+
ResourceProfile prof = getLevels();
Iterator times = prof.getTimes().iterator();
while (times.hasNext()) {
@@ -60,10 +60,10 @@ public ResourceViolationInfo getMaxViolation()
lowestTime = t;
}
}
-
+
//if (lowestTime>=0)
// RCPSPUtil.dbgout("MaxViolation for "+res_.getName()+" "+lowestLevel+" at time "+lowestTime);
-
- return new ResourceViolationInfo(lowestTime,lowestLevel);
+
+ return new ResourceViolationInfo(lowestTime,lowestLevel);
}
}
diff --git a/examples/UBO/java/UBO/RCPSPSolver.java b/examples/UBO/java/UBO/RCPSPSolver.java
index 1a94a2589..f1c426307 100644
--- a/examples/UBO/java/UBO/RCPSPSolver.java
+++ b/examples/UBO/java/UBO/RCPSPSolver.java
@@ -5,13 +5,13 @@
import psengine.PSEngine;
import psengine.PSToken;
-public interface RCPSPSolver
+public interface RCPSPSolver
{
public String getName();
-
- public void solve(PSEngine psengine,
+
+ public void solve(PSEngine psengine,
long timeout, // in msecs
- int bound,
+ int bound,
boolean usePSResources);
public long getElapsedMsecs();
@@ -28,4 +28,4 @@ public void solve(PSEngine psengine,
public String getSolutionAsString();
-}
\ No newline at end of file
+}
diff --git a/examples/UBO/java/UBO/RCPSPSolverBase.java b/examples/UBO/java/UBO/RCPSPSolverBase.java
index d484bbd16..46b3a77b4 100644
--- a/examples/UBO/java/UBO/RCPSPSolverBase.java
+++ b/examples/UBO/java/UBO/RCPSPSolverBase.java
@@ -13,8 +13,8 @@
import psengine.PSVariable;
import psengine.util.SimpleTimer;
-public abstract class RCPSPSolverBase
- implements RCPSPSolver
+public abstract class RCPSPSolverBase
+ implements RCPSPSolver
{
protected SimpleTimer timer_;
protected boolean timedOut_;
@@ -23,15 +23,15 @@ public abstract class RCPSPSolverBase
protected int bestMakespan_;
protected PSEngine psengine_;
- protected List resources_;
+ protected List resources_;
protected SortedMap activities_;
protected SortedSet precedences_;
-
- protected SortedSet bestSolution_;
-
+
+ protected SortedSet bestSolution_;
+
public String getName() { return getClass().getSimpleName(); }
-
- public Collection getActivities() { return activities_.values(); }
+
+ public Collection getActivities() { return activities_.values(); }
public List getResources() { return resources_; }
public SortedSet getPrecedences() { return precedences_; }
@@ -39,51 +39,51 @@ public abstract class RCPSPSolverBase
public int getBestMakespan() { return bestMakespan_; }
public long getTimeToBest() { return timeToBest_; }
public SortedSet getBestSolution() { return bestSolution_; }
-
+
public void undoSolve()
{
psengine_.setAutoPropagation(false);
for (Precedence p : bestSolution_)
p.res.removePrecedence(p.pred,p.succ);
-
- psengine_.setAutoPropagation(true);
+
+ psengine_.setAutoPropagation(true);
}
-
+
public void restoreBestSolution()
{
psengine_.setAutoPropagation(false);
-
+
for (Precedence p : precedences_)
p.res.removePrecedence(p.pred,p.succ);
precedences_.clear();
-
+
for (Precedence p : bestSolution_)
- p.res.addPrecedence(p.pred,p.succ);
+ p.res.addPrecedence(p.pred,p.succ);
- psengine_.setAutoPropagation(true);
+ psengine_.setAutoPropagation(true);
}
-
+
public String getSolutionAsString()
{
StringBuffer buf = new StringBuffer();
-
- for (Precedence p : bestSolution_)
+
+ for (Precedence p : bestSolution_)
buf.append("{").append(RCPSPUtil.getActivity(p.pred)).append("<").append(RCPSPUtil.getActivity(p.succ)).append("}");
-
+
return buf.toString();
- }
-
+ }
+
public int getMakespan()
{
return RCPSPUtil.getLb(getProjectFinish());
}
-
+
public PSVariable getProjectFinish()
{
return activities_.get(activities_.lastKey()).getStart();
- }
-
+ }
+
protected void addPrecedence(Precedence p)
{
//RCPSPUtil.dbgout("adding {"+RCPSPUtil.getActivity(p.pred)+"<"+RCPSPUtil.getActivity(p.succ)+"} because of "+p.res.getName());
@@ -97,42 +97,42 @@ protected void removePrecedence(Precedence p)
//RCPSPUtil.dbgout("removing {"+RCPSPUtil.getActivity(p.pred)+"<"+RCPSPUtil.getActivity(p.succ)+"} because of "+p.res.getName());
p.res.removePrecedence(p.pred,p.succ);
precedences_.remove(p);
- //RCPSPUtil.dbgout("removed {"+RCPSPUtil.getActivity(p.pred)+"<"+RCPSPUtil.getActivity(p.succ)+"} because of "+p.res.getName());
- }
+ //RCPSPUtil.dbgout("removed {"+RCPSPUtil.getActivity(p.pred)+"<"+RCPSPUtil.getActivity(p.succ)+"} because of "+p.res.getName());
+ }
// TODO: do this faster with a key
boolean isPrecedence(PSToken pred,PSToken succ)
{
int actPred = RCPSPUtil.getActivity(pred);
int actSucc = RCPSPUtil.getActivity(succ);
-
+
for (Precedence p : precedences_) {
- if ((RCPSPUtil.getActivity(p.pred)==actPred) && (RCPSPUtil.getActivity(p.succ)==actSucc))
- return true;
+ if ((RCPSPUtil.getActivity(p.pred)==actPred) && (RCPSPUtil.getActivity(p.succ)==actSucc))
+ return true;
}
-
+
return false;
- }
+ }
+
-
protected void resetSolution()
{
bestMakespan_ = Integer.MAX_VALUE;
- bestSolution_ = new TreeSet(new PrecedenceComparator());
+ bestSolution_ = new TreeSet(new PrecedenceComparator());
precedences_ = new TreeSet(new PrecedenceComparator());
}
-
+
static class PrecedenceComparator
implements Comparator
{
- public int compare(Precedence o1, Precedence o2)
+ public int compare(Precedence o1, Precedence o2)
{
int diff = RCPSPUtil.getActivity(o1.pred) - RCPSPUtil.getActivity(o2.pred);
- if (diff != 0)
+ if (diff != 0)
return diff;
- else
+ else
return RCPSPUtil.getActivity(o1.succ) - RCPSPUtil.getActivity(o2.succ);
}
- }
+ }
}
diff --git a/examples/UBO/java/UBO/RCPSPUtil.java b/examples/UBO/java/UBO/RCPSPUtil.java
index 788ed50fc..9d51a21b1 100644
--- a/examples/UBO/java/UBO/RCPSPUtil.java
+++ b/examples/UBO/java/UBO/RCPSPUtil.java
@@ -6,63 +6,63 @@
import psengine.PSVarValue;
import psengine.PSVariable;
-public class RCPSPUtil
+public class RCPSPUtil
{
public static int getActivity(PSToken tok)
{
return tok.getMaster().getParameter("m_identifier").getSingletonValue().asInt();
}
-
+
public static int getLb(PSVariable v)
{
if (v.isSingleton())
return (new Double(valueToString(v.getSingletonValue()))).intValue();
else if (v.isInterval())
return (int)v.getLowerBound();
-
+
throw new RuntimeException("Can only get lb for singleton or interval vars");
}
-
+
public static int getUb(PSVariable v)
{
if (v.isSingleton())
return (new Double(valueToString(v.getSingletonValue()))).intValue();
else if (v.isInterval())
return (int)v.getUpperBound();
-
+
throw new RuntimeException("Can only get ub for singleton or interval vars");
}
-
+
public static boolean overlaps(PSToken tok, int t)
{
int lb = getLb(tok.getStart());
int ub = getLb(tok.getEnd());
-
+
return ((lb <= t) && (t <= ub));
- }
+ }
public static String valueToString(PSVarValue v)
{
String type = v.getType().toString();
-
+
if ("STRING".equals(type))
return v.asString();
if ("INTEGER".equals(type))
- return new Integer(v.asInt()).toString();
+ return new Integer(v.asInt()).toString();
if ("DOUBLE".equals(type))
return new Double(v.asDouble()).toString();
if ("BOOLEAN".equals(type))
return new Boolean(v.asBoolean()).toString();
if ("OBJECT".equals(type))
return v.asObject().getEntityName();
-
+
return "ERROR!!! UNKNOWN TYPE :" + type;
}
public static String varValueToString(PSVariable var)
- {
- if (var.isSingleton())
- return valueToString(var.getSingletonValue());
+ {
+ if (var.isSingleton())
+ return valueToString(var.getSingletonValue());
else if (var.isInterval()) {
StringBuffer buf = new StringBuffer();
buf.append("[").append(var.getLowerBound()).append(",")
@@ -81,9 +81,9 @@ else if (var.isEnumerated()) {
buf.append("]");
return buf.toString();
}
-
+
throw new RuntimeException("Unexpected ERROR: variable "+var.getEntityName()+" is not one of {Singleton, Interval, Enumeration}");
- }
+ }
public static void ground(Collection tokens)
{
@@ -92,12 +92,12 @@ public static void ground(Collection tokens)
ground(t.getEnd());
}
}
-
+
public static void ground(PSVariable v)
{
int value = RCPSPUtil.getLb(v);
v.specifyValue(PSVarValue.getInstance(value));
- }
+ }
public static void undoGround(Collection tokens)
{
@@ -110,11 +110,11 @@ public static void undoGround(PSVariable v)
{
int value = RCPSPUtil.getLb(v);
v.reset();
- }
+ }
+
-
public static void dbgout(String msg)
{
System.out.println(msg);
- }
+ }
}
diff --git a/examples/UBO/java/UBO/ResourceBase.java b/examples/UBO/java/UBO/ResourceBase.java
index 144381d23..79ac71eaa 100644
--- a/examples/UBO/java/UBO/ResourceBase.java
+++ b/examples/UBO/java/UBO/ResourceBase.java
@@ -2,32 +2,32 @@
import psengine.*;
-public abstract class ResourceBase implements Resource
+public abstract class ResourceBase implements Resource
{
protected PSEngine psengine_;
protected PSResource res_;
protected int capacity_;
-
+
public ResourceBase(PSEngine pse,PSResource r, int capacity)
{
psengine_ = pse;
capacity_ = capacity;
res_ = r;
}
-
+
public int getCapacity() { return capacity_; }
public PSResource getPSResource() { return res_; }
public String getName() { return res_.getEntityName(); }
-
+
public ResourceProfile getLevels()
{
return new ResourceProfile(this);
}
-
+
public String toString()
{
StringBuffer buf = new StringBuffer();
buf.append(res_.getEntityName()).append(" ").append(getLevels().toString());
return buf.toString();
- }
+ }
}
diff --git a/examples/UBO/java/UBO/ResourceProfile.java b/examples/UBO/java/UBO/ResourceProfile.java
index 5f0e5f84d..8c0bb7609 100644
--- a/examples/UBO/java/UBO/ResourceProfile.java
+++ b/examples/UBO/java/UBO/ResourceProfile.java
@@ -8,40 +8,40 @@
import psengine.*;
-public class ResourceProfile
-{
+public class ResourceProfile
+{
protected Resource res_;
protected SortedMap levels_;
-
+
public ResourceProfile(Resource r)
{
res_ = r;
init();
}
-
+
protected void init()
{
levels_ = new TreeMap();
levels_.put(0,res_.getCapacity());
-
+
PSTokenList acts = res_.getPSResource().getTokens();
for (int i=0;i> it = levels_.entrySet().iterator();
+ if (levelAtStart == null) {
+ Iterator> it = levels_.entrySet().iterator();
while(it.hasNext()) {
Entry entry = it.next();
if (entry.getKey() < start)
@@ -51,27 +51,27 @@ protected void update(int start,int end,int qty)
}
levels_.put(start, levelAtStart);
}
-
+
Integer lastValue=levelAtStart;
SortedMap submap = levels_.subMap(start, end); // this doesn't include end
- Iterator> it = submap.entrySet().iterator();
+ Iterator> it = submap.entrySet().iterator();
while(it.hasNext()) {
Entry entry = it.next();
lastValue = entry.getValue()-qty;
- entry.setValue(lastValue);
+ entry.setValue(lastValue);
}
-
+
Integer levelAtEnd=levels_.get(end);
if (levelAtEnd == null)
levels_.put(end, lastValue+qty);
-
- }
-
+
+ }
+
public Set getTimes() { return levels_.keySet(); }
-
+
// TODO: make this more sophisticated
public Integer getLevel(Integer time) { return levels_.get(time); }
-
+
public String toString()
{
StringBuffer buf = new StringBuffer();
@@ -81,7 +81,7 @@ public String toString()
Integer t = times.next();
buf.append("{").append(t).append("=").append(getLevel(t)).append("}");
}
-
+
return buf.toString();
}
}
diff --git a/examples/UBO/java/UBO/ResourceViolationInfo.java b/examples/UBO/java/UBO/ResourceViolationInfo.java
index 7cfe969db..7a4417f5f 100644
--- a/examples/UBO/java/UBO/ResourceViolationInfo.java
+++ b/examples/UBO/java/UBO/ResourceViolationInfo.java
@@ -1,10 +1,10 @@
package UBO;
-public class ResourceViolationInfo
+public class ResourceViolationInfo
{
public int time;
public double level;
-
+
public ResourceViolationInfo(int t,double l)
{
time = t;
diff --git a/examples/UBO/java/UBO/SolDistExhaustiveSolver.java b/examples/UBO/java/UBO/SolDistExhaustiveSolver.java
index f52bea868..77e1b0db7 100644
--- a/examples/UBO/java/UBO/SolDistExhaustiveSolver.java
+++ b/examples/UBO/java/UBO/SolDistExhaustiveSolver.java
@@ -12,36 +12,36 @@
/*
* this is a different version of the Exhaustive solver that didn't turn out to be an improvement
- * instead of starting from scratch, it removes 1, then 2, then 3 ... precedences from the incoming oracle and then
+ * instead of starting from scratch, it removes 1, then 2, then 3 ... precedences from the incoming oracle and then
* performs and exhaustive search.
* Leaving the code around for now, in case this idea can be reused in some form later.
* For now it looks like it'll be much better to improve the Exhaustive solver by using ideas from existing B&B solvers
*/
public class SolDistExhaustiveSolver
- extends RCPSPSolverBase
+ extends RCPSPSolverBase
{
List decisionStack_ = new Vector();
int lowerBound_;
int upperBound_;
SortedSet precedenceOracle_;
DecisionPoint curDP_;
-
+
public SolDistExhaustiveSolver()
- {
+ {
}
-
+
public void solve(
- PSEngine psengine,
- long timeout,
+ PSEngine psengine,
+ long timeout,
int bound,
- boolean usePSResources)
+ boolean usePSResources)
{
// TODO: get this to work
solve(psengine,timeout,bound,Integer.MAX_VALUE,null,null,null);
- }
+ }
Precedence noGood_ = null;
-
+
public void solve(
PSEngine psengine,
long timeout,
@@ -57,20 +57,20 @@ public void solve(
if (precedenceOracle.size() > 0) {
for (int i=0;i exclusions = it.next();
+ List exclusions = it.next();
removePrecedences(exclusions);
doSolve();
if (upperBound_ <= lowerBound_ || timedOut_) {
solveFinished(precedenceOracle);
- return;
+ return;
}
-
+
undoSolve();
- addPrecedences(exclusions);
+ addPrecedences(exclusions);
}
}
}
@@ -80,13 +80,13 @@ public void solve(
solveFinished(precedenceOracle);
}
-
+
protected void solveFinished(List precedenceOracle)
{
bestSolution_.addAll(precedenceOracle);
- timer_.stop();
+ timer_.stop();
}
-
+
protected void doSolve()
{
for (;;) {
@@ -110,29 +110,29 @@ protected void doSolve()
bestSolution_.clear();
bestSolution_.addAll(precedences_);
timeToBest_ = timer_.getElapsed();
- RCPSPUtil.dbgout("ExhaustiveSolver found new best makespan "+bestMakespan_+" "+getSolutionAsString());
- }
+ RCPSPUtil.dbgout("ExhaustiveSolver found new best makespan "+bestMakespan_+" "+getSolutionAsString());
+ }
// if upper and lower bound cross, we're done
if (upperBound_ <= lowerBound_) {
doSolveFinished("Bounds crossed");
break;
- }
+ }
if (decisionStack_.isEmpty()) {
doSolveFinished("exhausted");
break;
}
- else
+ else
doBacktrack("Backtracking after finding solution");
}
else {
if (curDP_.hasNext()) {
executeDecision(curDP_);
- if (psengine_.getViolation() > 0)
+ if (psengine_.getViolation() > 0)
doBacktrack("Backtracking because of violation");
- else if (getMakespan() > upperBound_)
+ else if (getMakespan() > upperBound_)
doBacktrack("Backtracking because of upper bound "+getMakespan()+" vs. "+upperBound_);
}
else if (decisionStack_.isEmpty()) {
@@ -143,9 +143,9 @@ else if (decisionStack_.isEmpty()) {
doBacktrack("Backtracking because decision point exhausted choices");
}
}
- }
+ }
}
-
+
protected void doSolveFinished(String msg)
{
// TODO: timer_.stop();
@@ -156,7 +156,7 @@ protected void doSolveFinished(String msg)
restoreBestSolution();
resetState();
}
-
+
public void init(
PSEngine psengine,
long timeout,
@@ -167,7 +167,7 @@ public void init(
List precedenceOracle)
{
timer_ = new SimpleTimer();
- timer_.start();
+ timer_.start();
psengine_ = psengine;
timeout_ = timeout;
@@ -175,44 +175,44 @@ public void init(
resources_ = resources;
lowerBound_ = lowerBound;
upperBound_ = upperBound;
-
+
precedenceOracle_ = new TreeSet();
for (Precedence p : precedenceOracle)
precedenceOracle_.add(p.toString());
-
+
resetSolution();
resetState();
}
-
+
void resetState()
{
- curDP_ = null;
+ curDP_ = null;
}
-
+
int lastIdx_ = 0;
-
+
protected DecisionPoint getNextDecisionPoint()
{
double lowestLevel = Double.MAX_VALUE;
Resource maxViolatedResource = null;
int maxViolatedTime = Integer.MIN_VALUE;
-
+
int start = lastIdx_;
for (int i=lastIdx_;;) {
Resource r = resources_.get(i);
ResourceViolationInfo rvi = r.getMaxViolation();
-
+
if ((rvi.level < lowestLevel) && (rvi.level < 0)) {
lowestLevel = rvi.level;
maxViolatedResource = r;
maxViolatedTime = rvi.time;
}
-
+
i = (i+1) % resources_.size();
if (i == start)
break;
- }
-
+ }
+
if (maxViolatedResource == null) {
//RCPSPUtil.dbgout("No violations found!");
return null;
@@ -220,38 +220,38 @@ protected DecisionPoint getNextDecisionPoint()
else
return new DecisionPoint(maxViolatedResource,maxViolatedTime);
}
-
+
protected void executeDecision(DecisionPoint dp)
{
decisionStack_.add(dp);
- dp.execute();
+ dp.execute();
curDP_ = null;
}
-
+
protected void doBacktrack(String reason)
{
curDP_ = decisionStack_.remove(decisionStack_.size()-1);
- curDP_.undo();
+ curDP_.undo();
//RCPSPUtil.dbgout(reason+" new stack size:"+decisionStack_.size());
}
-
+
boolean isNoGood(PSToken pred,PSToken succ)
{
return false;
- /*
+ /*
if (noGood_ == null)
return false;
-
+
return ((noGood_.pred.getKey()==pred.getKey()) && (noGood_.succ.getKey() == succ.getKey()));
*/
}
-
+
protected class DecisionPoint
{
TreeSet choices_;
SortedSet executedChoices_;
Precedence lastExecutedChoice_;
-
+
public DecisionPoint(Resource r, int t)
{
choices_ = new TreeSet();
@@ -259,78 +259,78 @@ public DecisionPoint(Resource r, int t)
if (conflictSet.size() < 2)
RCPSPUtil.dbgout("ERROR!!: conflictSet size is :"+conflictSet.size());
-
+
for (int i=0;i l)
{
psengine_.setAutoPropagation(false);
-
+
for (Precedence p : l)
p.res.addPrecedence(p.pred,p.succ);
-
- psengine_.setAutoPropagation(true);
+
+ psengine_.setAutoPropagation(true);
}
-
+
void removePrecedences(List l)
{
psengine_.setAutoPropagation(false);
-
+
for (Precedence p : l)
p.res.removePrecedence(p.pred,p.succ);
-
- psengine_.setAutoPropagation(true);
+
+ psengine_.setAutoPropagation(true);
}
-
+
class OracleIterator
{
int setSize_;
@@ -338,7 +338,7 @@ class OracleIterator
List counter_;
int counterRow_;
int max_;
-
+
public OracleIterator(List source,int setSize)
{
setSize_ = setSize;
@@ -346,54 +346,54 @@ public OracleIterator(List source,int setSize)
counter_ = new Vector();
for (int i=0;i= 0;
+ return counterRow_ >= 0;
}
-
+
void incCounter()
{
int newValue = counter_.get(counterRow_)+1;
while ((newValue + (counter_.size()-counterRow_) > max_) && counterRow_>=0) {
counterRow_--;
if (counterRow_ >= 0)
- newValue = counter_.get(counterRow_)+1;
+ newValue = counter_.get(counterRow_)+1;
}
-
+
if (counterRow_ >=0) {
for (int i=0;(counterRow_+i) next()
{
List retval = new Vector();
-
+
for (Integer i : counter_)
retval.add(source_.get(i));
-
+
incCounter();
//printExcluded(retval);
-
+
return retval;
}
-
+
void printExcluded(List retval)
{
StringBuffer buf = new StringBuffer();
buf.append("Excluded:");
for (Precedence p: retval)
buf.append(p.toString()).append(",");
- RCPSPUtil.dbgout(buf.toString());
+ RCPSPUtil.dbgout(buf.toString());
}
}
-
+
}
diff --git a/examples/UBO/java/UBO/UBOSolverListener.java b/examples/UBO/java/UBO/UBOSolverListener.java
index 40f0d1233..9c505dde7 100644
--- a/examples/UBO/java/UBO/UBOSolverListener.java
+++ b/examples/UBO/java/UBO/UBOSolverListener.java
@@ -16,7 +16,7 @@ public class UBOSolverListener
Vector planHistory_;
Vector treeSize_;
Vector currentTree_;
-
+
public UBOSolverListener()
{
lastDepth_ = 0;
@@ -26,16 +26,16 @@ public UBOSolverListener()
treeSize_ = new Vector();
currentTree_ = new Vector();
}
-
+
PSEngine getPSEngine()
{
- return PSDesktop.getInstance().getPSEngine();
+ return PSDesktop.getInstance().getPSEngine();
// return PSDesktop.desktop.getPSEngine();
}
-
+
public Vector getDecisionHistory() { return decisionHistory_; }
public Vector getPlanHistory() { return planHistory_; }
-
+
protected PlanHistoryEntry makePlanHistoryEntry(PSSolver s)
{
// Compute remaining nodes to explore
@@ -43,25 +43,25 @@ protected PlanHistoryEntry makePlanHistoryEntry(PSSolver s)
for (Integer i : treeSize_) {
if (i != null)
size *= i;
- }
-
+ }
+
PlanHistoryEntry entry = new PlanHistoryEntry(s.getStepCount(),size,currentTree_.toString(),plan_.toString());
return entry;
}
-
+
protected void decreasePlanSize(int delta)
{
int newSize = Math.max(0,plan_.size()-delta);
-
+
plan_.setSize(newSize);
treeSize_.setSize(newSize);
currentTree_.setSize(newSize);
}
-
+
public void stepCompleted(PSSolver s)
{
- String lastDecision = s.getLastExecutedDecision();
+ String lastDecision = s.getLastExecutedDecision();
if (lastDecision.startsWith("INSTANT") && (lastDepth_ <= s.getDepth())) {
Pattern p = Pattern.compile("token=[0-9]+");
Matcher m = p.matcher(lastDecision);
@@ -70,7 +70,7 @@ public void stepCompleted(PSSolver s)
m.find();
Integer succId = new Integer(lastDecision.substring(m.start()+6,m.end()));
String tokenDecision = " tokens:{" + predId + "} < {" + succId +"}";
-
+
PSObject resource = getPSEngine().getTokenByKey(predId).getOwner();
PSToken pred = getPSEngine().getTokenByKey(predId).getMaster();
PSToken succ = getPSEngine().getTokenByKey(succId).getMaster();
@@ -91,29 +91,29 @@ public void stepCompleted(PSSolver s)
String decision = decisionBuf.toString();
String decisionMsg = s.getStepCount() + ": "+ decision + " because of " + resource.getEntityName() + tokenDecision;
decisionHistory_.add(decisionMsg);
- //System.out.println(decisionMsg);
+ //System.out.println(decisionMsg);
plan_.add(decision);
treeSize_.add((remaining > 0) ? remaining : new Integer(1));
currentTree_.add("("+choiceIdx+","+choiceCnt+")");
PlanHistoryEntry entry = makePlanHistoryEntry(s);
- planHistory_.add(entry);
- //System.out.println(entry);
- }
-
+ planHistory_.add(entry);
+ //System.out.println(entry);
+ }
+
if (lastDepth_ >= s.getDepth()) {
String btMsg = s.getStepCount() + ": Backtracked! from "+plan_.size()+" to "+s.getDepth();
decisionHistory_.add(btMsg);
- //System.out.println(btMsg);
+ //System.out.println(btMsg);
decreasePlanSize(lastDepth_ - s.getDepth());
PlanHistoryEntry entry = makePlanHistoryEntry(s);
- planHistory_.add(entry);
- //System.out.println(entry);
+ planHistory_.add(entry);
+ //System.out.println(entry);
}
- lastDepth_ = s.getDepth();
+ lastDepth_ = s.getDepth();
//System.out.println(s.getStepCount()+" set last depth to:"+lastDepth_);
}
-}
+}
diff --git a/src/Java/CMakeLists.txt b/src/Java/CMakeLists.txt
index 725a14d04..411fcbbb5 100644
--- a/src/Java/CMakeLists.txt
+++ b/src/Java/CMakeLists.txt
@@ -1 +1,2 @@
-add_subdirectory(PSEngine)
\ No newline at end of file
+add_subdirectory(PSEngine)
+add_subdirectory(JavaUI)
\ No newline at end of file
diff --git a/src/Java/JavaUI/CMakeLists.txt b/src/Java/JavaUI/CMakeLists.txt
new file mode 100644
index 000000000..52f8f6ee0
--- /dev/null
+++ b/src/Java/JavaUI/CMakeLists.txt
@@ -0,0 +1,137 @@
+find_package(Java REQUIRED)
+include(UseJava RESULT_VARIABLE java_included)
+if(NOT java_included)
+ message(FATAL_ERROR "Failed to include UseJava")
+endif(NOT java_included)
+
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp)
+
+set(jarclasses "")
+set(libjars lib/bsh-2.0b4.jar
+ lib/jcommon-1.0.16.jar
+ lib/jfreechart-1.0.13.jar
+ lib/egantt/egantt-core.jar
+ lib/egantt/egantt-ext.jar
+ lib/egantt/egantt-resources.jar)
+
+foreach(jar ${libjars})
+ set(classes "")
+ get_filename_component(jarname ${jar} NAME)
+ unjar(${jarname}_unjarred ${CMAKE_CURRENT_SOURCE_DIR}/${jar} temp contents)
+ # message(STATUS ${classes})
+ list(APPEND jarcontents ${contents})
+ set(CMAKE_JAVA_INCLUDE_PATH "${CMAKE_JAVA_INCLUDE_PATH}:${jar}")
+endforeach(jar)
+ set(CMAKE_JAVA_INCLUDE_PATH "${CMAKE_JAVA_INCLUDE_PATH}:lib/PSEngine.jar")
+add_jar(PSUISwing
+ # INCLUDE_JARS
+ # ${libjars}
+ # ${CMAKE_CURRENT_BINARY_DIR}/../PSEngine/PSEngine.jar
+ SOURCES
+ #${jarclasses}
+ source/org/ops/ui/beanshell/swing/BeanShellView.java
+ source/org/ops/ui/editor/model/OutlineNode.java
+ source/org/ops/ui/editor/model/OutlineNodeType.java
+ source/org/ops/ui/editor/swing/anml/AnmlInterpreter.java
+ source/org/ops/ui/editor/swing/anml/AnmlTokenMarker.java
+ source/org/ops/ui/editor/swing/ash/AshConsole.java
+ source/org/ops/ui/editor/swing/ash/AshInterpreter.java
+ source/org/ops/ui/editor/swing/ash/AshTokenMarker.java
+ source/org/ops/ui/editor/swing/ash/ConsoleDefaults.java
+ source/org/ops/ui/editor/swing/ash/ConsolePainter.java
+ source/org/ops/ui/editor/swing/ash/DefaultInputHandler.java
+ source/org/ops/ui/editor/swing/ash/DocumentOutputStream.java
+ source/org/ops/ui/editor/swing/ash/DocumentWriter.java
+ source/org/ops/ui/editor/swing/ash/InputHandler.java
+ source/org/ops/ui/editor/swing/ash/KeywordMap.java
+ source/org/ops/ui/editor/swing/ash/SyntaxDocument.java
+ source/org/ops/ui/editor/swing/ash/SyntaxStyle.java
+ source/org/ops/ui/editor/swing/ash/SyntaxUtilities.java
+ source/org/ops/ui/editor/swing/ash/TextUtilities.java
+ source/org/ops/ui/editor/swing/ash/Token.java
+ source/org/ops/ui/editor/swing/ash/TokenMarker.java
+ source/org/ops/ui/editor/swing/nddl/NddlAshInterpreter.java
+ source/org/ops/ui/editor/swing/nddl/NddlTokenMarker.java
+ source/org/ops/ui/filemanager/model/AstNode.java
+ source/org/ops/ui/filemanager/model/AstNodeTypes.java
+ source/org/ops/ui/filemanager/model/ErrorRecord.java
+ source/org/ops/ui/filemanager/model/FileModel.java
+ source/org/ops/ui/gantt/model/EuropaGanttActivity.java
+ source/org/ops/ui/gantt/model/EuropaGanttModel.java
+ source/org/ops/ui/gantt/model/EuropaGanttResource.java
+ source/org/ops/ui/gantt/model/IGanttActivity.java
+ source/org/ops/ui/gantt/model/IGanttModel.java
+ source/org/ops/ui/gantt/model/IGanttResource.java
+ source/org/ops/ui/gantt/model/PSGanttActivity.java
+ source/org/ops/ui/gantt/model/PSGanttActivityImpl.java
+ source/org/ops/ui/gantt/model/PSGanttModel.java
+ source/org/ops/ui/gantt/model/PSGanttPSEModel.java
+ source/org/ops/ui/gantt/swing/GanttView.java
+ source/org/ops/ui/gantt/swing/LinePanel.java
+ source/org/ops/ui/gantt/swing/PSEGantt.java
+ source/org/ops/ui/gantt/swing/PSGantt.java
+ source/org/ops/ui/gantt/swing/PSGanttColorProvider.java
+ source/org/ops/ui/gantt/swing/ResourcePanel.java
+ source/org/ops/ui/gantt/swing/TimelinePanel.java
+ source/org/ops/ui/gantt/swing/TokenColor.java
+ source/org/ops/ui/gantt/swing/TokenWidget.java
+ source/org/ops/ui/main/swing/EuropaInternalFrame.java
+ source/org/ops/ui/main/swing/FileNameExtensionFilter.java
+ source/org/ops/ui/main/swing/PSComponent.java
+ source/org/ops/ui/main/swing/PSComponentBase.java
+ source/org/ops/ui/main/swing/PSDesktop.java
+ source/org/ops/ui/main/swing/PSMouseListener.java
+ source/org/ops/ui/mouse/swing/ActionDetailsPanel.java
+ source/org/ops/ui/mouse/swing/ActionViolationsPanel.java
+ source/org/ops/ui/mouse/swing/MouseListenerPanel.java
+ source/org/ops/ui/rchart/model/PSResourceChartModel.java
+ source/org/ops/ui/rchart/model/PSResourceChartPSEModel.java
+ source/org/ops/ui/rchart/swing/PSJFreeResourceChart.java
+ source/org/ops/ui/rchart/swing/PSResourceChart.java
+ source/org/ops/ui/schemabrowser/model/SchemaModel.java
+ source/org/ops/ui/schemabrowser/model/SchemaModelImpl.java
+ source/org/ops/ui/schemabrowser/model/SchemaNode.java
+ source/org/ops/ui/schemabrowser/model/SchemaSolverModel.java
+ source/org/ops/ui/schemabrowser/swing/SchemaNodeCellRenderer.java
+ source/org/ops/ui/schemabrowser/swing/SchemaTreeModel.java
+ source/org/ops/ui/schemabrowser/swing/SchemaView.java
+ source/org/ops/ui/solver/model/SolverAdapter.java
+ source/org/ops/ui/solver/model/SolverListener.java
+ source/org/ops/ui/solver/model/SolverModel.java
+ source/org/ops/ui/solver/model/StepStatisticsRecord.java
+ source/org/ops/ui/solver/model/TimeFormatHelper.java
+ source/org/ops/ui/solver/swing/ConsoleView.java
+ source/org/ops/ui/solver/swing/OpenDecisionsPanel.java
+ source/org/ops/ui/solver/swing/OpenDecisionsView.java
+ source/org/ops/ui/solver/swing/PSSolverDialog.java
+ source/org/ops/ui/solver/swing/PSSolverDialogListener.java
+ source/org/ops/ui/solver/swing/PSSolverView.java
+ source/org/ops/ui/solver/swing/SolverChartPanel.java
+ source/org/ops/ui/utils/swing/Util.java
+ source/org/ops/ui/utils/Utilities.java
+ MANIFEST
+ ${CMAKE_CURRENT_SOURCE_DIR}/META-INF/MANIFEST.SWING
+ )
+foreach(f ${libjars})
+ get_filename_component(jarname ${f} NAME)
+ add_dependencies(PSUISwing ${jarname}_unjarred)
+endforeach(f)
+# foreach(f ${jarclasses})
+# add_dependencies(PSUISwing ${CMAKE_CURRENT_BINARY_DIR}/temp/${f})
+# endforeach(f)
+# add_dependencies(PSUISwing ${jarclasses})
+
+file(REMOVE PSEngineAdditionalClasses)
+foreach(f ${jarcontents})
+ file(APPEND PSEngineAdditionalClasses "${f}\n")
+endforeach(f)
+
+add_custom_command(TARGET PSUISwing
+ POST_BUILD #?
+ COMMAND
+ ${Java_JAR_EXECUTABLE} -uf PSUISwing.jar -C ${CMAKE_CURRENT_BINARY_DIR}/temp .
+ #WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp
+)
+
+
+install_jar(PSUISwing ${EUROPA_ROOT}/dist/europa)
\ No newline at end of file
diff --git a/src/Java/JavaUI/source/org/ops/ui/beanshell/swing/BeanShellView.java b/src/Java/JavaUI/source/org/ops/ui/beanshell/swing/BeanShellView.java
index 4ef51f4f9..29daa8c6c 100644
--- a/src/Java/JavaUI/source/org/ops/ui/beanshell/swing/BeanShellView.java
+++ b/src/Java/JavaUI/source/org/ops/ui/beanshell/swing/BeanShellView.java
@@ -23,8 +23,8 @@ public BeanShellView(SolverModel solverModel, PSDesktop psDesktop) {
console = new JConsole();
this.setContentPane(console);
- this.interpreter = new Interpreter(console);
-
+ this.interpreter = new Interpreter(console);
+
// Register variables
try {
interpreter.set("desktop", psDesktop);
diff --git a/src/Java/JavaUI/source/org/ops/ui/editor/model/OutlineNode.java b/src/Java/JavaUI/source/org/ops/ui/editor/model/OutlineNode.java
index 8fadaa229..7e675d32e 100644
--- a/src/Java/JavaUI/source/org/ops/ui/editor/model/OutlineNode.java
+++ b/src/Java/JavaUI/source/org/ops/ui/editor/model/OutlineNode.java
@@ -8,7 +8,7 @@
/**
* Outline node. Outline tree is computed from AST tree. This class also
* contains a bunch of static methods for the actual AST to Outline conversion.
- *
+ *
* @author Tatiana Kichkaylo
*/
public class OutlineNode {
diff --git a/src/Java/JavaUI/source/org/ops/ui/editor/swing/ash/AshConsole.java b/src/Java/JavaUI/source/org/ops/ui/editor/swing/ash/AshConsole.java
index 573f49d9c..4eb1fde87 100644
--- a/src/Java/JavaUI/source/org/ops/ui/editor/swing/ash/AshConsole.java
+++ b/src/Java/JavaUI/source/org/ops/ui/editor/swing/ash/AshConsole.java
@@ -1636,7 +1636,7 @@ public Dimension minimumLayoutSize(Container parent) {
dim.height = insets.top + insets.bottom;
Dimension centerPref = center.getMinimumSize();
- dim.width += centerPref.width;
+ dim.width += centerPref.width;
dim.height += centerPref.height;
Dimension rightPref = right.getMinimumSize();
dim.width += rightPref.width;
@@ -1750,7 +1750,7 @@ public void insertUpdate(DocumentEvent evt) {
int newStart;
int newEnd;
- if(selectionStart > offset || (selectionStart
+ if(selectionStart > offset || (selectionStart
== selectionEnd && selectionStart == offset))
newStart = selectionStart + length;
else
@@ -1885,7 +1885,7 @@ public void mousePressed(MouseEvent evt) {
}
}
- private void doSingleClick(MouseEvent evt, int line,
+ private void doSingleClick(MouseEvent evt, int line,
int offset, int dot) {
if((evt.getModifiers() & InputEvent.SHIFT_MASK) != 0) {
rectSelect = (evt.getModifiers() & InputEvent.CTRL_MASK) != 0;
diff --git a/src/Java/JavaUI/source/org/ops/ui/editor/swing/ash/ConsolePainter.java b/src/Java/JavaUI/source/org/ops/ui/editor/swing/ash/ConsolePainter.java
index 06c3cd36e..6e3e0b058 100644
--- a/src/Java/JavaUI/source/org/ops/ui/editor/swing/ash/ConsolePainter.java
+++ b/src/Java/JavaUI/source/org/ops/ui/editor/swing/ash/ConsolePainter.java
@@ -568,7 +568,7 @@ protected void paintBracketHighlight(Graphics gfx, int line, int y) {
protected void paintCaret(Graphics gfx, int line, int y) {
if(console.isCaretVisible()) {
- int offset = console.getCaretPosition()
+ int offset = console.getCaretPosition()
- console.getLineStartOffset(line);
int caretX = console._offsetToX(line,offset);
int caretWidth = ((blockCaret || console.isOverwriteEnabled()) ? fm.charWidth('w') : 1);
diff --git a/src/Java/JavaUI/source/org/ops/ui/editor/swing/ash/Token.java b/src/Java/JavaUI/source/org/ops/ui/editor/swing/ash/Token.java
index 9863f9020..827fbc09b 100644
--- a/src/Java/JavaUI/source/org/ops/ui/editor/swing/ash/Token.java
+++ b/src/Java/JavaUI/source/org/ops/ui/editor/swing/ash/Token.java
@@ -51,7 +51,7 @@ public class Token {
/**
* Literal 3 token id. This can be used to mark a numeric
- * literal
+ * literal
*/
public static final byte LITERAL3 = 5;
diff --git a/src/Java/JavaUI/source/org/ops/ui/editor/swing/ash/TokenMarker.java b/src/Java/JavaUI/source/org/ops/ui/editor/swing/ash/TokenMarker.java
index dc84509e7..2351f44b3 100644
--- a/src/Java/JavaUI/source/org/ops/ui/editor/swing/ash/TokenMarker.java
+++ b/src/Java/JavaUI/source/org/ops/ui/editor/swing/ash/TokenMarker.java
@@ -109,7 +109,7 @@ public Token markTokens(Segment line, int lineIndex) {
* add syntax tokens to the token list. Then, it should return
* the initial token type for the next line.
*
- * For example if the current line contains the start of a
+ * For example if the current line contains the start of a
* multiline comment that doesn't end on that line, this method
* should return the comment token type so that it continues on
* the next line.
@@ -141,7 +141,7 @@ public boolean supportsMultilineTokens() {
* the document. This inserts a gap in the lineInfo
* array.
* @param index The first line number
- * @param lines The number of lines
+ * @param lines The number of lines
*/
public void insertLines(int index, int lines) {
if(lines <= 0)
diff --git a/src/Java/JavaUI/source/org/ops/ui/editor/swing/nddl/NddlAshInterpreter.java b/src/Java/JavaUI/source/org/ops/ui/editor/swing/nddl/NddlAshInterpreter.java
index 28fc5b13d..fd7bc95ee 100644
--- a/src/Java/JavaUI/source/org/ops/ui/editor/swing/nddl/NddlAshInterpreter.java
+++ b/src/Java/JavaUI/source/org/ops/ui/editor/swing/nddl/NddlAshInterpreter.java
@@ -10,31 +10,31 @@
//import psengine.NddlInterpreter;
import psengine.PSEngine;
-public class NddlAshInterpreter extends AshInterpreter
+public class NddlAshInterpreter extends AshInterpreter
{
PrintStream consoleErr_ = System.err;
//NddlInterpreter interpreter_ = null;
- public NddlAshInterpreter(PSEngine pse)
+ public NddlAshInterpreter(PSEngine pse)
{
super("Nddl");
//interpreter_ = pse.getNddlInterpreter();
}
- public void setConsole(AshConsole console)
+ public void setConsole(AshConsole console)
{
consoleErr_ = new PrintStream(new BufferedOutputStream(new DocumentOutputStream(console.getDocument(), "!!")), true);
//interpreter_.setErrorStream(consoleErr_);
}
- public void source(String filename)
+ public void source(String filename)
{
- //interpreter_.source(filename);
+ //interpreter_.source(filename);
}
- public boolean eval(String toEval)
+ public boolean eval(String toEval)
{
return false;
- //return interpreter_.eval(toEval);
+ //return interpreter_.eval(toEval);
}
}
diff --git a/src/Java/JavaUI/source/org/ops/ui/editor/swt/NddlEditor.java b/src/Java/JavaUI/source/org/ops/ui/editor/swt/NddlEditor.java
index 62bb1db46..254d1373b 100755
--- a/src/Java/JavaUI/source/org/ops/ui/editor/swt/NddlEditor.java
+++ b/src/Java/JavaUI/source/org/ops/ui/editor/swt/NddlEditor.java
@@ -9,7 +9,7 @@
/**
* NDDL editor with syntax highlighting.
- *
+ *
* @author Tatiana
*/
public class NddlEditor extends TextEditor {
@@ -29,7 +29,7 @@ public NddlEditor() {
/**
* Create the part control.
- *
+ *
* @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
*/
@Override
@@ -45,7 +45,7 @@ public void dispose() {
/**
* Used by platform to get the OutlinePage and ProjectionSupport adapter.
- *
+ *
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
@SuppressWarnings("unchecked")
@@ -60,7 +60,7 @@ public Object getAdapter(Class required) {
}
return super.getAdapter(required);
}
-
+
public NddlContentProvider getNddlContentProvider() {
return provider;
}
diff --git a/src/Java/JavaUI/source/org/ops/ui/editor/swt/NddlScanner.java b/src/Java/JavaUI/source/org/ops/ui/editor/swt/NddlScanner.java
index 5a196f1c3..8f20a0129 100755
--- a/src/Java/JavaUI/source/org/ops/ui/editor/swt/NddlScanner.java
+++ b/src/Java/JavaUI/source/org/ops/ui/editor/swt/NddlScanner.java
@@ -95,7 +95,7 @@ private static final class CharacterRule implements IRule {
/**
* Creates a new operator rule.
- *
+ *
* @param token
* Token to use for this rule
*/
diff --git a/src/Java/JavaUI/source/org/ops/ui/editor/swt/NddlToggleCommentHandler.java b/src/Java/JavaUI/source/org/ops/ui/editor/swt/NddlToggleCommentHandler.java
index 2a23fa627..8b6ea3652 100644
--- a/src/Java/JavaUI/source/org/ops/ui/editor/swt/NddlToggleCommentHandler.java
+++ b/src/Java/JavaUI/source/org/ops/ui/editor/swt/NddlToggleCommentHandler.java
@@ -16,7 +16,7 @@
/**
* Trigger comment // for the current selection of the currently active editor.
- *
+ *
* @author Tatiana, Tristan
*/
public class NddlToggleCommentHandler extends AbstractHandler {
diff --git a/src/Java/JavaUI/source/org/ops/ui/editor/swt/NonRuleBasedDamagerRepairer.java b/src/Java/JavaUI/source/org/ops/ui/editor/swt/NonRuleBasedDamagerRepairer.java
index 6b770e7b0..537aef1f5 100755
--- a/src/Java/JavaUI/source/org/ops/ui/editor/swt/NonRuleBasedDamagerRepairer.java
+++ b/src/Java/JavaUI/source/org/ops/ui/editor/swt/NonRuleBasedDamagerRepairer.java
@@ -19,7 +19,7 @@ public class NonRuleBasedDamagerRepairer implements IPresentationDamager,
/** The document this object works on */
protected IDocument fDocument;
-
+
/**
* The default text attribute if non is returned as data by the current
* token
@@ -43,7 +43,7 @@ public void setDocument(IDocument document) {
* Returns the end offset of the line that contains the specified offset or
* if the offset is inside a line delimiter, the end offset of the next
* line.
- *
+ *
* @param offset
* the offset whose line end offset must be computed
* @return the line end offset for the given offset
@@ -112,7 +112,7 @@ public void createPresentation(TextPresentation presentation,
/**
* Adds style information to the given text presentation.
- *
+ *
* @param presentation
* the text presentation to be extended
* @param offset
@@ -128,4 +128,4 @@ protected void addRange(TextPresentation presentation, int offset,
presentation.addStyleRange(new StyleRange(offset, length, attr
.getForeground(), attr.getBackground(), attr.getStyle()));
}
-}
\ No newline at end of file
+}
diff --git a/src/Java/JavaUI/source/org/ops/ui/filemanager/model/AstNode.java b/src/Java/JavaUI/source/org/ops/ui/filemanager/model/AstNode.java
index 4f13dbae4..a6b4f0544 100644
--- a/src/Java/JavaUI/source/org/ops/ui/filemanager/model/AstNode.java
+++ b/src/Java/JavaUI/source/org/ops/ui/filemanager/model/AstNode.java
@@ -5,7 +5,7 @@
/**
* Java version of Antlr3 AST node as passed through verbose string
- *
+ *
* @author Tatiana Kichkaylo
*/
public class AstNode {
@@ -27,7 +27,7 @@ public class AstNode {
/**
* Read from the string/offset. Expect to see
* "text":token-type:"file":line:offset-in-line or "text":token-type
- *
+ *
* @return offset past this node
*/
public int readNodeFrom(String astString, int offset) {
diff --git a/src/Java/JavaUI/source/org/ops/ui/filemanager/model/AstNodeTypes.java b/src/Java/JavaUI/source/org/ops/ui/filemanager/model/AstNodeTypes.java
index d23eb6b87..5c3fcd121 100644
--- a/src/Java/JavaUI/source/org/ops/ui/filemanager/model/AstNodeTypes.java
+++ b/src/Java/JavaUI/source/org/ops/ui/filemanager/model/AstNodeTypes.java
@@ -1,7 +1,7 @@
package org.ops.ui.filemanager.model;
/**
- * Type constants. The numbers in this file should match those in
+ * Type constants. The numbers in this file should match those in
* /Europa/src/PLASMA/NDDL/base/NDDL3.tokens
*/
public interface AstNodeTypes {
@@ -20,6 +20,6 @@ public interface AstNodeTypes {
public static final int FACT_KEYWORD = 59;
// instantiation of predicate
public static final int PREDICATE_INSTANCE = 9;
- public static final int CONSTRAINT_INSTANCE = 4;
+ public static final int CONSTRAINT_INSTANCE = 4;
public static final int ENUM_KEYWORD = 32;
}
diff --git a/src/Java/JavaUI/source/org/ops/ui/filemanager/model/ErrorRecord.java b/src/Java/JavaUI/source/org/ops/ui/filemanager/model/ErrorRecord.java
index 33ca651a9..12e09de29 100644
--- a/src/Java/JavaUI/source/org/ops/ui/filemanager/model/ErrorRecord.java
+++ b/src/Java/JavaUI/source/org/ops/ui/filemanager/model/ErrorRecord.java
@@ -3,7 +3,7 @@
/**
* Record for representing error messages accompanying AST. All fields are read
* only.
- *
+ *
* @author Tatiana Kichkaylo
*/
public class ErrorRecord {
diff --git a/src/Java/JavaUI/source/org/ops/ui/filemanager/model/FileModel.java b/src/Java/JavaUI/source/org/ops/ui/filemanager/model/FileModel.java
index 96716f1ee..b69fd806e 100644
--- a/src/Java/JavaUI/source/org/ops/ui/filemanager/model/FileModel.java
+++ b/src/Java/JavaUI/source/org/ops/ui/filemanager/model/FileModel.java
@@ -9,7 +9,7 @@
* File model gets AST from a file. To do so, it creates a brand new copy of
* engine, and deletes it when it is done. Loading of models into an engine for
* running is done in SolverModel.
- *
+ *
* @author Tatiana Kichkaylo
*/
public class FileModel {
diff --git a/src/Java/JavaUI/source/org/ops/ui/filemanager/model/unittesting/FileModelTest.java b/src/Java/JavaUI/source/org/ops/ui/filemanager/model/unittesting/FileModelTest.java
index 164abc59e..c1af1a7a0 100644
--- a/src/Java/JavaUI/source/org/ops/ui/filemanager/model/unittesting/FileModelTest.java
+++ b/src/Java/JavaUI/source/org/ops/ui/filemanager/model/unittesting/FileModelTest.java
@@ -19,10 +19,10 @@
* Often changes to the NDDL grammar cause these constants to shift, in which
* case AstNodeTypes.java needs to be updated. For now this update is manual,
* which is bad.
- *
+ *
* At the very least we need some unittests to verify that constants still
* match.
- *
+ *
* @author Tatiana Kichkaylo
*/
public class FileModelTest extends TestCase {
diff --git a/src/Java/JavaUI/source/org/ops/ui/gantt/model/EuropaGanttActivity.java b/src/Java/JavaUI/source/org/ops/ui/gantt/model/EuropaGanttActivity.java
index 86d276075..baf4dea94 100644
--- a/src/Java/JavaUI/source/org/ops/ui/gantt/model/EuropaGanttActivity.java
+++ b/src/Java/JavaUI/source/org/ops/ui/gantt/model/EuropaGanttActivity.java
@@ -37,7 +37,7 @@ public boolean hasViolation() {
/*
* (non-Javadoc)
- *
+ *
* @see org.ops.ui.gantt.model.IGanttActivity#getStartMin()
*/
@Override
@@ -47,7 +47,7 @@ public int getStartMin() {
/*
* (non-Javadoc)
- *
+ *
* @see org.ops.ui.gantt.model.IGanttActivity#getStartMax()
*/
@Override
@@ -57,7 +57,7 @@ public int getStartMax() {
/*
* (non-Javadoc)
- *
+ *
* @see org.ops.ui.gantt.model.IGanttActivity#getEndMin()
*/
@Override
@@ -67,7 +67,7 @@ public int getEndMin() {
/*
* (non-Javadoc)
- *
+ *
* @see org.ops.ui.gantt.model.IGanttActivity#getEndMax()
*/
@Override
@@ -77,7 +77,7 @@ public int getEndMax() {
/*
* (non-Javadoc)
- *
+ *
* @see org.ops.ui.gantt.model.IGanttActivity#getDurMin()
*/
@Override
@@ -87,7 +87,7 @@ public int getDurMin() {
/*
* (non-Javadoc)
- *
+ *
* @see org.ops.ui.gantt.model.IGanttActivity#getDurMax()
*/
@Override
@@ -101,7 +101,7 @@ public int getKey() {
/*
* (non-Javadoc)
- *
+ *
* @see org.ops.ui.gantt.model.IGanttActivity#getText()
*/
@Override
diff --git a/src/Java/JavaUI/source/org/ops/ui/gantt/model/EuropaGanttResource.java b/src/Java/JavaUI/source/org/ops/ui/gantt/model/EuropaGanttResource.java
index 4e43a1ccf..ab2b336e4 100644
--- a/src/Java/JavaUI/source/org/ops/ui/gantt/model/EuropaGanttResource.java
+++ b/src/Java/JavaUI/source/org/ops/ui/gantt/model/EuropaGanttResource.java
@@ -6,7 +6,7 @@
/**
* Implementation of IGanttResource around Europa PSResource
- *
+ *
* @author tatiana
*/
public class EuropaGanttResource implements IGanttResource {
@@ -52,7 +52,7 @@ public String toString() {
/*
* (non-Javadoc)
- *
+ *
* @see org.ops.ui.gantt.model.IGanttResource#getName()
*/
@Override
@@ -62,7 +62,7 @@ public String getName() {
/*
* (non-Javadoc)
- *
+ *
* @see org.ops.ui.gantt.model.IGanttResource#getActualMin()
*/
@Override
@@ -72,7 +72,7 @@ public double getActualMin() {
/*
* (non-Javadoc)
- *
+ *
* @see org.ops.ui.gantt.model.IGanttResource#getActualMax()
*/
@Override
@@ -82,7 +82,7 @@ public double getActualMax() {
/*
* (non-Javadoc)
- *
+ *
* @see org.ops.ui.gantt.model.IGanttResource#getLow(int)
*/
@Override
@@ -92,7 +92,7 @@ public double getLow(int time) {
/*
* (non-Javadoc)
- *
+ *
* @see org.ops.ui.gantt.model.IGanttResource#getHigh(int)
*/
@Override
diff --git a/src/Java/JavaUI/source/org/ops/ui/gantt/model/IGanttActivity.java b/src/Java/JavaUI/source/org/ops/ui/gantt/model/IGanttActivity.java
index 500dfd41f..b777811a6 100644
--- a/src/Java/JavaUI/source/org/ops/ui/gantt/model/IGanttActivity.java
+++ b/src/Java/JavaUI/source/org/ops/ui/gantt/model/IGanttActivity.java
@@ -2,7 +2,7 @@
/**
* Interface for the data structure representing an activity in Gantt chart
- *
+ *
* @author Tatiana
*/
public interface IGanttActivity {
@@ -32,4 +32,4 @@ public interface IGanttActivity {
* underlying data
*/
public Object getData();
-}
\ No newline at end of file
+}
diff --git a/src/Java/JavaUI/source/org/ops/ui/gantt/model/IGanttModel.java b/src/Java/JavaUI/source/org/ops/ui/gantt/model/IGanttModel.java
index 9daaa5178..78b376d89 100644
--- a/src/Java/JavaUI/source/org/ops/ui/gantt/model/IGanttModel.java
+++ b/src/Java/JavaUI/source/org/ops/ui/gantt/model/IGanttModel.java
@@ -3,11 +3,11 @@
import java.util.List;
/** Generic model providing access to activities and resource profiles.
- *
+ *
* @author Tatiana
*/
public interface IGanttModel {
-
+
public int getResourceCount();
public List getActivities(int resource);
@@ -20,4 +20,4 @@ public interface IGanttModel {
public String getResourceName(int index);
-}
\ No newline at end of file
+}
diff --git a/src/Java/JavaUI/source/org/ops/ui/gantt/model/IGanttResource.java b/src/Java/JavaUI/source/org/ops/ui/gantt/model/IGanttResource.java
index 231df30ee..51eeefcb9 100644
--- a/src/Java/JavaUI/source/org/ops/ui/gantt/model/IGanttResource.java
+++ b/src/Java/JavaUI/source/org/ops/ui/gantt/model/IGanttResource.java
@@ -2,7 +2,7 @@
/**
* Interface for a resource profile to be used with Gantt chart.
- *
+ *
* @author tatiana
*/
public interface IGanttResource {
@@ -21,4 +21,4 @@ public interface IGanttResource {
/** @return the upper bound value for the given time step */
public double getHigh(int time);
-}
\ No newline at end of file
+}
diff --git a/src/Java/JavaUI/source/org/ops/ui/gantt/model/PSGanttActivity.java b/src/Java/JavaUI/source/org/ops/ui/gantt/model/PSGanttActivity.java
index cdd8afeb2..9ba85a8e3 100644
--- a/src/Java/JavaUI/source/org/ops/ui/gantt/model/PSGanttActivity.java
+++ b/src/Java/JavaUI/source/org/ops/ui/gantt/model/PSGanttActivity.java
@@ -2,7 +2,7 @@
import java.util.Calendar;
-public interface PSGanttActivity
+public interface PSGanttActivity
{
public Object getKey();
public Calendar getStart();
diff --git a/src/Java/JavaUI/source/org/ops/ui/gantt/model/PSGanttActivityImpl.java b/src/Java/JavaUI/source/org/ops/ui/gantt/model/PSGanttActivityImpl.java
index 14f4a55cd..a7dbdacb4 100644
--- a/src/Java/JavaUI/source/org/ops/ui/gantt/model/PSGanttActivityImpl.java
+++ b/src/Java/JavaUI/source/org/ops/ui/gantt/model/PSGanttActivityImpl.java
@@ -2,16 +2,16 @@
import java.util.Calendar;
-public class PSGanttActivityImpl
- implements PSGanttActivity
+public class PSGanttActivityImpl
+ implements PSGanttActivity
{
protected Object key_;
protected Calendar start_;
protected Calendar finish_;
protected double violation_;
-
- public PSGanttActivityImpl(Object key,
- Calendar start,
+
+ public PSGanttActivityImpl(Object key,
+ Calendar start,
Calendar finish,
double violation)
{
@@ -24,5 +24,5 @@ public PSGanttActivityImpl(Object key,
public Calendar getFinish() { return finish_; }
public Object getKey() { return key_; }
public Calendar getStart() { return start_; }
- public double getViolation() { return violation_; }
+ public double getViolation() { return violation_; }
}
diff --git a/src/Java/JavaUI/source/org/ops/ui/gantt/model/PSGanttModel.java b/src/Java/JavaUI/source/org/ops/ui/gantt/model/PSGanttModel.java
index d39f430d8..585bd9342 100644
--- a/src/Java/JavaUI/source/org/ops/ui/gantt/model/PSGanttModel.java
+++ b/src/Java/JavaUI/source/org/ops/ui/gantt/model/PSGanttModel.java
@@ -3,13 +3,13 @@
import java.util.Calendar;
import java.util.Iterator;
-public interface PSGanttModel
+public interface PSGanttModel
{
public String[] getResourceColumnNames();
public String getResourceColumn(int resource, int column);
-
+
public int getResourceCount();
public Iterator getActivities(int resource);
public void setActivityStart(Object key, Calendar start);
- public void setActivityFinish(Object key, Calendar finish);
+ public void setActivityFinish(Object key, Calendar finish);
}
diff --git a/src/Java/JavaUI/source/org/ops/ui/gantt/model/PSGanttPSEModel.java b/src/Java/JavaUI/source/org/ops/ui/gantt/model/PSGanttPSEModel.java
index 1b6637f26..aea997b81 100644
--- a/src/Java/JavaUI/source/org/ops/ui/gantt/model/PSGanttPSEModel.java
+++ b/src/Java/JavaUI/source/org/ops/ui/gantt/model/PSGanttPSEModel.java
@@ -15,39 +15,39 @@
import psengine.PSTokenList;
import psengine.PSObjectList;
-public class PSGanttPSEModel
- implements PSGanttModel
+public class PSGanttPSEModel
+ implements PSGanttModel
{
Calendar startHorizon_;
String objectsType_;
PSObjectList resources_;
int timeUnit_;
-
+
public PSGanttPSEModel(PSEngine pse, Calendar startHorizon, String objectsType)
{
- this(pse,startHorizon,objectsType,Calendar.MINUTE);
+ this(pse,startHorizon,objectsType,Calendar.MINUTE);
}
-
+
public PSGanttPSEModel(PSEngine pse, Calendar startHorizon, String objectsType, int timeUnit)
{
startHorizon_ = startHorizon;
objectsType_ = objectsType;
resources_ = pse.getObjectsByType(objectsType_);
timeUnit_=timeUnit;
-
+
}
- public Iterator getActivities(int resource)
+ public Iterator getActivities(int resource)
{
assert (resource >=0 && resource < getResourceCount());
-
+
// TODO: cache activities?
List acts = new ArrayList();
-
+
PSTokenList tokens = resources_.get(resource).getTokens();
for (int i=0;i getActivities(int resource)
{
start = 0;
}
-
+
acts.add(new PSGanttActivityImpl(token.getEntityKey(),
instantToCalendar(start),
instantToCalendar(end),
@@ -64,10 +64,10 @@ public Iterator getActivities(int resource)
)
);
}
-
+
return acts.iterator();
}
-
+
protected Calendar instantToCalendar(double i)
{
Calendar retval = (Calendar)startHorizon_.clone();
@@ -76,32 +76,32 @@ protected Calendar instantToCalendar(double i)
return retval;
}
- public String getResourceColumn(int resource, int column)
+ public String getResourceColumn(int resource, int column)
{
if (column == 0 && resource < getResourceCount())
return resources_.get(resource).getEntityName();
-
+
return "";
}
static String resourceColumnNames_[] = { "Name" };
- public String[] getResourceColumnNames()
+ public String[] getResourceColumnNames()
{
return resourceColumnNames_;
}
- public int getResourceCount()
+ public int getResourceCount()
{
return resources_.size();
}
- public void setActivityStart(Object key, Calendar start)
+ public void setActivityStart(Object key, Calendar start)
{
// TODO Auto-generated method stub
notifyChange(key,"StartChanged",start);
}
- public void setActivityFinish(Object key, Calendar finish)
+ public void setActivityFinish(Object key, Calendar finish)
{
// TODO Auto-generated method stub
notifyChange(key,"FinishChanged",finish);
@@ -111,16 +111,16 @@ public void setActivityFinish(Object key, Calendar finish)
protected void notifyChange(Object key, String type, Object value)
{
Object newValue=value;
-
+
if (value instanceof Calendar) {
SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss", new Locale("en","US"));
newValue = formatter.format(((Calendar)value).getTime());
}
-
+
System.out.println(++notificationCnt_ + " - Object changed - {"+
"id:"+key+" "+
"type:"+type+" "+
"newValue:"+newValue+ "}"
- );
+ );
}
}
diff --git a/src/Java/JavaUI/source/org/ops/ui/gantt/swing/GanttView.java b/src/Java/JavaUI/source/org/ops/ui/gantt/swing/GanttView.java
index 1e8f62944..64104d321 100644
--- a/src/Java/JavaUI/source/org/ops/ui/gantt/swing/GanttView.java
+++ b/src/Java/JavaUI/source/org/ops/ui/gantt/swing/GanttView.java
@@ -50,7 +50,7 @@ public class GanttView extends EuropaInternalFrame {
/** Make this thing configurable? Issue 117 */
private boolean skipEmptyObjects = false;
-
+
/** Odd and even background colors */
protected static final Color oddBg = new Color(250, 255, 250),
evenBg = new Color(250, 250, 150), boldGrid = Color.gray,
@@ -133,7 +133,7 @@ protected void updateView() {
LinePanel line;
if (r != null) {
// Can resource timeline also have tokens?
- line = new ResourcePanel(r);
+ line = new ResourcePanel(r);
// . TODO
} else {
TimelinePanel tline = new TimelinePanel(model.getResourceName(i));
@@ -154,7 +154,7 @@ protected void updateView() {
tokenPanel.add(line);
labelPanel.add(line.getLabel());
}
-
+
Point p = new Point(0,0);
timeHeader.setViewPosition(p);
labelVPort.setViewPosition(p);
diff --git a/src/Java/JavaUI/source/org/ops/ui/gantt/swing/LinePanel.java b/src/Java/JavaUI/source/org/ops/ui/gantt/swing/LinePanel.java
index 37030d41e..95c77828a 100644
--- a/src/Java/JavaUI/source/org/ops/ui/gantt/swing/LinePanel.java
+++ b/src/Java/JavaUI/source/org/ops/ui/gantt/swing/LinePanel.java
@@ -7,7 +7,7 @@
/**
* Parent class for TimelinePanel and ResourcePanel.
- *
+ *
* @author Tatiana Kichkaylo
*/
public abstract class LinePanel extends JPanel {
diff --git a/src/Java/JavaUI/source/org/ops/ui/gantt/swing/PSEGantt.java b/src/Java/JavaUI/source/org/ops/ui/gantt/swing/PSEGantt.java
index e26841a1c..367f06632 100644
--- a/src/Java/JavaUI/source/org/ops/ui/gantt/swing/PSEGantt.java
+++ b/src/Java/JavaUI/source/org/ops/ui/gantt/swing/PSEGantt.java
@@ -50,43 +50,43 @@
/*
* PSGantt implementation that uses egantt
*/
-public class PSEGantt
+public class PSEGantt
extends PSGantt
implements MouseMotionListener, DrawingPartListener
{
/**
- *
+ *
*/
private static final long serialVersionUID = -7727371579397987014L;
-
+
GanttTable gantt_;
Map