FRODO Version 2.19.1
An open-source framework for Distributed Constraint Optimization (DCOP)
Loading...
Searching...
No Matches
frodo2.benchmarks.auctions.main.CATSToXCSP Class Reference

This is the main class for converting a CATS (Combinatorial Auctions Test Suite) into a DCOP (Distributed Constraint Optimization Problem). More...

Static Public Member Functions

static void main (String[] args)
 The main method first checks the arguments, then parses the source file, converts the problem by the indicated method and finally writes the output file.
static Auction parseAuction (String sourceFileName) throws FileNotFoundException
 Parses the description of an auction, in CATS format.
static Document toXCSP (Auction auction, int methodID)
 Formulates the input auction as a DCOP or DisCSP in XCSP format.
static Document toXCSP (Auction auction, int methodID, boolean discsp, boolean sumDecomposition, boolean intensional, boolean minimize)
 Formulates the input auction as a DCOP or DisCSP in XCSP format.

Static Private Member Functions

static boolean checkArgs (String[] args)
static void displayLicense ()
 This method reads the license from the file LICENSE.txt and displays it if the file exists and can be read.
static void displayMethods ()
 This method displays a brief description of the three implemented conversion methods.
static void usage ()
 This method displays a manual indicating how to run the program.
static void addBid (int bidID, double price, String line)
 This method is called whenever a line in the source file matches the bid pattern.
static double findMaxUtility ()

Static Private Attributes

static String sourceFileName = null
 Path and name of the source file; parsed from the args array.
static String outputDir = null
 Path where the output file should be saved; parsed from the args array.
static int methodID = 0
 ID of the method to be used; parsed from the args array.
static boolean minimize = false
 Boolean indicating whether the auction should be transformed into a minimization problem or not.
static boolean discsp = false
 If true, bid prices should be ignored, and the output should be a pure DisCSP intance.
static boolean sumDecomposition = false
 Boolean indicating whether sum constraints should be intensional (true) or extensional (false).
static boolean intensional = false
 Whether all constraints must be intensional.
static int nbGoods = -1
 Number of goods in the auction.
static HashSet< GoodgoodsWithRP = new HashSet<Good>()
 List of all goods which already have a reserve price.
static Auction auction = null
 Auction instance created from the source file.
static Map< Integer, BidderdummyGoodsToBiddersMap = new HashMap<Integer, Bidder>()
 Mapping from dummy good number to bidder; assures no dummy good is assigned to two different bidders.
static final Pattern nbrBidsPattern = Pattern.compile("\\s*bids\\s+(\\d+)\\s*")
 Pattern to identify the desired number of bids, which may be lower than the actual number of bids.
static final Pattern goodsPattern = Pattern.compile("\\s*goods\\s+(\\d+)\\s*")
 Pattern used to identify the \'goods\' line in the source file.
static final Pattern dummyPattern = Pattern.compile("\\s*dummy\\s+(\\d+)\\s*")
 Pattern used to identify the \'dummy\' line in the source file.
static final Pattern bidPattern = Pattern.compile("\\s*(\\d+)\\s+(-?\\d+(\\.\\d*)?)(\\s+-?\\d+)+\\s*#")
 Pattern used to identify the bids in the source file.

Detailed Description

This is the main class for converting a CATS (Combinatorial Auctions Test Suite) into a DCOP (Distributed Constraint Optimization Problem).

Three different methods are implemented to do this, corresponding to three different DCOP models for the auction.

Author
Andreas Schaedeli, Thomas Leaute
Todo
Add support for Python scripting

Member Function Documentation

◆ addBid()

void frodo2.benchmarks.auctions.main.CATSToXCSP.addBid ( int bidID,
double price,
String line )
staticprivate

This method is called whenever a line in the source file matches the bid pattern.

The bid is then parsed and a Bid object is created and added to the list of bids In case the bid contains any good ID that is greater than or equal to the number of goods, this represents a dummy good. All bids containing the same dummy good were placed by the same bidder. So, for each bid without dummy goods, a new Bidder is created. However, if there are dummy goods, we want to make sure all the bids with the same dummy good are assigned the same bidder, so there is a mapping from dummy good IDs to Bidders. All bidders have to be added to the auction object. Moreover, if the bid value is less than 0, we consider it as reserve price for the good it bids on.

Parameters
bidIDUnique ID of the bid
priceUtility of the bid
lineLine of the source file containing the bid

References auction, dummyGoodsToBiddersMap, goodsWithRP, methodID, nbGoods, and frodo2.benchmarks.auctions.cats.Bidder.setFake().

Referenced by parseAuction().

Here is the call graph for this function:

◆ checkArgs()

boolean frodo2.benchmarks.auctions.main.CATSToXCSP.checkArgs ( String[] args)
staticprivate
Parameters
argsArray of arguments
Returns
true if all mandatory arguments are correctly specified, else false

References discsp, displayLicense(), displayMethods(), intensional, methodID, minimize, outputDir, sourceFileName, and sumDecomposition.

Referenced by main().

Here is the call graph for this function:

◆ displayLicense()

void frodo2.benchmarks.auctions.main.CATSToXCSP.displayLicense ( )
staticprivate

This method reads the license from the file LICENSE.txt and displays it if the file exists and can be read.

Referenced by checkArgs().

◆ displayMethods()

void frodo2.benchmarks.auctions.main.CATSToXCSP.displayMethods ( )
staticprivate

This method displays a brief description of the three implemented conversion methods.

Referenced by checkArgs().

◆ findMaxUtility()

double frodo2.benchmarks.auctions.main.CATSToXCSP.findMaxUtility ( )
staticprivate
Returns
The maximum utility among all the bids

References auction, and discsp.

Referenced by toXCSP().

◆ main()

void frodo2.benchmarks.auctions.main.CATSToXCSP.main ( String[] args)
static

The main method first checks the arguments, then parses the source file, converts the problem by the indicated method and finally writes the output file.

Parameters
argsArguments passed at program start

References auction, checkArgs(), discsp, intensional, methodID, minimize, outputDir, parseAuction(), sourceFileName, sumDecomposition, toXCSP(), and usage().

Here is the call graph for this function:

◆ parseAuction()

Auction frodo2.benchmarks.auctions.main.CATSToXCSP.parseAuction ( String sourceFileName) throws FileNotFoundException
static

Parses the description of an auction, in CATS format.

Parameters
sourceFileNamethe path to the CATS file
Returns
an Auction instance
Exceptions
FileNotFoundExceptionif the input file is not found

References addBid(), auction, bidPattern, dummyGoodsToBiddersMap, dummyPattern, goodsPattern, nbGoods, nbrBidsPattern, and sourceFileName.

Referenced by main().

Here is the call graph for this function:

◆ toXCSP() [1/2]

Document frodo2.benchmarks.auctions.main.CATSToXCSP.toXCSP ( Auction auction,
int methodID )
static

Formulates the input auction as a DCOP or DisCSP in XCSP format.

Parameters
auctionthe auction
methodIDthe ID of the XCSP modeling method
Returns
the XCSP document that is a maximization DCOP without intensional SUM constraints

References auction, methodID, and toXCSP().

Referenced by main(), and toXCSP().

Here is the call graph for this function:

◆ toXCSP() [2/2]

Document frodo2.benchmarks.auctions.main.CATSToXCSP.toXCSP ( Auction auction,
int methodID,
boolean discsp,
boolean sumDecomposition,
boolean intensional,
boolean minimize )
static

Formulates the input auction as a DCOP or DisCSP in XCSP format.

Parameters
auctionthe auction
methodIDthe ID of the XCSP modeling method
discspwhether to only allow hard constraints
sumDecompositionwhether to use intensional SUM constraints
intensionalwhether all constraints should be intensional
minimizewhether to output a minimization or a maximization problem
Returns
the XCSP document

References auction, frodo2.benchmarks.auctions.xcsp.Instance.create(), discsp, findMaxUtility(), intensional, methodID, minimize, sumDecomposition, and frodo2.algorithms.XCSPparser< V extends Addable< V >, U extends Addable< U > >.switchMaxMin().

Here is the call graph for this function:

◆ usage()

void frodo2.benchmarks.auctions.main.CATSToXCSP.usage ( )
staticprivate

This method displays a manual indicating how to run the program.

Referenced by main().

Member Data Documentation

◆ auction

Auction frodo2.benchmarks.auctions.main.CATSToXCSP.auction = null
staticprivate

Auction instance created from the source file.

Referenced by addBid(), findMaxUtility(), main(), parseAuction(), toXCSP(), and toXCSP().

◆ bidPattern

final Pattern frodo2.benchmarks.auctions.main.CATSToXCSP.bidPattern = Pattern.compile("\\s*(\\d+)\\s+(-?\\d+(\\.\\d*)?)(\\s+-?\\d+)+\\s*#")
staticprivate

Pattern used to identify the bids in the source file.

Referenced by parseAuction().

◆ discsp

boolean frodo2.benchmarks.auctions.main.CATSToXCSP.discsp = false
staticprivate

If true, bid prices should be ignored, and the output should be a pure DisCSP intance.

Referenced by checkArgs(), findMaxUtility(), main(), and toXCSP().

◆ dummyGoodsToBiddersMap

Map<Integer, Bidder> frodo2.benchmarks.auctions.main.CATSToXCSP.dummyGoodsToBiddersMap = new HashMap<Integer, Bidder>()
staticprivate

Mapping from dummy good number to bidder; assures no dummy good is assigned to two different bidders.

Referenced by addBid(), and parseAuction().

◆ dummyPattern

final Pattern frodo2.benchmarks.auctions.main.CATSToXCSP.dummyPattern = Pattern.compile("\\s*dummy\\s+(\\d+)\\s*")
staticprivate

Pattern used to identify the \'dummy\' line in the source file.

Referenced by parseAuction().

◆ goodsPattern

final Pattern frodo2.benchmarks.auctions.main.CATSToXCSP.goodsPattern = Pattern.compile("\\s*goods\\s+(\\d+)\\s*")
staticprivate

Pattern used to identify the \'goods\' line in the source file.

Referenced by parseAuction().

◆ goodsWithRP

HashSet<Good> frodo2.benchmarks.auctions.main.CATSToXCSP.goodsWithRP = new HashSet<Good>()
staticprivate

List of all goods which already have a reserve price.

Referenced by addBid().

◆ intensional

boolean frodo2.benchmarks.auctions.main.CATSToXCSP.intensional = false
staticprivate

Whether all constraints must be intensional.

Referenced by checkArgs(), main(), and toXCSP().

◆ methodID

int frodo2.benchmarks.auctions.main.CATSToXCSP.methodID = 0
staticprivate

ID of the method to be used; parsed from the args array.

Referenced by addBid(), checkArgs(), main(), toXCSP(), and toXCSP().

◆ minimize

boolean frodo2.benchmarks.auctions.main.CATSToXCSP.minimize = false
staticprivate

Boolean indicating whether the auction should be transformed into a minimization problem or not.

Referenced by checkArgs(), main(), and toXCSP().

◆ nbGoods

int frodo2.benchmarks.auctions.main.CATSToXCSP.nbGoods = -1
staticprivate

Number of goods in the auction.

Referenced by addBid(), and parseAuction().

◆ nbrBidsPattern

final Pattern frodo2.benchmarks.auctions.main.CATSToXCSP.nbrBidsPattern = Pattern.compile("\\s*bids\\s+(\\d+)\\s*")
staticprivate

Pattern to identify the desired number of bids, which may be lower than the actual number of bids.

Referenced by parseAuction().

◆ outputDir

String frodo2.benchmarks.auctions.main.CATSToXCSP.outputDir = null
staticprivate

Path where the output file should be saved; parsed from the args array.

Referenced by checkArgs(), and main().

◆ sourceFileName

String frodo2.benchmarks.auctions.main.CATSToXCSP.sourceFileName = null
staticprivate

Path and name of the source file; parsed from the args array.

Referenced by checkArgs(), main(), and parseAuction().

◆ sumDecomposition

boolean frodo2.benchmarks.auctions.main.CATSToXCSP.sumDecomposition = false
staticprivate

Boolean indicating whether sum constraints should be intensional (true) or extensional (false).

Referenced by checkArgs(), main(), and toXCSP().


The documentation for this class was generated from the following file: