Skip to content
/ jclingo Public

Java Bindings for Clingo: A grounder and solver for logic programs

License

Notifications You must be signed in to change notification settings

kherud/jclingo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java Version 11+ Clingo Version 5.7.1

Java Bindings for Clingo: A grounder and solver for logic programs

Clingo is part of the Potassco project for Answer Set Programming (ASP). ASP offers a simple and powerful modeling language to describe combinatorial problems as logic programs. The clingo system then takes such a logic program and computes answer sets representing solutions to the given problem. To get an idea, check the Getting Started page and the online version of clingo.

Please consult the following resources for further information:

Usage

This library is available via Maven:

<dependency>
    <groupId>org.potassco</groupId>
    <artifactId>clingo</artifactId>
    <version>1.1.0</version>
</dependency>

Please have a look at the demonstrations, for example:

public class Main {
    public static void main(String... args) {
        Control control = new Control("0");

        // add a logic program to the base part
        control.add("a :- not b. b :- not a.");

        // ground the base part
        control.ground();

        try (SolveHandle handle = control.solve(SolveMode.YIELD)) {
            while (handle.hasNext()) {
                // get the next model
                Model model = handle.next();
                System.out.println(model);
            }
        }

        control.close();
    }
}

No Setup Required

This repository provides out of the box support for the following platforms:

  • Linux: x86_64, arm64 (glibc)
  • MacOS: x86_64, arm64 (m1)
  • Windows: x86, x86_64, arm, arm64

Setup Required

If your system is not in the previous list, either

  • Feel free to create an issue with details about your OS and CPU.
  • Compile clingo yourself (see this) and appropriately set the JVM argument jna.library.path, e.g. java -Djna.library.path=/path/to/library.

This also applies if you get any errors of the kind:

Exception in thread "main" java.lang.UnsatisfiedLinkError: ...

About

Java Bindings for Clingo: A grounder and solver for logic programs

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages