Replies: 2 comments
-
This is a wording error. The proposal assumes variable ids are compact, but this can easily be changed. A large number of variables should be not more of a problem to the interface than to the solver itself. The issue of non-compact variable ids is just an encoding issue and not so much our problem. It is not true that the solver has no way of determining which values have changed. This is exactly the purpose of the setter. Other ways of changing a value shall be prohibited. The only bigger issue that I see with dynamic (maxvar-bound) array-size is the missing getter. |
Beta Was this translation helpful? Give feedback.
-
Discussion notes:
|
Beta Was this translation helpful? Give feedback.
-
Current state
Currently, the configuration interface takes key/value pairs with values of type
void *
. As of https://github.com/ipasir2/interface/blob/71c6b421fec064614aaeb2e7ae27123a5eaf4f76/ipasir.h, the value pointer can point to buffers of enum, int, float or char values. The length of the buffer is fixed and determined by the solver (vialength
inipasir_option_type
), where alength
of 0 means an array of length equal to the number of variables in the formula.The use case for
length=0
is setting values per variable, e.g. initial weights. However, the current solution has a few pitfalls:calloc
(which typically supports lazy allocation of memory pages by the OS), since some problem instances use very large variable numbers.ipasir_solve()
.ipasir_add
. This requires clients to keep track of which variables have already been used withipasir_add
(in the original wording) or to add a trivially satisfied clause containing the maximum variable of the problem.Use Cases
(Rough) Proposal
Instead of supporting
length=0
, a dedicated function for per-variable options could be used, likevoid ipasir_set_option_for_var(void* S, char const* name, int var, void const* value)
.length = 0
should then be prohibited inipasir_option_type
.Alternative Proposal
We could add an additional parameter
size_t index
toipasir_set_option
.length = 0
would then mean that arbitrary values for indices can be used. The semantics of the index are defined by the option. Then, the pointer to the value passed toipasir_set_option
could always point to a single valueBeta Was this translation helpful? Give feedback.
All reactions