gbionics / gbionics/qpsolvers-eigen

Add method to set many parameters by passing a single string

Open
#8 6 comments 2 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
38
Forks
5
PR merge metrics
No merged PRs in 30d

Description

For integrating with https://github.com/robotology/wb-toolbox, we need some way to pass arbitrary parameters (as we do not know in advance the parameters that will be available in a given solver) via single string.

For example, in place of:

~~~cxx
// Set osqp-specific parameters
solver.setBooleanParameter("verbose", true);
if (solver.getSolverName() == "osqp")
{
solver.setRealNumberParameter("alpha", 1.0);
// See https://github.com/robotology/osqp-eigen/pull/172
solver.setBooleanParameter("polish", true);
}
~~~

we could use either a json string:
~~~cxx
solver.setParametersViaJsonString("{\"verbose\": true, \"alpha\": 1.0, \"polish\": true}");
~~~

or toml inline table (https://toml.io/en/v1.0.0#inline-table):

~~~cxx
solver.setParametersViaTomlString("parameters = { verbose = true, alpha = 1.0, polish=true }");
~~~

I am inclined more to the toml inline table, as there are less double quotes involved (none if you do not use string parameters) and potentially is more easy to integrate (and copy&paste back and forth) parameters from BLF's ParamHandler Toml backend.

Probably we can also provide a setting on either ignore or raise an error if an unknown setting is passed, as there are use case for both cases: one one hand ignoring unknown parameters make it simple to have a single string with settings for multiple solvers, so switching solvers only requires changing the solver name, but it opens the door of bugs caused by typos, that can be prevented if one specifies that unknown parameters should raise an error.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.