Model and solve in MiniZinc the Magic Squares Problem. You can consult wikipedia to find out about magic squares. The problem consists in finding an $n \times n$ matrix such that:
Model in CP and solve the Sudoku game. In specific, solve the following case:
Consider the following problem in Planning Wedding Seating:
Assume the following input data:
enum Guests = { bride, groom, bestman, bridesmaid, bob, carol, ted, alice, ron, rona, ed, clara };
set of int: Seats = 1..12;
set of int: Hatreds = 1..5;
array[Hatreds] of Guests: h1 = [groom, carol, ed, bride, ted];
array[Hatreds] of Guests: h2 = [clara, bestman, ted, alice, ron];
set of Guests: Males = { groom, bestman, bob, ted, ron, ed };
set of Guests: Females = { bride, bridesmaid, carol, alice, rona, clara };
Consider another, frequent version of the seating problem:
Assign guests to a number of separated tables of $S$ seats each while minimizing the unhappiness of all the guests. The unhappiness of guests is defined as their maximum unhappiness at being seated with each of the other guests at their table, i.e., it is a pairwise function. The unhappiness of a table is the maximum unhappiness of all the guests at the table. All guests must be seated and there is a limited number of seats at each table.
Model these problems in CP.
Model and solve in CP the 8-Queens problem that asks to place 8 queens on a chess board such that the queens do not attack each other. Focus above all on the selection of variables.
Model and solve in CP the bin packing problem: you are given a set of items each with a size and a set of bins each with a capacity that limits the total size of the items that can be placed in it. Your task is to place the items in the minimum number of bins such that the capacity constraint is not exceeded. Focus on modeling the problem with both arrays of variables and arrays of set variables. Calculate a lower and upper bound on the number of bins before starting the solution process.
Solve the two following two problems:
Small:
int: cap = 10;
int: n = 11;
array[1..n] int: size = [6, 6, 6, 5, 3, 3, 2, 2, 2, 2, 2];
Large:
int: cap = 100;
int: n = 50;
array[1..n] int: size = [
99,98,95,95,95,94,94,91,88,87,86,85,76,74,73,71,68,60,55,54,51,
45,42,40,39,39,36,34,33,32,32,31,31,30,29,26,26,23,21,21,21,19,
18,18,16,15,5,5,4,1];
An optimal solution for the small instance: