Print solution
| 294 | |
| 295 | /// Print solution |
| 296 | virtual void |
| 297 | print(std::ostream& os) const { |
| 298 | os << "What slab=" << slab << std::endl; |
| 299 | os << "Slab load=" << slabload << std::endl; |
| 300 | os << "Slab cost=" << slabcost << std::endl; |
| 301 | os << "Total cost=" << total_cost << std::endl; |
| 302 | int nslabsused = 0; |
| 303 | int nslabscost = 0; |
| 304 | bool unassigned = false; |
| 305 | for (int i = nslabs; i--; ) { |
| 306 | if (!slabload[i].assigned() || !slabcost[i].assigned()) { |
| 307 | unassigned = true; |
| 308 | break; |
| 309 | } |
| 310 | if (slabload[i].min()>0) ++nslabsused; |
| 311 | if (slabcost[i].min()>0) ++nslabscost; |
| 312 | } |
| 313 | if (!unassigned) |
| 314 | os << "Number of slabs used=" << nslabsused |
| 315 | << ", slabs with cost=" << nslabscost |
| 316 | << std::endl; |
| 317 | os << std::endl; |
| 318 | } |
| 319 | |
| 320 | /// Constructor for cloning \a s |
| 321 | SteelMill(SteelMill& s) |