Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Docplex Solver Error: At least one floating-point variable is not fixed.

    Posted 07/26/22 03:49 PM
    Hi, 

    I am using Docplex to solve my CP model. I got this error, but I don't know what it means! I appreciate helping me in this regard. 

    Best,

    Saeede

    ------------------------------
    saeede hosseini
    ------------------------------

    #DecisionOptimization


  • 2.  RE: Docplex Solver Error: At least one floating-point variable is not fixed.

    Posted 07/27/22 03:45 AM
    Hi,

    with CPOptimizer float decision variables are not allowed so you should try to change your variables into expressions.

    See example from Making Optimization Simple with python
    from docplex.cp.model import CpoModel
    
    mdl = CpoModel(name='buses')
    
    #now suppose we can book a % of buses not only complete buses
    
    scale=100
    scalenbbus40 = mdl.integer_var(0,1000,name='scalenbBus40')
    scalenbbus30 = mdl.integer_var(0,1000,name='scalenbBus30')
    
    nbbus40= scalenbbus40 / scale
    nbbus30= scalenbbus30 / scale
    
     
    
    mdl.add(nbbus40*40 + nbbus30*30 >= 310)
    mdl.minimize(nbbus40*500 + nbbus30*400)
    
    msol=mdl.solve()
    
    print(msol[scalenbbus40]/scale," buses 40 seats")
    print(msol[scalenbbus30]/scale," buses 30 seats")
    ​


    ------------------------------
    [Alex] [Fleischer]
    [Data and AI Technical Sales]
    [IBM]
    ------------------------------



  • 3.  RE: Docplex Solver Error: At least one floating-point variable is not fixed.

    Posted 07/27/22 03:45 AM
    Hi,
    This error is related to the CPO optimization engine (it is not specific to docplex).
    I'm not sure how this error can happen in a docplex model... Can you share a small model that could reproduce this error ?
    For information, there is also this slightly related discussion which may provide you with some insights how this error can happen: https://community.ibm.com/community/user/datascience/discussion/cp-optimizer-and-floating-point-variables?ReturnUrl=%2Fcommunity%2Fuser%2Fdatascience%2Fcommunities%2Fcommunity-home%2Fdigestviewer

    Best regards,
    Hugues

    ------------------------------
    Hugues Juille
    ------------------------------