Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
3113a8a
Add README to SMTI algorithms
WPettersson Feb 6, 2019
145d480
Preprocessing: first run
WPettersson Feb 7, 2019
eab2d85
Updates to preprocessing, ready for tests
WPettersson Feb 7, 2019
be0b51c
Preprocess rework
WPettersson Feb 8, 2019
7b4a21f
Remove debugging output
WPettersson Feb 11, 2019
88e48bd
preprocessing fixes
WPettersson Feb 11, 2019
58362e6
Hide debug output
WPettersson Feb 11, 2019
ceb43e4
Fix missed preprocessing constructors
WPettersson Feb 13, 2019
d841101
Fix FindBestIterator
WPettersson Feb 14, 2019
52098b6
BestGroupIterator: New iterator
WPettersson Feb 15, 2019
24a41a1
Initial implementation of graph algorithm for preprocessing
WPettersson Mar 14, 2019
9dbf5d9
Add new preprocessing method
WPettersson Mar 18, 2019
3288986
Add complete-exact method
WPettersson Mar 21, 2019
b76ea77
Add preprocessing for other model
WPettersson Mar 21, 2019
b130ec0
Preprocessing updates for SMTI
WPettersson Mar 21, 2019
e5e0b47
Missed updates to a model
WPettersson Mar 22, 2019
2e53b64
Ooops, missed the graph
WPettersson Mar 22, 2019
3705c6e
Add mode 11
WPettersson Mar 22, 2019
b013d35
Add preprocessing for HRT
WPettersson Apr 10, 2019
ce0ce7b
Rest of preprocessing fixes
WPettersson Apr 10, 2019
3beefe9
Tweaks to Graph structure
WPettersson May 2, 2019
425f136
Tweaks to Graph
WPettersson May 2, 2019
4f7cbff
Tweaks to Graph
WPettersson May 2, 2019
b62c806
Tweaks to Graph
WPettersson May 2, 2019
99725aa
Fix SMTI code, make bigger graphs
WPettersson May 2, 2019
687a90e
Mode 12 is now no preprocessing
WPettersson May 31, 2019
696b488
Tweaks to graph, missed a model
WPettersson May 31, 2019
9c025eb
Fixes to "preprocess takes too long" code
WPettersson May 31, 2019
6eedc5a
Add no-preprocess mode
WPettersson May 31, 2019
cf2bf06
Add pp mode for descending improved
WPettersson Jul 1, 2019
1a5c6b3
Add modes 14/15
WPettersson Jul 1, 2019
a66146b
Fix improved descending, and no pp
WPettersson Jul 2, 2019
dff103d
Only print solution if one is found
WPettersson Jul 13, 2019
c58be60
Fix flow-based graph algorithm
WPettersson Jul 13, 2019
05b0f76
Print doctor/hospital IDs when debugging
WPettersson Jul 13, 2019
531033e
Re-run exact methods if new doctors/hospitals now must be filled
WPettersson Jul 13, 2019
1061f7f
Fix complete exact
WPettersson Jul 13, 2019
329c693
Calculate preprocessing time before comparing it
WPettersson Jul 15, 2019
28297d6
If PP fails in time, set reasonable values
WPettersson Jul 15, 2019
804faf5
Let reductions exit early if time is exceeded
WPettersson Jul 16, 2019
a608888
Fix count of removed preferences
WPettersson Jul 24, 2019
2b1dd5f
Fix removed pair counting for SMTI-GRP
WPettersson Jul 25, 2019
32b24e8
Count removed pairs for HosOff/ResApply
WPettersson Jul 25, 2019
671f383
Increase maximum size of graph
WPettersson Aug 6, 2019
4cda6e6
Add MAX-WT SMTI with scores based inversly on preferences
WPettersson Sep 6, 2019
8fbf747
Fix path to Gurobi
WPettersson Sep 6, 2019
9d0493f
Change wt to be sum of border scores, not product
WPettersson Sep 10, 2019
1c31853
Readd missing constraints
WPettersson Sep 11, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
850 changes: 850 additions & 0 deletions HRT/8_YESBIN_3STA_NOMERGED/AgentIterator.cpp

Large diffs are not rendered by default.

116 changes: 116 additions & 0 deletions HRT/8_YESBIN_3STA_NOMERGED/AgentIterator.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
#ifndef AGENTITERATOR_H
#define AGENTITERATOR_H

#include <utility>

#include "Allocation.h"

template <typename t_these, typename t_other>
class AgentIteratorBase {
public:
AgentIteratorBase(const t_these & agent, const std::set<int> & candidates, const std::set<int> & positions,
const std::vector<t_these> & these, const std::vector<t_other> & other, int group=0, int posn=0);
virtual ~AgentIteratorBase() = 0;
virtual void increment() = 0;
virtual void begin() = 0;

int get_position() const;
int get_group() const;
const t_these & get_agent() const;
const std::vector<t_these> & get_these() const;
const std::vector<t_other> & get_other() const;
const std::set<int> & get_positions() const;
const std::set<int> & get_candidates() const;
protected:
void regularIncrement();

const t_these & _agent;
int _group;
int _position;
const std::vector<t_these> & _these;
const std::vector<t_other> & _other;
const std::set<int> & _positions;
const std::set<int> & _candidates;
};


template <typename t_these, typename t_other>
class AgentIterator : public std::iterator<std::forward_iterator_tag, std::pair<int, int>, ptrdiff_t> {
public:
AgentIterator(const t_these & agent, const std::set<int> & candidates, const std::set<int> & positions,
const std::vector<t_these> & these, const std::vector<t_other> & other, int mode);
AgentIterator(AgentIterator *other, int group, int posn);
AgentIterator(AgentIterator *other);
~AgentIterator();
bool operator==(const AgentIterator& other);
bool operator!=(const AgentIterator& other);
const std::pair<int, int> operator*();
AgentIterator& operator++() {base->increment(); return *this; }
AgentIterator operator++(int) {AgentIterator res(this); base->increment(); return res; }

AgentIterator begin();
AgentIterator end();

int get_position() const;
int get_group() const;
int get_mode() const;

const t_these & get_agent() const { return base->get_agent(); }
const std::vector<t_these> & get_these() const {return base->get_these(); }
const std::vector<t_other> & get_other() const {return base->get_other(); }
const std::set<int> & get_positions() const {return base->get_positions(); }
const std::set<int> & get_candidates() const {return base->get_candidates(); }
private:
AgentIteratorBase<t_these, t_other> * base;
int _mode;
};


template <typename t_these, typename t_other>
class DescendingIterator : public AgentIteratorBase<t_these, t_other> {
public:
DescendingIterator(const t_these & agent, const std::set<int> & candidates,
const std::set<int> & positions, const std::vector<t_these> & these,
const std::vector<t_other> & other, int group=0, int posn=0);
~DescendingIterator() {}
void increment();
void begin();
};


template <typename t_these, typename t_other>
class SkipBigIterator : public AgentIteratorBase<t_these, t_other> {
public:
SkipBigIterator(const t_these & agent, const std::set<int> & candidates,
const std::set<int> & positions, const std::vector<t_these> & these,
const std::vector<t_other> & other, int skip, int group, int posn);
~SkipBigIterator() {}
void increment();
void begin();
private:
int _skip;
};

template <typename t_these, typename t_other>
class BestIterator : public AgentIteratorBase<t_these, t_other> {
public:
BestIterator(const t_these & agent, const std::set<int> & candidates,
const std::set<int> & positions, const std::vector<t_these> & these,
const std::vector<t_other> & other, int group=0, int posn=0);
~BestIterator() {}
void increment();
void begin();
};

template <typename t_these, typename t_other>
class BestGroupIterator : public AgentIteratorBase<t_these, t_other> {
public:
BestGroupIterator(const t_these & agent, const std::set<int> & candidates,
const std::set<int> & positions, const std::vector<t_these> & these,
const std::vector<t_other> & other, int group=0, int posn=0);
~BestGroupIterator() {}
void increment();
void begin();
};

#endif /* AGENTITERATOR_H */
Loading