A DSL for GRACeFUL components.
Directory | Contents |
---|---|
doc/ | Various documentation. |
docker_dist/ | Scripts for creating a Docker image. |
examples/ | Example programs written in GRACe. |
src/ | Haskell source code for the GRACe library. |
test/ | Test suite. |
We provide a platform-independent Docker image containing an executable
for the OilCrops
example, written in GRACe.
Running the example requires the Docker Community Edition (CE) to be installed. Docker CE, as well as installation instructions are available at the docker website. Once Docker CE is installed, the example can be executed using the Docker application as follows:
Open a terminal (the command prompt for Windows users) and execute the commands
docker pull eugraceful/grace-examples:latest
docker run --rm eugraceful/grace-examples:latest
This will run the OilCrops
example and write the problem solution to
standard output.
This example contains a small optimization problem in which the objective is to dedicate a set amount of farmland area to three different crops, with the goal of maximizing the yield of vegetable oil produced from these crops. A description of the example can be found in the tutorial and the source code is here.
Development of GRACe
programs requires the following software dependencies
to be met:
The recommended way of installing GHC and other Haskell libraries/tools are through stack. stack handles the entire Haskell toolchain (including the compiler GHC), library dependencies, building and executing. Instructions for installing stack on macOS, Linux and Windows can be found here.
The recommended way of installing the required MiniZinc solver tools is through the bundled binary packages available here.
First, clone the GRACe repository:
git clone https://github.com/GRACeFUL-project/GRACe grace
GRACe comes with a few examples that can be built using
stack build
stack exec SomeExamples
stack will automatically take care of dependencies. Optionally, a small test suite is available. Run the tests by executing
stack test
This assumes MiniZinc is in your path. If it is not you can add the correct directory to the environment - for example
env MZN_STDLIB_DIR=/home/patrikj/Downloads/MiniZincIDE-2.1.0-bundle-linux-x86_64/share/minizinc \
stack test
The examples folder contains several examples of GRACe programs. In addition to these, we provide a short tutorial on how to write GRACe programs here.