MCPcopy Create free account
hub / github.com/cvanaret/Uno / uno_set_variable_upper_bound

Function uno_set_variable_upper_bound

interfaces/C/Uno_C_API.cpp:549–563  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

547}
548
549bool uno_set_variable_upper_bound(void* model, uno_int variable_index, double upper_bound) {
550 if (model == nullptr) {
551 WARNING << "Please specify a valid model." << std::endl;
552 return false;
553 }
554 CUserModel* user_model = static_cast<CUserModel*>(model);
555 // shift the index with the base indexing
556 variable_index -= user_model->base_indexing;
557 if (variable_index < 0 || variable_index >= user_model->number_variables) {
558 WARNING << "Please specify a valid index." << std::endl;
559 return false;
560 }
561 user_model->variables_upper_bounds[static_cast<size_t>(variable_index)] = upper_bound;
562 return true;
563}
564
565bool uno_set_objective(void* model, uno_int optimization_sense, uno_objective_callback objective_function,
566 uno_objective_gradient_callback objective_gradient) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected