Information

Deadline No deadline
Submission limit No limitation

Sign in

Assignment 5 — Stable Matching

0. Assignment Instructions

Before starting with your Java implementation, read the assignment instructions and grading rules on the course web page: https://user.it.uu.se/~pierref/courses/COCP/assignments/assignment5/assignment5.pdf .


The Stable Matching Problem

Complete the partial model StableMatching.java. It makes use of the Element1DVar constraint you have just implemented and is also a good example of the manipulation of logical and reified constraints. Ensure that your implementation discovers all 6 solutions to the provided instance. Check that your implementation passes the tests StableMatchingTest.java.

Hint1: Some constraints will need to be modeled using Element1DVar when one of the arguments is a constant instead of a variable. To transform an int z into a variable, you can create an IntVar with z as its unique domain value, by using makeIntVar(cp, z, z):

IntVar[] T = ...;
IntVar y = ...;
int z = ...; // not an IntVar
// does not work
cp.post(new Element1DVar(T, y, z));
// this works!
cp.post(new Element1DVar(T, y, makeIntVar(cp, z, z)));

Hint2: Some constraints are modeled using implication. A static method implies is provided within StableMatching.java.


Before submitting, remember to fetch the latest changes from upstream (the MiniCP GitHub repository).

Note that the original tests of the MiniCP GitHub repository will be run.