Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
islerfab committed Sep 23, 2021
2 parents 34d01ed + 63e70c2 commit 1b2d315
Show file tree
Hide file tree
Showing 164 changed files with 5,016 additions and 841 deletions.
178 changes: 123 additions & 55 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,75 @@

# Created by https://www.gitignore.io/api/java,maven,intellij,jetbrains
# Edit at https://www.gitignore.io/?templates=java,maven,intellij,jetbrains
# Created by https://www.toptal.com/developers/gitignore/api/java,maven,intellij,visualstudiocode,eclipse
# Edit at https://www.toptal.com/developers/gitignore?templates=java,maven,intellij,visualstudiocode,eclipse

### Eclipse ###
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.recommenders

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# PyDev specific (Python IDE for Eclipse)
*.pydevproject

# CDT-specific (C/C++ Development Tooling)
.cproject

# CDT- autotools
.autotools

# Java annotation processor (APT)
.factorypath

# PDT-specific (PHP Development Tools)
.buildpath

# sbteclipse plugin
.target

# Tern plugin
.tern-project

# TeXlipse plugin
.texlipse

# STS (Spring Tool Suite)
.springBeans

# Code Recommenders
.recommenders/

# Annotation Processing
.apt_generated/
.apt_generated_test/

# Scala IDE specific (Scala & Java development for Eclipse)
.cache-main
.scala_dependencies
.worksheet

# Uncomment this line if you wish to ignore the project description file.
# Typically, this file would be tracked if it contains build/dependency configurations:
#.project

### Eclipse Patch ###
# Spring Boot Tooling
.sts4-cache/

### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
Expand All @@ -13,6 +79,9 @@
.idea/**/dictionaries
.idea/**/shelf

# AWS User-specific
.idea/**/aws.xml

# Generated files
.idea/**/contentModel.xml

Expand All @@ -33,9 +102,14 @@
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/
Expand Down Expand Up @@ -79,7 +153,26 @@ fabric.properties
# *.ipr

# Sonarlint plugin
.idea/sonarlint
# https://plugins.jetbrains.com/plugin/7973-sonarlint
.idea/**/sonarlint/

# SonarQube Plugin
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
.idea/**/sonarIssues.xml

# Markdown Navigator plugin
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
.idea/**/markdown-navigator.xml
.idea/**/markdown-navigator-enh.xml
.idea/**/markdown-navigator/

# Cache file creation bug
# See https://youtrack.jetbrains.com/issue/JBR-2257
.idea/$CACHE_FILE$

# CodeStream plugin
# https://plugins.jetbrains.com/plugin/12206-codestream
.idea/codestream.xml

### Java ###
# Compiled class file
Expand All @@ -106,56 +199,6 @@ fabric.properties
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

### JetBrains ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff

# Generated files

# Sensitive or high-churn files

# Gradle

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules

# CMake

# Mongo Explorer plugin

# File-based project format

# IntelliJ

# mpeltonen/sbt-idea plugin

# JIRA plugin

# Cursive Clojure plugin

# Crashlytics plugin (for Android Studio and IntelliJ)

# Editor-based Rest Client

# Android studio 3.1+ serialized cache file

### JetBrains Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr

# Sonarlint plugin

### Maven ###
target/
pom.xml.tag
Expand All @@ -166,6 +209,31 @@ release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
.mvn/wrapper/maven-wrapper.jar

# End of https://www.gitignore.io/api/java,maven,intellij,jetbrains
### Maven Patch ###
# Eclipse m2e generated files
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace

# Local History for Visual Studio Code
.history/

### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide

# End of https://www.toptal.com/developers/gitignore/api/java,maven,intellij,visualstudiocode,eclipse
/bin/
14 changes: 9 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>org.marketdesignresearch</groupId>
<artifactId>mechlib</artifactId>
<version>0.1.0</version>
<version>0.2.0</version>
<packaging>jar</packaging>

<name>${project.groupId}:${project.artifactId}</name>
Expand All @@ -21,7 +21,7 @@
<url>https://www.gnu.org/licenses/gpl-3.0.en.html</url>
</license>
</licenses>

<developers>
<developer>
<name>Fabio Isler</name>
Expand All @@ -38,7 +38,7 @@
<connection>scm:git:git://github.com/marketdesignresearch/mechlib.git</connection>
<developerConnection>scm:git:[email protected]:marketdesignresearch/mechlib.git</developerConnection>
<url>https://github.com/marketdesignresearch/mechlib/tree/master/</url>
<tag>v0.1.0</tag>
<tag>v0.2.0</tag>
</scm>

<distributionManagement>
Expand Down Expand Up @@ -72,9 +72,10 @@
<dependency>
<groupId>cplex</groupId>
<artifactId>cplex</artifactId>
<version>12.10</version>
<version>20.1</version>
<optional>true</optional>
<scope>provided</scope>
<scope>system</scope>
<systemPath>${env.CPLEX_STUDIO_DIR201}/cplex/lib/cplex.jar</systemPath>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
Expand Down Expand Up @@ -156,6 +157,9 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<argLine>"-Djava.library.path=${env.CPLEX_STUDIO_BINARIES201}"</argLine>
</configuration>
</plugin>
</plugins>
</pluginManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ public Allocation(Map<? extends Bidder, BidderAllocation> tradesMap, BundleValue
public Allocation(BigDecimal totalAllocationValue, Map<? extends Bidder, BidderAllocation> tradesMap,
BundleValueBids<?> bids, MetaInfo metaInfo, Set<PotentialCoalition> coalitions) {
this.totalAllocationValue = totalAllocationValue;
this.trueSocialWelfare = tradesMap.entrySet().stream().map(e -> e.getKey().getValue(e.getValue().getBundle(), true))
.reduce(BigDecimal.ZERO, BigDecimal::add);
this.trueSocialWelfare = tradesMap.entrySet().stream()
.map(e -> e.getKey().getValue(e.getValue().getBundle(), true)).reduce(BigDecimal.ZERO, BigDecimal::add);
Map<UUID, BidderAllocation> map = new LinkedHashMap<>();
tradesMap.forEach((bidder, bidderAllocation) -> map.put(bidder.getId(), bidderAllocation));
this.tradesMap = ImmutableMap.copyOf(map);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;

/**
* Immutable Wrapper for an allocation
Expand All @@ -27,7 +26,6 @@
@RequiredArgsConstructor(onConstructor = @__({ @PersistenceConstructor }))
@ToString
@EqualsAndHashCode
@Slf4j
public final class BidderAllocation {
public static final BidderAllocation ZERO_ALLOCATION = new BidderAllocation(BigDecimal.ZERO, emptySet(),
emptySet());
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/org/marketdesignresearch/mechlib/core/Bundle.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;

/**
* A bundle is a collection of goods with corresponding quantities. Often, in
Expand All @@ -29,7 +28,6 @@
*/
@AllArgsConstructor(access = AccessLevel.PRIVATE, onConstructor = @__({ @PersistenceConstructor }))
@EqualsAndHashCode
@Slf4j
public final class Bundle {
/**
* The empty bundle.
Expand Down Expand Up @@ -65,8 +63,9 @@ public Bundle(Set<BundleEntry> bundleEntries) {
* @param map a good to quantity map
*/
public Bundle(Map<? extends Good, Integer> map) {
this(new LinkedHashSet<>((map.entrySet().stream().map(entry -> new BundleEntry(entry.getKey(), entry.getValue()))
.collect(Collectors.toCollection(LinkedHashSet::new)))));
this(new LinkedHashSet<>(
(map.entrySet().stream().map(entry -> new BundleEntry(entry.getKey(), entry.getValue()))
.collect(Collectors.toCollection(LinkedHashSet::new)))));
}

/**
Expand All @@ -78,7 +77,8 @@ public Bundle(Map<? extends Good, Integer> map) {
* @return A bundle consisting of the goods at quantity 1
*/
public static Bundle of(List<? extends Good> bundle) {
LinkedHashMap<Good, Integer> map = bundle.stream().collect(Collectors.toMap(g -> g, g -> 1, (e1, e2) -> e1, LinkedHashMap::new));
LinkedHashMap<Good, Integer> map = bundle.stream()
.collect(Collectors.toMap(g -> g, g -> 1, (e1, e2) -> e1, LinkedHashMap::new));
return new Bundle(map);
}

Expand Down
Loading

0 comments on commit 1b2d315

Please sign in to comment.