constraint programming - Solving equations as CSP -


i have set of equations. have set of values , results equation. like:

a + b + c = x 

and allocation might be:

1 + 1 + 1 = 3  2 + 3 + 4 = 9 

however, actual equations longer , may contain functions, example logarithms.

i need alter result of given set in way (1) equation becomes equal specific value xx , (2) parameters change little possible.

i thought solve csp altering eqation to

(a + ax) + (b + bx) + (c + cx) = xx 

where a, b , c correspond old values , ax, bx , cx differences need applied corresponding old values. , xx result want equation have. note a, b, c, xa, xb, cx etc. integer values , xx within distance x, i.e. xx - d < x < xx + d.

in csp a, b, c , xx treated problem facts, ax, bx, cx treated planning variable , equation (a + ax) + (b + bx) + (c + cx) = xx hard constraint. minimizing of ax, ab, ac soft constraint. don't see planning entity here.

global hardsoftscoreholder scoreholder;   rule "changeisbad"     when         deltavariable($delta : delta)             scoreholder.addsoftconstraintmatch(kcontext, -math.abs(delta)); end  rule "equationmustbeequal"     // no idea? end 

but can't figure out how go on here. optaplanner feasible kind of problem? seems planningvariables have come list , have instances, whereas have integer values. model correct?

you can wrap each integer variable in entity class, this:

@planningentity public class myentity {     private integer myvariable;     @planningvariable(...)    public integer getmyvariable() {...}    ... } 

additionally, use planning entity range define range of each variable (because differs per entity), see official docs section "4.3.5.2.2. valuerangeprovider on planning entity" (and don't use swapmove's, changemove's guess).

but overall, not 100% sure if right tool job. interested know experience use case results into.

ps: starting 6.1.0.beta1 (not yet released, nightlies available), have intvaluerange documented in nightly docs in section "4.3.5.2.4. valuerangefactory", more efficient these kinds of use cases.


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -