So, I have 3 data sets as follows: Cost data:
Vcost
Out[325]:
P1 P2 P3
Vendors\Product List
V1 0.204403 0.208178 0.198216
V2 0.220126 0.213755 0.198991
V3 0.204403 0.191450 0.203258
Risk Data:
Vrisk
Out[326]:
P1 P2 P3
Vendors\Product List
V1 0.198598 0.210145 0.198157
V2 0.172897 0.178744 0.193548
V3 0.219626 0.200483 0.205069
Data of decision variables:
Vdecision
Out[327]:
P1 P2 P3
Vendors\Product List
V1 a b c
V2 f g h
V3 k l m
My goal is to minimize 0.71 * Cost * x + 0.29 * Risk * x is subject to the restrictions of summing rows and summing columns of the matrix of decision variables. So basically the goal of fuction will be something like this:
0.71*(0.204*a+0.208*b+0.198*c....+0.203*m) + 0.29*(0.198*a+0.210*b+0.198*c....+0.205*m)
I am trying to use the PuLP module and define the function as:
prob = LpProblem("Inventory Optimization", LpMinimize)
prob += lpSum([0.71*i*x for i,x in zip(Vcost.values,Vdecision.values) + 0.29*j*x for j,x in zip(Vrisk.values,Vdecision.values)])
But I get the following error:
TypeError: can't multiply sequence by non-int of type 'float'
Can someone help me formulate the objective function, please?
source
share