@@ -23,44 +23,44 @@ BinTypeId InstanceBuilder::add_bin_type(
2323{
2424 if (x <= 0 ) {
2525 throw std::invalid_argument (
26- " packingsolver::box::InstanceBuilder::add_bin_type : "
26+ FUNC_SIGNATURE + " : "
2727 " bin 'x' must be > 0; "
2828 " x: " + std::to_string (x) + " ." );
2929 }
3030 if (y <= 0 ) {
3131 throw std::invalid_argument (
32- " packingsolver::box::InstanceBuilder::add_bin_type : "
32+ FUNC_SIGNATURE + " : "
3333 " bin 'y' must be > 0; "
3434 " y: " + std::to_string (y) + " ." );
3535 }
3636 if (z <= 0 ) {
3737 throw std::invalid_argument (
38- " packingsolver::box::InstanceBuilder::add_bin_type : "
38+ FUNC_SIGNATURE + " : "
3939 " bin 'z' must be > 0; "
4040 " z: " + std::to_string (z) + " ." );
4141 }
4242 if (cost <= 0 && cost != -1 ) {
4343 throw std::invalid_argument (
44- " packingsolver::box::InstanceBuilder::add_bin_type : "
44+ FUNC_SIGNATURE + " : "
4545 " bin 'cost' must be > 0 (or == -1); "
4646 " cost: " + std::to_string (cost) + " ." );
4747 }
4848 if (copies_min < 0 ) {
4949 throw std::invalid_argument (
50- " packingsolver::box::InstanceBuilder::add_bin_type : "
50+ FUNC_SIGNATURE + " : "
5151 " bin 'copies_min' must be >= 0; "
5252 " copies_min: " + std::to_string (copies_min) + " ." );
5353 }
5454 if (copies != -1 ) {
5555 if (copies <= 0 ) {
5656 throw std::invalid_argument (
57- " packingsolver::box::InstanceBuilder::add_bin_type : "
57+ FUNC_SIGNATURE + " : "
5858 " bin 'copies' must be > 0 (or == -1); "
5959 " copies: " + std::to_string (copies) + " ." );
6060 }
6161 if (copies_min > copies) {
6262 throw std::invalid_argument (
63- " packingsolver::box::InstanceBuilder::add_bin_type : "
63+ FUNC_SIGNATURE + " : "
6464 " bin 'copies_min' must be <= 'copies'; "
6565 " copies: " + std::to_string (copies) + " ; "
6666 " copies_min: " + std::to_string (copies_min) + " ." );
@@ -84,7 +84,7 @@ void InstanceBuilder::set_bin_type_maximum_weight(
8484{
8585 if (bin_type_id < 0 || bin_type_id >= instance_.bin_types_ .size ()) {
8686 throw std::invalid_argument (
87- " packingsolver::box::InstanceBuilder::set_bin_type_maximum_weight : "
87+ FUNC_SIGNATURE + " : "
8888 " invalid 'bin_type_id'; "
8989 " bin_type_id: " + std::to_string (bin_type_id) + " ; "
9090 " instance_.bin_types_.size(): " + std::to_string (instance_.bin_types_ .size ()) + " ." );
@@ -172,25 +172,25 @@ ItemTypeId InstanceBuilder::add_item_type(
172172{
173173 if (x < 0 ) {
174174 throw std::invalid_argument (
175- " packingsolver::box::InstanceBuilder::add_item_type : "
175+ FUNC_SIGNATURE + " : "
176176 " item 'x' must be > 0; "
177177 " x: " + std::to_string (x) + " ." );
178178 }
179179 if (y < 0 ) {
180180 throw std::invalid_argument (
181- " packingsolver::box::InstanceBuilder::add_item_type : "
181+ FUNC_SIGNATURE + " : "
182182 " item 'y' must be > 0; "
183183 " y: " + std::to_string (y) + " ." );
184184 }
185185 if (z < 0 ) {
186186 throw std::invalid_argument (
187- " packingsolver::box::InstanceBuilder::add_item_type : "
187+ FUNC_SIGNATURE + " : "
188188 " item 'z' must be > 0; "
189189 " z: " + std::to_string (z) + " ." );
190190 }
191191 if (copies <= 0 ) {
192192 throw std::invalid_argument (
193- " packingsolver::box::InstanceBuilder::add_item_type : "
193+ FUNC_SIGNATURE + " : "
194194 " item 'copies' must be > 0; "
195195 " copies: " + std::to_string (copies) + " ." );
196196 }
@@ -212,7 +212,7 @@ void InstanceBuilder::set_item_type_weight(
212212{
213213 if (item_type_id < 0 || item_type_id >= instance_.item_types_ .size ()) {
214214 throw std::invalid_argument (
215- " packingsolver::box::InstanceBuilder::set_item_type_weight : "
215+ FUNC_SIGNATURE + " : "
216216 " invalid 'item_type_id'; "
217217 " item_type_id: " + std::to_string (item_type_id) + " ; "
218218 " instance_.item_types_.size(): " + std::to_string (instance_.item_types_ .size ()) + " ." );
@@ -323,7 +323,8 @@ void InstanceBuilder::read_parameters(
323323 std::ifstream f (parameters_path);
324324 if (parameters_path != " " && !f.good ()) {
325325 throw std::runtime_error (
326- " Unable to open file \" " + parameters_path + " \" ." );
326+ FUNC_SIGNATURE + " : "
327+ " unable to open file \" " + parameters_path + " \" ." );
327328 }
328329
329330 std::string tmp;
@@ -359,7 +360,8 @@ void InstanceBuilder::read_bin_types(
359360 std::ifstream f (bins_path);
360361 if (!f.good ()) {
361362 throw std::runtime_error (
362- " Unable to open file \" " + bins_path + " \" ." );
363+ FUNC_SIGNATURE + " : "
364+ " unable to open file \" " + bins_path + " \" ." );
363365 }
364366
365367 std::string tmp;
@@ -400,15 +402,18 @@ void InstanceBuilder::read_bin_types(
400402
401403 if (x == -1 ) {
402404 throw std::runtime_error (
403- " Missing \" X\" column in \" " + bins_path + " \" ." );
405+ FUNC_SIGNATURE + " : "
406+ " missing \" X\" column in \" " + bins_path + " \" ." );
404407 }
405408 if (y == -1 ) {
406409 throw std::runtime_error (
407- " Missing \" Y\" column in \" " + bins_path + " \" ." );
410+ FUNC_SIGNATURE + " : "
411+ " missing \" Y\" column in \" " + bins_path + " \" ." );
408412 }
409413 if (z == -1 ) {
410414 throw std::runtime_error (
411- " Missing \" Z\" column in \" " + bins_path + " \" ." );
415+ FUNC_SIGNATURE + " : "
416+ " missing \" Z\" column in \" " + bins_path + " \" ." );
412417 }
413418
414419 BinTypeId bin_type_id = add_bin_type (
@@ -430,7 +435,8 @@ void InstanceBuilder::read_item_types(
430435 std::ifstream f (items_path);
431436 if (!f.good ()) {
432437 throw std::runtime_error (
433- " Unable to open file \" " + items_path + " \" ." );
438+ FUNC_SIGNATURE + " : "
439+ " unable to open file \" " + items_path + " \" ." );
434440 }
435441
436442 std::string tmp;
@@ -470,15 +476,18 @@ void InstanceBuilder::read_item_types(
470476
471477 if (x == -1 ) {
472478 throw std::runtime_error (
473- " Missing \" X\" column in \" " + items_path + " \" ." );
479+ FUNC_SIGNATURE + " : "
480+ " missing \" X\" column in \" " + items_path + " \" ." );
474481 }
475482 if (y == -1 ) {
476483 throw std::runtime_error (
477- " Missing \" Y\" column in \" " + items_path + " \" ." );
484+ FUNC_SIGNATURE + " : "
485+ " missing \" Y\" column in \" " + items_path + " \" ." );
478486 }
479487 if (z == -1 ) {
480488 throw std::runtime_error (
481- " Missing \" Z\" column in \" " + items_path + " \" ." );
489+ FUNC_SIGNATURE + " : "
490+ " missing \" Z\" column in \" " + items_path + " \" ." );
482491 }
483492
484493 if (profit == -1 )
@@ -569,14 +578,14 @@ Instance InstanceBuilder::build()
569578 if (instance_.objective () == Objective::OpenDimensionX
570579 && instance_.number_of_bins () != 1 ) {
571580 throw std::invalid_argument (
572- " packingsolver::box::InstanceBuilder::build : "
581+ FUNC_SIGNATURE + " : "
573582 " the instance has objective OpenDimensionX and contains " + std::to_string (instance_.number_of_bins ()) + " bins; "
574583 " an instance with objective OpenDimensionX must contain exactly one bin." );
575584 }
576585 if (instance_.objective () == Objective::OpenDimensionY
577586 && instance_.number_of_bins () != 1 ) {
578587 throw std::invalid_argument (
579- " packingsolver::box::InstanceBuilder::build : "
588+ FUNC_SIGNATURE + " : "
580589 " the instance has objective OpenDimensionY and contains " + std::to_string (instance_.number_of_bins ()) + " bins; "
581590 " an instance with objective OpenDimensionY must contain exactly one bin." );
582591 }
0 commit comments