Hi, 

First of all, thanks for the fantastic open source library ! It has all I 
could dream of (export to latex etc...).

I use sympy to generate constraints of a linear programming problem. At the 
end of it, I want to find the solution for the system with 
https://github.com/coin-or/pulp, i.e., I want to convert my 
sympy.core.expr.Expr ( "x+y" etc..) into pulp.LpConstraint variables in 
order to do as in this tutorial: 
http://www.coin-or.org/PuLP/CaseStudies/a_blending_problem.html
===

# The five constraints are enteredprob += x1 + x2 == 100, "PercentagesSum"prob 
+= 0.100*x1 + 0.200*x2 >= 8.0, "ProteinRequirement"prob += 0.080*x1 + 0.100*x2 
>= 6.0, "FatRequirement"prob += 0.001*x1 + 0.005*x2 <= 2.0, 
"FibreRequirement"prob += 0.002*x1 + 0.005*x2 <= 0.4, "SaltRequirement"

===
So for instance in my code, I have a sympy expression 0.100*x1 + 0.200*x2 
but I want to substitute x1 and x2 by pulp.LpVariable (similar to sympy 
symbol) so that the sympy.core.expr.Expr becomes a pulp.LpAffineExpression.
So far, I believe my best option is to use Expr.as_coefficients_dict to 
rebuild the whole thing.

I wonder if there is a best option (even with another library than pulp, I 
don't care) to solve this (optimization) problem.

Best regards



-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/7e0b3040-3581-48c0-a2a8-eef8cf051d55%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to