Version 127 (modified by wouter, 5 years ago) ( diff )

--

GENIUS

Genius2 is an open architecture for heterogeneous negotiating parties via the internet. It provides the basis for an implementation of a testbed for negotiating parties that includes a set of negotiation problems for benchmarking parties, a library of negotiation strategies, and analytical tools to evaluate an party's performance and their strategies allows user.

Here is the source code for the core of genius: the data structures for issues, values, bids, profiles, events and actions, agents etc.

The SVN repo is on

https://tracinsy.ewi.tudelft.nl/svn/genius2/

This repository contains the core code of Genius2. The genius servers can be found on

Writing a party in Java

Example parties can be found here. An agent is compiled with maven. After compilation (mvn package) you get a target/yourparty-X.Y.Z-jar-with-dependencies.jar that can be copied into the parties server for deployment.

The basic structure of an agent looks like this

public class RandomParty extends DefaultParty {
	@Override
	public void notifyChange(Inform info) {
		// System.out.println("Received info:" + info);
		if (info instanceof Settings) {
			fetchProfile(((Settings) info).getProfile());
			this.me = ((Settings) info).getID();
		} else if (info instanceof ActionDone) {
			lastActor = ((ActionDone) info).getAction().getActor();
			Action otheract = ((ActionDone) info).getAction();
			if (otheract instanceof Offer) {
				lastReceivedBid = ((Offer) otheract).getBid();
			}
		} else if (info instanceof YourTurn) {
			myTurn();
		}
	}

	private void myTurn() {
		Action action;
		if (lastReceivedBid != null && profileint.getProfile()
				.getUtility(lastReceivedBid).doubleValue() > 0.6) {
			action = new Accept(lastActor, lastReceivedBid);
		} else {
			AllBidsList bidspace = new AllBidsList(getProfile().getDomain());
			long i = random.nextInt(bidspace.size().intValue());
			action = new Offer(me, bidspace.get(BigInteger.valueOf(i)));
		}
		try {
			getConnection().send(action);
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

	@Override
	public Capabilities getCapabilities() {
			return new Capabilities(new HashSet<>(
					Arrays.asList(new ProtocolRef(new URI("SAOP")))));
	}

	@Override
	public String getDescription() {
		return "places random bids until it can accept an offer with utility >0.6";
	}

}

Preparing the jar file

Party jar files must have a Main-Class set in the MANIFEST.MF file. This main-class must implement Party and have a no-arg constructor.

The example randomagent does this from the maven build script.

We recommend to do initialization of the party only in the init() and not in the constructor or static code. This because instances of your class can be made both for extracting general info as getDescription(), or to really run your class.

The jar files are loaded with an isolated jar class loader that should avoid collisions with possibly identically named but possibly different packages in other jar files.

Running a party

Negotiation parties are run on a partiesserver. The provided partiesserver supports only java agents at this time.

Import all sources in Eclipse

Normal developers that write new parties do not need to install the genius2 source code. This is only needed if you want to debug/trace into the genius2 code for instance for debugging or understanding the inner workings of genius2.

Install Subclipse using "help/Eclipse MarketPlace" and search for subclipse. Disable the JavaHL native DLLs and install. NOTE: due to a bug in Eclipse Photon the marketplace may not work. We suggest to upgrade...

You may get some errors on JavaHL library. To get rid of those, go to preferences/Team/SVN/

  • disable General SVN settings / JavaHL
  • SVN interface/Client: select SVNKit instead of JavaHL.

Right click in Package Explorer in Eclipse, select "Import/SVN/Checkout Projects from SVN". Select the root of the project, finish (selecting sub-projects will result in a stupid loop in the checkout procedure in Eclipse and won't lead anywhere...)

Richt click on the checked-out project that you want eclipse to recognise as Maven project (the project are maven but Eclipse does not recognise this after check-out). Select import/maven/existing maven projects. Finish.

Note. Eclipse does not automatically recognise this as a maven project because Eclipse supports this only with GIT repositories while we use SVN.

Attachments (6)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.