MCPcopy Create free account
hub / github.com/ERGO-Code/HiGHS / fullApiOptions

Function fullApiOptions

check/TestCAPI.c:719–860  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

717}
718
719void fullApiOptions() {
720 void* highs;
721
722 highs = Highs_create();
723 Highs_setBoolOptionValue(highs, "output_flag", dev_run);
724
725 const double kHighsInf = Highs_getInfinity(highs);
726 HighsInt simplex_scale_strategy;
727 HighsInt return_status;
728 return_status = Highs_getIntOptionValue(highs, "simplex_scale_strategy",
729 &simplex_scale_strategy);
730 assert(return_status == kHighsStatusOk);
731 if (dev_run)
732 printf("simplex_scale_strategy = %" HIGHSINT_FORMAT ": setting it to 3\n",
733 simplex_scale_strategy);
734 simplex_scale_strategy = 3;
735 return_status = Highs_setIntOptionValue(highs, "simplex_scale_strategy",
736 simplex_scale_strategy);
737
738 const HighsInt presolve_index = 0;
739 char* name = NULL;
740 return_status = Highs_getOptionName(highs, presolve_index, &name);
741 if (dev_run)
742 printf("option %" HIGHSINT_FORMAT " has name %s\n", presolve_index, name);
743 const char* presolve = "presolve";
744 assert(*name == *presolve);
745 free(name);
746
747 HighsInt check_simplex_scale_strategy;
748 HighsInt min_simplex_scale_strategy;
749 HighsInt max_simplex_scale_strategy;
750 HighsInt default_simplex_scale_strategy;
751 return_status =
752 Highs_getIntOptionValues(highs, "scale_strategy", NULL, NULL, NULL, NULL);
753 assert(return_status == kHighsStatusError);
754 return_status = Highs_getDoubleOptionValues(highs, "simplex_scale_strategy",
755 NULL, NULL, NULL, NULL);
756 assert(return_status == kHighsStatusError);
757 return_status = Highs_getIntOptionValues(
758 highs, "simplex_scale_strategy", &check_simplex_scale_strategy,
759 &min_simplex_scale_strategy, &max_simplex_scale_strategy,
760 &default_simplex_scale_strategy);
761 assert(return_status == kHighsStatusOk);
762 assert(check_simplex_scale_strategy == simplex_scale_strategy);
763 assert(min_simplex_scale_strategy == 0);
764 assert(max_simplex_scale_strategy == 4);
765 assert(default_simplex_scale_strategy == 2);
766
767 // There are some functions to check what type of option value you should
768 // provide.
769 HighsInt option_type;
770 return_status =
771 Highs_getOptionType(highs, "simplex_scale_strategy", &option_type);
772 assert(return_status == kHighsStatusOk);
773 assert(option_type == kHighsOptionTypeInt);
774 return_status = Highs_getOptionType(highs, "bad_option", &option_type);
775 assert(return_status == kHighsStatusError);
776

Callers 1

mainFunction · 0.85

Calls 15

Highs_createFunction · 0.85
Highs_setBoolOptionValueFunction · 0.85
Highs_getInfinityFunction · 0.85
Highs_getIntOptionValueFunction · 0.85
Highs_setIntOptionValueFunction · 0.85
Highs_getOptionNameFunction · 0.85
Highs_getIntOptionValuesFunction · 0.85
Highs_getOptionTypeFunction · 0.85

Tested by

no test coverage detected