Problem with various type in linear programming [closed]

asked 2022-09-02 16:28:33 +0200

Cyrille gravatar image

The following program is well defined

f(x) = 4*x-0.9*x^2
pas=1# 0.5,0.25
X=[n(pas*i,14) for i in range(0,Integer(lr/pas))]
pente=[diff(f(x),x).subs(x=X[i]) for i in range(0,Integer(lsp))]
optim_1 = MixedIntegerLinearProgram(maximization=False, solver = "GLPK")
x = optim_1.new_variable(integer=False, indices=[0..len(X)+1]) # les nouvelles variables seront x[1]... x[7]}
for i in range(0, len(X)):

but unfortunatelly for me the constraints are


But in that case, I raise the error unsupported operand parent(s) for +: 'Linear functions over Real Double Field' and 'Symbolic Ring'. I perfectly uderstand the problem but I do not know. I do not know in what type to transform f(X[i]), if this is the problem.

edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by tmonteil
close date 2022-09-02 16:39:24.519292