MCPcopy Create free account
hub / github.com/Gecode/gecode / print

Method print

examples/multi-bin-packing.cpp:207–225  ·  view source on GitHub ↗

Print solution

Source from the content-addressed store, hash-verified

205 }
206 /// Print solution
207 virtual void
208 print(std::ostream& os) const {
209 os << "\tInstance: " << spec.iname() << std::endl;
210 if (bin.assigned()) {
211 for (int j=0; j<spec.bins(); j++) {
212 os << "\tbin[" << j << "]: ";
213 for (int i=0; i<spec.items(); i++)
214 if (bin[i].val() == j)
215 os << i << " ";
216 os << "\n\t\tloads: ";
217 for (int k=0; k<spec.dimension(); k++)
218 os << load[j*spec.dimension()+k] << " ";
219 os << std::endl;
220 }
221 } else {
222 os << "\tbins: " << bin << std::endl
223 << "\tload: " << load << std::endl;
224 }
225 }
226};
227
228/** \brief Main-function

Callers

nothing calls this directly

Calls 6

inameMethod · 0.80
binsMethod · 0.80
dimensionMethod · 0.80
assignedMethod · 0.45
itemsMethod · 0.45
valMethod · 0.45

Tested by

no test coverage detected