Go to the documentation of this file.
10 #define ADD_NO_PRUNING
18 using namespace gtsam;
30 s.addStudent(
"Pan, Yunpeng",
"Controls",
"Perception",
"Mechanics",
"Eric Johnson");
33 s.addStudent(
"Sawhney, Rahul",
"Controls",
"AI",
"Perception",
"Henrik Christensen");
36 s.addStudent(
"Akgun, Baris",
"Controls",
"AI",
"HRI",
"Andrea Thomaz");
39 s.addStudent(
"Jiang, Shu",
"Controls",
"AI",
"Perception",
"Ron Arkin");
42 s.addStudent(
"Grice, Phillip",
"Controls",
"Perception",
"HRI",
"Charlie Kemp");
45 s.addStudent(
"Huaman, Ana",
"Controls",
"AI",
"Perception",
"Mike Stilman");
48 s.addStudent(
"Levihn, Martin",
"AI",
"Autonomy",
"Perception",
"Mike Stilman");
51 s.addStudent(
"Nieto, Carlos",
"AI",
"Autonomy",
"Perception",
"Henrik Christensen");
54 s.addStudent(
"Robinette, Paul",
"Controls",
"AI",
"HRI",
"Ayanna Howard");
61 string path(
"../../../gtsam_unstable/discrete/examples/");
64 s.addArea(
"Harvey Lipkin",
"Mechanics");
65 s.addArea(
"Jun Ueda",
"Mechanics");
67 s.addArea(
"Patricio Vela",
"Controls");
68 s.addArea(
"Magnus Egerstedt",
"Controls");
69 s.addArea(
"Jun Ueda",
"Controls");
70 s.addArea(
"Panos Tsiotras",
"Controls");
71 s.addArea(
"Fumin Zhang",
"Controls");
73 s.addArea(
"Henrik Christensen",
"Perception");
74 s.addArea(
"Aaron Bobick",
"Perception");
76 s.addArea(
"Mike Stilman",
"AI");
78 s.addArea(
"Ayanna Howard",
"AI");
79 s.addArea(
"Charles Isbell",
"AI");
80 s.addArea(
"Tucker Balch",
"AI");
82 s.addArea(
"Ayanna Howard",
"Autonomy");
83 s.addArea(
"Charlie Kemp",
"Autonomy");
84 s.addArea(
"Tucker Balch",
"Autonomy");
85 s.addArea(
"Ron Arkin",
"Autonomy");
87 s.addArea(
"Andrea Thomaz",
"HRI");
88 s.addArea(
"Karen Feigh",
"HRI");
89 s.addArea(
"Charlie Kemp",
"HRI");
92 for (
size_t i = 0;
i < nrStudents;
i++)
117 SETDEBUG(
"DiscreteConditional::DiscreteConditional",
true);
125 for (
size_t i=0;
i<100;
i++) {
126 auto assignment = chordal->sample();
133 if (nz >= 13 &&
min >=1 &&
max <= 4) {
134 cout <<
"======================================================\n";
154 SETDEBUG(
"DiscreteConditional::COUNT",
true);
159 vector<double> slotsAvailable(
largeExample(0).nrTimeSlots(), 1.0);
184 size_t bestSlot = root->argmax();
189 values[dkey.first] = bestSlot;
190 size_t count = (*root)(
values);
193 slotsAvailable[bestSlot] = 0.0;
195 scheduler.
slotName(bestSlot) <<
" (" << bestSlot
196 <<
"), count = " << count << endl;
204 size_t slot, vector<Scheduler>& schedulers) {
207 SETDEBUG(
"Scheduler::buildGraph",
false);
210 schedulers.push_back(scheduler);
216 vector<Scheduler> schedulers;
217 vector<DiscreteBayesNet::shared_ptr> samplers(
NRSTUDENTS);
220 vector<size_t> slots{3, 20, 2, 6, 5, 11, 1, 4};
225 for (
size_t n = 0;
n < 500;
n++) {
226 vector<size_t>
stats(19, 0);
227 vector<DiscreteValues>
samples;
229 samples.push_back(samplers[
i]->sample());
235 if (nz >= 15 &&
max <= 2) {
236 cout <<
"Sampled schedule " << (
n + 1) <<
", min = " <<
min
237 <<
", nz = " << nz <<
", max = " <<
max << endl;
239 cout << schedulers[
i].studentName(0) <<
" : " << schedulers[
i].slotName(
const std::string & slotName(size_t s) const
#define tictoc_finishedIteration()
void accumulateStats(const DiscreteValues &assignment, std::vector< size_t > &stats) const
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
Scheduler largeExample(size_t nrStudents=NRSTUDENTS)
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 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)
void solveStaged(size_t addMutex=2)
const DiscreteKey & studentKey(size_t i) const
gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:35:02