pulp optimization problem,not getting expected output.
#1
|project|loc_Bangalore|loc_Pune|cat_s|cat_c|
|:------|:-----------:|:------:|:---:| ---:|
|abc    |1            |0       |0    |1    |
|Sys    |1            |0       |0    |1    |
|Syst   |0            |1       |1    |0    |
|EPS    |1            |0       |0    |1    |
|foss   |1            |0       |0    |1    |
|opc    |0            |1       |1    |0    |

> want list of projects,which should satisfy below condition:
   
 1. count of project related to loc_Bangalore <=3
 2. count of project related to loc_pune <=2
 3. count of project related to cat_c <=4
 4. count of project related to cat_s <=1
 5. total project selected <=5(final condition).

> whatever project will come in output it should fullfill all 5 condition.

I tried soe code:
 but not getting expected result.

    prob = LpProblem("choose project")
    project_list = list(df['project'])
    banglore = dict(zip(project_list,df['loc_Bangalore']))
    pune = dict(zip(project_list,df['loc_Pune']))
    c = dict(zip(project_list,df['cat_C']))
    s = dict(zip(project_list,df['cat_S']))
    proj_vars = pulp.LpVariable.dicts("project",project_list,cat='Binary')
    no_of_project_choose = 5
    prob += pulp.lpSum([banglore[f] * proj_vars[f] for f in project_list]) <= 3
    prob += pulp.lpSum([pune[f] * proj_vars[f] for f in project_list]) <=2
    prob += pulp.lpSum([c[f]  * proj_vars[f] for f in project_list]) <=4
    prob += pulp.lpSum([s[f]  * proj_vars[f] for f in project_list]) <=1
    prob += pulp.lpSum([[banglore[f] * proj_vars[f] for f in project_list]+[pune[f] * proj_vars[f] for f in project_list]+
         [c[f]  * proj_vars[f] for f in project_list]+[s[f]  * proj_vars[f] for f in project_list]]) <=5
    prob.solve()

> output:   abc 0.0,   sys 0.0,   syst None,   EPS 0.0 ,  foss 0.0 ,  opc
> None(i am getting all project with 0 or some number line abc 9)

Pls help me in solving this.I want only project which satisfy other condition also(like banglore, pune,c and s).
is there anyother way of solving this?
i m not sue about my solution and way of solving.plz help.
Reply
#2
Hi @pallavi@76,

I have no clue what your are talking about but I am pretty sure this is the wrong forum for your question. This forum is related to PULP, the parallel ultra low power platform, which is a project that aims to develop open source low power processor architectures and digital IPs in general. Your question seems to be related to some python project.

Best,
Manuel
Reply


Forum Jump: