-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to set Solver Specific Parameter for XPRESS in JAVA #4208
Comments
try with \n after each parameter |
Still not working. @lperron |
This is the code. You can try to reverse engineer what it parses :-)
PS: we did not write it. This is an external contribution.
```c++
bool XpressInterface::SetSolverSpecificParametersAsString(
const std::string& parameters) {
if (parameters.empty()) return true;
std::vector<std::pair<std::string, std::string> > paramAndValuePairList;
std::stringstream ss(parameters);
std::string paramName;
while (std::getline(ss, paramName, ' ')) {
std::string paramValue;
if (std::getline(ss, paramValue, ' ')) {
paramAndValuePairList.push_back(std::make_pair(paramName, paramValue));
} else {
LOG(ERROR) << "No value for parameter " << paramName << " : function "
<< __FUNCTION__ << std::endl;
return false;
}
}
ScopedLocale locale;
for (auto& paramAndValuePair : paramAndValuePairList) {
setParamIfPossible_MACRO(mapIntegerControls_, XPRSsetintcontrol, std::stoi);
setParamIfPossible_MACRO(mapDoubleControls_, XPRSsetdblcontrol, std::stod);
setParamIfPossible_MACRO(mapStringControls_, XPRSsetstrcontrol,
stringToCharPtr);
setParamIfPossible_MACRO(mapInteger64Controls_, XPRSsetintcontrol64,
std::stoll);
LOG(ERROR) << "Unknown parameter " << paramName << " : function "
<< __FUNCTION__ << std::endl;
return false;
}
return true;
}
```
|
Hello @SnehasishChar Here is an example in Java : solver.setSolverSpecificParametersAsString(solverParams);
MPSolverParameters params = new MPSolverParameters();
params.setDoubleParam(MPSolverParameters.DoubleParam.PRIMAL_TOLERANCE, eps1); // FEASTOL
params.setDoubleParam(MPSolverParameters.DoubleParam.DUAL_TOLERANCE, eps2); // OPTIMALITYTOL
solver.solve(params); Hope this helps! PS: this is currently true for all XPRESS parameters that can be set through MPSolverParameters, not only these 2 @lperron I just saw this, don't hesitate to tag us next time :) |
Version: 9.9.3963
Language: Java
Solver: XPRESS
OS: Windows
I am trying to update the value of the control parameters of XPRESS solver to improve the performance. But the values are not updating accordingly for some specific parameter..
I am trying to update in the following way:
The values that are not getting set is as follows:
The text was updated successfully, but these errors were encountered: