Go to the documentation of this file.
10 #define ADD_NO_PRUNING
18 using namespace gtsam;
24 s.addStudent(
"Michael N",
"AI",
"Autonomy",
"Perception",
"Tucker Balch");
27 s.addStudent(
"Tucker H",
"Controls",
"AI",
"Perception",
"Jim Rehg");
30 s.addStudent(
"Jake H",
"Controls",
"AI",
"Perception",
"Henrik Christensen");
33 s.addStudent(
"Tobias K",
"Controls",
"AI",
"Autonomy",
"Mike Stilman");
36 s.addStudent(
"Shu J",
"Controls",
"AI",
"HRI",
"N/A 1");
39 s.addStudent(
"Akansel C",
"AI",
"Autonomy",
"Mechanics",
40 "Henrik Christensen");
43 s.addStudent(
"Tiffany C",
"Controls",
"N/A 1",
"N/A 2",
"Charlie Kemp");
54 string path(
"../../../gtsam_unstable/discrete/examples/");
57 s.addArea(
"Harvey Lipkin",
"Mechanics");
58 s.addArea(
"Wayne Book",
"Mechanics");
59 s.addArea(
"Jun Ueda",
"Mechanics");
62 s.addArea(
"Patricio Vela",
"Controls");
63 s.addArea(
"Magnus Egerstedt",
"Controls");
64 s.addArea(
"Jun Ueda",
"Controls");
67 s.addArea(
"Jim Rehg",
"Perception");
68 s.addArea(
"Irfan Essa",
"Perception");
69 s.addArea(
"Aaron Bobick",
"Perception");
70 s.addArea(
"Henrik Christensen",
"Perception");
72 s.addArea(
"Mike Stilman",
"AI");
73 s.addArea(
"Henrik Christensen",
"AI");
74 s.addArea(
"Frank Dellaert",
"AI");
75 s.addArea(
"Ayanna Howard",
"AI");
78 s.addArea(
"Ayanna Howard",
"Autonomy");
80 s.addArea(
"Charlie Kemp",
"Autonomy");
81 s.addArea(
"Tucker Balch",
"Autonomy");
82 s.addArea(
"Ron Arkin",
"Autonomy");
84 s.addArea(
"Andrea Thomaz",
"HRI");
85 s.addArea(
"Karen Feigh",
"HRI");
86 s.addArea(
"Charlie Kemp",
"HRI");
89 s.addArea(
"N/A 1",
"N/A 1");
90 s.addArea(
"N/A 2",
"N/A 2");
93 for (
size_t i = 0;
i < nrStudents;
i++)
117 SETDEBUG(
"DiscreteConditional::DiscreteConditional",
true);
132 SETDEBUG(
"DiscreteConditional::COUNT",
true);
137 vector<double> slotsAvailable(
largeExample(0).nrTimeSlots(), 1.0);
140 for (
size_t s = 0;
s < 7;
s++) {
162 size_t bestSlot = root->argmax();
167 values[dkey.first] = bestSlot;
168 size_t count = (*root)(
values);
171 slotsAvailable[bestSlot] = 0.0;
172 cout << scheduler.
studentName(6 -
s) <<
" = " << scheduler.
slotName(bestSlot) <<
" (" << bestSlot
173 <<
"), count = " << count << endl;
197 size_t slot, vector<Scheduler>& schedulers) {
200 SETDEBUG(
"Scheduler::buildGraph",
false);
204 schedulers.push_back(scheduler);
210 vector<Scheduler> schedulers;
211 vector<DiscreteBayesNet::shared_ptr> samplers(7);
214 vector<size_t> slots{16, 17, 11, 2, 0, 5, 9};
215 for (
size_t i = 0;
i < 7;
i++)
219 for (
size_t n = 0;
n < 500;
n++) {
220 vector<size_t>
stats(19, 0);
221 vector<DiscreteValues>
samples;
222 for (
size_t i = 0;
i < 7;
i++) {
223 samples.push_back(samplers[
i]->sample());
229 if (nz >= 15 &&
max <= 2) {
230 cout <<
"Sampled schedule " << (
n + 1) <<
", min = " <<
min <<
", nz = " << nz
231 <<
", max = " <<
max << endl;
232 for (
size_t i = 0;
i < 7;
i++) {
233 cout << schedulers[
i].studentName(0) <<
" : " << schedulers[
i].slotName(
289 scheduler.
addStudent(
"Carlos N",
"Perception",
"AI",
"Autonomy",
290 "Henrik Christensen");
291 scheduler.
print(
"scheduler");
294 vector<size_t> slots{16, 17, 11, 2, 0, 5, 9, 14};
295 vector<double> slotsAvailable(scheduler.
nrTimeSlots(), 1.0);
297 slotsAvailable[
s] = 0;
313 size_t bestSlot = root->argmax();
318 values[dkey.first] = bestSlot;
319 size_t count = (*root)(
values);
320 cout << scheduler.
studentName(0) <<
" = " << scheduler.
slotName(bestSlot) <<
" (" << bestSlot
321 <<
"), count = " << count << endl;
323 for (
size_t n = 0;
n < 10;
n++) {
324 auto sample0 = chordal->sample();
void solveStaged(size_t addMutex=2)
const std::string & slotName(size_t s) const
#define tictoc_finishedIteration()
DiscreteBayesNet::shared_ptr createSampler(size_t i, size_t slot, vector< Scheduler > &schedulers)
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 addStudent(Scheduler &s, size_t i)
void printAssignment(const DiscreteValues &assignment) const
DecisionTreeFactor product() const
std::shared_ptr< This > shared_ptr
shared_ptr to this class
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 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)
Scheduler largeExample(size_t nrStudents=7)
void addStudent(const std::string &studentName, const std::string &area1, const std::string &area2, const std::string &area3, const std::string &advisor)
const DiscreteKey & studentKey(size_t i) const
size_t nrTimeSlots() const
gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:04:02