Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Constraint programming to find all feasible solutions in docplex python

    Posted 04/06/20 06:42 AM

    Originally posted by: KeerthivasanC


    I have the following data for a scheduling problem:

    df_project

    Project Teams Needed
    A 6
    B 4
    C 5
    D 2
    E 1

     

    df_timeperiod

    Time Period Max. Teams Allowed
    TP1 2
    TP2 4
    TP3 6
    TP4 8

     

    Here is what I have coded so far:

     

    project = []

    project = list(df_project['Project'])

     

    TP1 = m.integer_var_dict(name = "TP1",keys=project)
    TP2 = m.integer_var_dict(name = "TP2",keys=project)
    TP3 = m.integer_var_dict(name = "TP3",keys=project)
    TP4 = m.integer_var_dict(name = "TP4",keys=project)

     

    m.add_constraint(TP1['A'] + TP2['A'] + TP3['A'] + TP4['A'] == 6)
    m.add_constraint(TP1['B'] + TP2['B'] + TP3['B'] + TP4['B'] == 4)
    m.add_constraint(TP1['C'] + TP2['C'] + TP3['C'] + TP4['C'] == 5)
    m.add_constraint(TP1['D'] + TP2['D'] + TP3['D'] + TP4['D'] == 2)
    m.add_constraint(TP1['E'] + TP2['E'] + TP3['E'] + TP4['E'] == 6)

     

    m.add_constraint(TP1['A'] + TP1['B'] + TP1['C'] + TP1['D'] + TP1['E'] == 2)
    m.add_constraint(TP2['A'] + TP2['B'] + TP2['C'] + TP2['D'] + TP2['E'] == 4)
    m.add_constraint(TP3['A'] + TP3['B'] + TP3['C'] + TP3['D'] + TP3['E'] == 6)
    m.add_constraint(TP4['A'] + TP4['B'] + TP4['C'] + TP4['D'] + TP4['E'] <= 8)

     

    I also want to make sure that [TP1[i] for i in project] takes values from this list - [0,0.5,1,1.5,2] given TP1 can't have more than 2 teams assigned to it. set_domain is only possible for integer variables as I understand. So, is there a way to do this?

     

    Coming to my main question, how I can generate a large number of feasible solutions to this problem? I would appreciate a code snippet which uses solution pool to do this.

     

     

    Thanks.


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Constraint programming to find all feasible solutions in docplex python



  • 3.  Re: Constraint programming to find all feasible solutions in docplex python

    Posted 04/06/20 08:51 AM

    Originally posted by: KeerthivasanC


    Hey Alex
    Thanks for the reply. I did the see that post and your answer on Stackoverflow as well on the same topic. I am having trouble doing the same for my constraint programming object. Both the posts refer to integer programming solution pools. And one more question:

     

    Let' say I want my continuous decision variable to take values only from the list - [0,0.5,1,1.5,2]. How would I code this? 


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Constraint programming to find all feasible solutions in docplex python