Hello,
I am trying to code this program
And I wrote this code, but I don't know how I can define matrix as a variable. Can you please show me how can I define matrix as a variable in Pulp
I am trying to code this program
Quote:Find y ∈R^m
minimising y·ve
subject to M'*y ≥ 1 and y ≥ 0
And I wrote this code, but I don't know how I can define matrix as a variable. Can you please show me how can I define matrix as a variable in Pulp
import pulp as p # Create a LP Minimization problem Lp_prob = p.LpProblem('Problem', p.LpMinimize) # Create problem Variables y = p.LpVariable("y", lowBound = 0) # Create a variable y >= 0. Here y is the matrix # Objective Function Lp_prob += y*ve #ve is the matrix # Constraints: Lp_prob +=M.T*y >= 1 #M is the (64*64)matrix Lp_prob += y>=0 # Display the problem print(Lp_prob) status = Lp_prob.solve() # Solver print(p.LpStatus[status]) # The solution status # Printing the final solution print(p.value(x), p.value(y), p.value(Lp_prob.objective))And my second problem is that:
Quote:Lp_prob = p.LpProblem('Problem', p.LpMinimize)How can I solve this problem?
AttributeError: 'float' object has no attribute 'LpProblem'