tags/matching
https://www.cs.unb.ca/~bremner//tags/matching/
Copyright 2020, David Bremner
David BremnerikiwikiWed, 11 Sep 2019 09:47:48 -0300bipartitehttps://www.cs.unb.ca/~bremner//teaching/old/cs6375/examples/bipartite/
https://www.cs.unb.ca/~bremner//teaching/old/cs6375/examples/bipartite/
/tags/LP/tags/bipartite/tags/example/tags/matchingFri, 21 Sep 2012 00:00:00 -03002019-09-11T12:47:48Z<ul>
<li>Here is the <a href="https://www.cs.unb.ca/~bremner//teaching/old/cs6375/files/bipartite.mod">bipartite matching example</a> we discussed in class.</li>
<li><p>This <a href="https://www.cs.unb.ca/~bremner//teaching/old/cs6375/files/bipartite.ine">file</a> can be used to find all of the vertices (solutions).
Run with</p>
<p> lrs < bipartite.ine</p></li>
<li><p>It turns out there are only two vertices, both integer.</p></li>
</ul>
<pre>
1 1 0 0 1 1 1 0
1 0 1 1 0 1 0 1
</pre>
<p></p>
<ul>
<li>Solving with a <a href="https://www.cs.unb.ca/~bremner//teaching/old/cs6375/files/bipartite2.mod">uniform objective</a>, and
choosing <code>--interior</code> with glpsol, we get the non-integer optimal
solution</li>
</ul>
<pre>
x[1,A].val = 0.5
x[1,B].val = 0.5
x[2,A].val = 0.5
x[2,D].val = 0.5
x[3,C].val = 1.0
x[4,B].val = 0.5
x[4,D].val = 0.5
</pre>
<ul>
<li>This can be visualized as <a href="https://www.cs.unb.ca/~bremner//teaching/old/cs6375/files/bipartite2.dot">dot</a> and
<a href="https://www.cs.unb.ca/~bremner//teaching/old/cs6375/files/bipartite2.pdf">pdf</a>.</li>
</ul>
Matching Students to Topicshttps://www.cs.unb.ca/~bremner//teaching/old/cs6375/examples/matching/
https://www.cs.unb.ca/~bremner//teaching/old/cs6375/examples/matching/
/tags/example/tags/integer program/tags/matchingThu, 25 Sep 2008 11:54:00 -03002019-09-11T12:47:48Z<p>In CS3997 this year, I have decided to have "debates" instead of
presentations. This means that I need to make sure that each student
has has exactly one topic, <strong>and</strong> every topic is assigned to an even
number of students.</p>
<p>Another constraint is that I asked the students to list in order their
top 3 preferences. I wanted to maximize (within reason) "student
happiness", so I give weight 4 for their first choice, 2 for the
second, and 1 for their third.</p>
<p>Finally, the students are numbered <code>1...26</code> in the order they sent me
their preferences. I decided to enforce "first-come first-serve" in
the objective function, so the happiness of student 1 has more weight
than student 26. How much more is a bit of a subjective choice.</p>
<p>If you don't want to look at the solution yet, the students
<a href="https://www.cs.unb.ca/~bremner//teaching/old/cs6375/files/preferences.mod">preferences</a> are available separately.
'happy[i,j]' measures how happy student i is being assigned topic j</p>
<p>Almost the real <a href="https://www.cs.unb.ca/~bremner//teaching/old/cs6375/files/topics.mod">solution</a> is available. In actuallity,
I first solved the problem for the first 18 students (so they didn't have to wait), and use the following</p>
<pre> printf { i in students, j in topics : x[i,j]=1 } "s.t. fix_%d_%d: x[%d,%d]=1;\n",i,j,i,j;
</pre>
<p>to print out some constraints, which I then cut and past into the model, and
resolved a week or so later when I had all of the data.</p>