GithubHelp home page GithubHelp logo

sma-fga / dcop-adopt Goto Github PK

View Code? Open in Web Editor NEW
8.0 5.0 2.0 2.58 MB

An implementation of the algorithm ADOPT to solve Distributed Constraints Optimization Problems(DCOPs) using the JADE framework

License: GNU Affero General Public License v3.0

Java 99.83% Dockerfile 0.17%
dcop adopt-algorithm adopt jade jade-tilab

dcop-adopt's Introduction

dcop-adopt

An implementation of the algorithm ADOPT[1] to solve Distributed Constraints Optimization Problems(DCOPs) using the JADE framework.

how to exec

with docker

clone this repository:

git clone https://github.com/SMA-FGA/dcop-adopt.git

go to repository path:

cd my/path/dcop-adopt

pull docker image:

sudo docker pull jefersonalves/dcop

run a docker container:

sudo docker run --name dcop -it -v $PWD:/dcop -p 1099:1099 jefersonalves/dcop bash

compile the code:

mvn compile

execute a dcop simulation based on the a.json configuration file:

mvn exec:java -D exec.mainClass="jade.Boot" -D exec.args="-agents instantiator:agents.instantiator.InstantiatorAgent(./dcop-json-files/a.json)"

run tests

run all tests:

mvn test

run a single test:

mvn test -D test=GraphTest#IsNodeSizeCorrect_SholdReturnNumberOfNodesInTheGraph test

license

references

  1. Modi, P., Shen, W.-M., Tambe, M., & Yokoo, M. (2005). ADOPT: Asynchronous distributed constraint optimization with quality guarantees. Artificial Intelligence, 161(1โ€“2), 149โ€“180.

dcop-adopt's People

Contributors

hargre avatar jefersonalves avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

dcop-adopt's Issues

JSON syntax?

Is there a specification of the JSON input format somewhere? I'm trying to reconstruct it from ParseJSONtoGraph, but it's tricky.

Implement backtracking procedure

  • Minimize local cost for upper bound

  • Minimize local cost for lower bound

  • Send value message to lower neighbours (currently only sends to children)

  • Call mantain allocation invariant

  • Add termination logic

  • Send cost message to parent

mvn tests fail under Docker

I followed the instructions in the readme, and the mvn compile seemed to compile fine.

I ran the first example and while it seemed to terminate successfully, it did not exit cleanly, and I had to terminate with ^c:

terminate status: false
[SEND 1     ] x2 send message to: x1 content: [context: {x1=0} xk: x2 lb: 2 ub: 2]
[SEND 1     ] x2 send message to: x1 content: [context: {x1=0} xk: x2 lb: 2 ub: 2]
[REC TERMI  ] x2 receive terminate message: context: {x1=0} from x1
[BACK TRACK ] x2 starting backTrack procedure
minimize current value for Upper Bound1
Feb 22, 2022 7:22:04 PM agents.dcop.adopt.maintainAllocationInvariant maintain
INFO: Agent x2 starting maitain allocation invariant
t: 2ub: 2
terminate status: true
x2 does not receive message
  >>> Solution: {x1=0, x2=1}
[SEND 1     ] x2 send message to: x1 content: [context: {x1=0, x2=1} xk: x2 lb: 2 ub: 2]

Here I did the Control-C to exit , since it seemed to have completed successfully.

I then did a Maven test to check that everything was OK, and the first test errored out. Following is the terminal output. If you would like more details, please let me know and I will rerun with debug logging.

root@82fd4347476b:/dcop# mvn test
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------------< dcop-adopt:dcop-adopt >------------------------
[INFO] Building dcop-adopt 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ dcop-adopt ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ dcop-adopt ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ dcop-adopt ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /dcop/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ dcop-adopt ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 2 source files to /dcop/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ dcop-adopt ---
[INFO] Surefire report directory: /dcop/target/surefire-reports
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-junit4/2.12.4/surefire-junit4-2.12.4.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-junit4/2.12.4/surefire-junit4-2.12.4.pom (2.4 kB at 1.4 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-providers/2.12.4/surefire-providers-2.12.4.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-providers/2.12.4/surefire-providers-2.12.4.pom (2.3 kB at 37 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-junit4/2.12.4/surefire-junit4-2.12.4.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-junit4/2.12.4/surefire-junit4-2.12.4.jar (37 kB at 181 kB/s)

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running graph.GraphTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.526 sec
Running models.DCOPAgentDataTest
Teste compatibilidade {x1=1} and {}: true
Teste compatibilidade {} and {x1=0}: true
Teste compatibilidade {x1=0} and {x1=1, x2=0}: false
Teste compatibilidade {x1=1, x2=0} and {x1=1, x2=0}: true
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGILL (0x4) at pc=0x000000401536cf80, pid=262, tid=266
#
# JRE version: OpenJDK Runtime Environment (11.0.3+7) (build 11.0.3+7)
# Java VM: OpenJDK 64-Bit Server VM (11.0.3+7, mixed mode, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# J 336 c1 java.lang.String.charAt(I)C [email protected] (25 bytes) @ 0x000000401536cf80 [0x000000401536cfa0+0xffffffffffffffe0]
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /dcop/hs_err_pid262.log
Compiled method (c1)    2460  336       3       java.lang.String::charAt (25 bytes)
 total in heap  [0x000000401536cd90,0x000000401536d6d0] = 2368
 relocation     [0x000000401536cf08,0x000000401536cf90] = 136
 main code      [0x000000401536cfa0,0x000000401536d440] = 1184
 stub code      [0x000000401536d440,0x000000401536d4f8] = 184
 metadata       [0x000000401536d4f8,0x000000401536d528] = 48
 scopes data    [0x000000401536d528,0x000000401536d5d0] = 168
 scopes pcs     [0x000000401536d5d0,0x000000401536d6b0] = 224
 dependencies   [0x000000401536d6b0,0x000000401536d6b8] = 8
 nul chk table  [0x000000401536d6b8,0x000000401536d6d0] = 24
Could not load hsdis-amd64.so; library not loadable; PrintAssembly is disabled
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
#
qemu: uncaught target signal 6 (Aborted) - core dumped
Aborted

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  19.748 s
[INFO] Finished at: 2022-02-22T19:25:26Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project dcop-adopt: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test failed: The forked VM terminated without saying properly goodbye. VM crash or System.exit called ? -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

Make messages package

  • Create serializable classes for objects sent in messages
  • Create an interface for message generic methods
  • Pass objects instead of strings when sending and receiving messages

Unable to build for linux/arm64

Because I have a Mac M1, I tried rebuilding the docker image locally for the arm64 architecture. Here's what I did:

$ docker buildx build --platform linux/arm64 .

When I try this, I get the following error, apparently because the JADE library is not available. Any idea what could be wrong?

Downloaded from central: https://repo.maven.apache.org/maven2/junit/junit/4.8.1/junit-4.8.1.pom (949 B at 23 kB/s)
#7 3.578 [INFO] ------------------------------------------------------------------------
#7 3.578 [INFO] BUILD FAILURE
#7 3.578 [INFO] ------------------------------------------------------------------------
#7 3.579 [INFO] Total time:  2.755 s
#7 3.579 [INFO] Finished at: 2022-02-22T20:49:06Z
#7 3.580 [INFO] ------------------------------------------------------------------------
#7 3.581 [ERROR] Failed to execute goal on project dcop-adopt: Could not resolve dependencies for project dcop-adopt:dcop-adopt:jar:0.0.1-SNAPSHOT: Failed to collect dependencies at com.tilab.jade:jade:jar:4.5.0: Failed to read artifact descriptor for com.tilab.jade:jade:jar:4.5.0: Could not transfer artifact com.tilab.jade:jade:pom:4.5.0 from/to tilab (https://jade.tilab.com/maven/): PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1]
#7 3.582 [ERROR]
#7 3.582 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
#7 3.582 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
#7 3.583 [ERROR]
#7 3.583 [ERROR] For more information about the errors and possible solutions, please read the following articles:
#7 3.583 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
------
error: failed to solve: executor failed running [/bin/sh -c mvn install]: exit code: 1

Weirdly, this seems to be an SSL problem, as indicated by the sun.security.provider.certpath.SunCertPathBuilderException in the backtrace, but I don't have any trouble with the URL in my browser. I suppose there might be some oddity where the Docker image doesn't have some required root certificate?

Is there a workaround where one could download this library by hand to avoid needing to figure out how to fix SSL configuration in a docker container?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.