Go to the documentation of this file.
10 #define ADD_NO_PRUNING
18 using namespace gtsam;
30 s.addStudent(
"Young, Carol",
"Controls",
"Autonomy",
"Mechanics",
"Fumin Zhang");
33 s.addStudent(
"Erdogan, Can",
"Controls",
"AI",
"Perception",
"Mike Stilman");
36 s.addStudent(
"Arslan, Oktay",
"Controls",
"AI",
"Mechanics",
"Panos Tsiotras");
39 s.addStudent(
"Bhattacharjee, Tapomayukh",
"Controls",
"AI",
"Mechanics",
"Charlie Kemp");
42 s.addStudent(
"Grey, Michael",
"Controls",
"AI",
"Mechanics",
"Wayne Book");
45 s.addStudent(
"O'Flaherty, Rowland",
"Controls",
"AI",
"Mechanics",
"Magnus Egerstedt");
48 s.addStudent(
"Pickem, Daniel",
"Controls",
"AI",
"Mechanics",
"Jeff Shamma");
51 s.addStudent(
"Lee, Kimoon",
"Controls",
"Autonomy",
"Mechanics",
"Henrik Christensen");
54 s.addStudent(
"Melim, Andrew Lyon",
"Controls",
"AI",
"Perception",
"Frank Dellaert");
57 s.addStudent(
"Jensen, David",
"Controls",
"Autonomy",
"HRI",
"Andrea Thomaz");
60 s.addStudent(
"Nisbett, Jared",
"Controls",
"Perception",
"Mechanics",
"Magnus Egerstedt");
63 s.addStudent(
"Pan, Yunpeng",
"Controls",
"Perception",
"Mechanics",
"Wayne Book");
79 string path(
"../../../gtsam_unstable/discrete/examples/");
82 s.addArea(
"Harvey Lipkin",
"Mechanics");
83 s.addArea(
"Jun Ueda",
"Mechanics");
84 s.addArea(
"Mike Stilman",
"Mechanics");
86 s.addArea(
"Wayne Book",
"Mechanics");
89 s.addArea(
"Patricio Vela",
"Controls");
90 s.addArea(
"Magnus Egerstedt",
"Controls");
91 s.addArea(
"Jun Ueda",
"Controls");
92 s.addArea(
"Panos Tsiotras",
"Controls");
93 s.addArea(
"Fumin Zhang",
"Controls");
94 s.addArea(
"Ayanna Howard",
"Controls");
95 s.addArea(
"Jeff Shamma",
"Controls");
97 s.addArea(
"Frank Dellaert",
"Perception");
98 s.addArea(
"Henrik Christensen",
"Perception");
100 s.addArea(
"Mike Stilman",
"AI");
103 s.addArea(
"Charles Isbell",
"AI");
105 s.addArea(
"Andrea Thomaz",
"AI");
107 s.addArea(
"Ayanna Howard",
"Autonomy");
108 s.addArea(
"Charlie Kemp",
"Autonomy");
111 s.addArea(
"Karen Feigh",
"HRI");
116 for (
size_t i = 0;
i < nrStudents;
i++)
130 SETDEBUG(
"Scheduler::buildGraph",
true);
141 SETDEBUG(
"DiscreteConditional::DiscreteConditional",
true);
149 for (
size_t i=0;
i<100;
i++) {
150 auto assignment = sample(*chordal);
157 if (nz >= 13 &&
min >=1 &&
max <= 4) {
158 cout <<
"======================================================\n";
179 SETDEBUG(
"DiscreteConditional::COUNT",
true);
184 vector<double> slotsAvailable(
largeExample(0).nrTimeSlots(), 1.0);
209 size_t bestSlot = root->argmax();
214 values[dkey.first] = bestSlot;
215 double count = (*root)(
values);
218 slotsAvailable[bestSlot] = 0.0;
220 <<
"), count = " << count << endl;
228 size_t slot, vector<Scheduler>& schedulers) {
231 cout <<
" creating sampler for " << scheduler.
studentName(0) << endl;
232 SETDEBUG(
"Scheduler::buildGraph",
false);
236 schedulers.push_back(scheduler);
242 size_t nrFaculty = 17;
244 vector<Scheduler> schedulers;
245 vector<DiscreteBayesNet::shared_ptr> samplers(
NRSTUDENTS);
248 vector<size_t> slots{12,11,13, 21,16,1, 3,2,6, 7,22,4};
253 for (
size_t n = 0;
n < 10000;
n++) {
254 vector<size_t>
stats(nrFaculty, 0);
255 vector<DiscreteValues>
samples;
257 samples.push_back(samplers[
i]->sample());
263 if (nz >= 16 &&
max <= 3) {
264 cout <<
"Sampled schedule " <<
n + 1 <<
", min = " <<
min <<
", nz = " << nz <<
", max = " <<
max << endl;
266 cout << schedulers[
i].studentName(0) <<
" : " << schedulers[
i].slotName(
const std::string & slotName(size_t s) const
#define tictoc_finishedIteration()
DiscreteBayesNet::shared_ptr createSampler(size_t i, size_t slot, vector< Scheduler > &schedulers)
void accumulateStats(const DiscreteValues &assignment, std::vector< size_t > &stats) const
Scheduler largeExample(size_t nrStudents=NRSTUDENTS, bool addStudents=true)
KeyFormatter DefaultKeyFormatter
Assign default key formatter.
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy y set format x g set format y g set format x2 g set format y2 g set format z g set angles radians set nogrid set key title set key left top Right noreverse box linetype linewidth samplen spacing width set nolabel set noarrow set nologscale set logscale x set set pointsize set encoding default set nopolar set noparametric set set samples
void addStudentSpecificConstraints(size_t i, std::optional< size_t > slot={})
static constexpr bool debug
DiscreteBayesNet::shared_ptr eliminate() const
void printAssignment(const DiscreteValues &assignment) const
DecisionTreeFactor product() const
std::shared_ptr< This > shared_ptr
shared_ptr to this class
void addStudent(Scheduler &s, size_t i)
std::pair< Key, size_t > DiscreteKey
size_t nrStudents() const
current number of students
void setSlotsAvailable(const std::vector< double > &slotsAvailable)
std::shared_ptr< This > shared_ptr
void solveStaged(size_t addMutex=2)
void product(const MatrixType &m)
void print(const std::string &s="Scheduler", const KeyFormatter &formatter=DefaultKeyFormatter) const override
const std::string & studentName(size_t i) const
DiscreteValues optimize(OptionalOrderingType orderingType={}) const
Find the maximum probable explanation (MPE) by doing max-product.
void buildGraph(size_t mutexBound=7)
const DiscreteKey & studentKey(size_t i) const
gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:35:02