Open mmckerns opened 9 years ago
Probably a natural place for this "one-liner" is to augment the constructor (i.e __init__
) for each solver. Then there's no management of a new "stand-alone" function.
A natural place to add callback
is SetObjective
. It should the same sticky/non-sticky behavior as cost
. callback
, I believe, is the last of the settings
that need to be handled before Step
and Solve
are consistent when no settings
are passed in.
As a side note, it needs to be decided whether to treat sigint_callback
like callback
or to have it only accessible when Solve
is called.
Apparently when cost
is changed… it's ignored. That's not good. To fix this (bug), the thing to do might be to store both the "raw" and "wrapped" cost
in self._cost
. I'll create a new issue for this.
The self._cost
tuple may also be a good place to stash callback
. However, what does callback=None
mean (i.e. "turn off" callback
, or reuse the existing callback
)? It might be necessary to introduce callback=null
, where null
is a "null callback".
It would probably be cleaner to add callback
with SetStepCallback
, and also likely better to store the callback separately from the objective since it's never bound to the objective.
This could be super useful, but will keep bumping this for now.
It would be very useful to be able to have a solver "one-liner" that configures a solver but doesn't run it. For example:
diffev
could be run with:Similarly for
Step
. Solve should not require acost
orExtraArgs
, but should allow them.Additionally, all inputs to
Solve
andStep
should be able to be given through different methods so thatSolve
andStep
can be called with no arguments/keywords in all cases.