Decision Optimization

 View Only
  • 1.  CPLEX Operator not available for {float} * {int}

    Posted Thu July 11, 2024 09:43 AM
    Edited by Omar Abbaas Sun July 14, 2024 08:42 PM

    Can you please take a look at the following piece of code and help me understand why I am getting the error below and how to fix it?

    {int} Q1=...;

    {float} q[CmRange]=...;

      
     dexpr float SVM = Q1* q[j]

    Error:

    Operator not available for {float} * {int}



  • 2.  RE: CPLEX Operator not available for {float} * {int}

    Posted Fri July 12, 2024 03:00 AM

    Hi,

    you mix sets and scalar values.

    Let me fix the objective to help you undestand.

    dexpr float SVM = 
     first(Q1)*(sum(j in CommunitiesRange, i in CandidateSitesRange)first(q[j])*n[j]*d[j][i]) 
     + first(Q2)*(sum(j in CommunitiesRange, i in CandidateSitesRange)first(l[i])*first(f[j])*n[j]*d[j][i]);
    

    would work fine.

    Q1 is a set. You can use an element of a set in an equation but not the set itself

    regards



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



  • 3.  RE: CPLEX Operator not available for {float} * {int}

    Posted Fri July 12, 2024 04:48 PM

    Thank you so much Alex!



    ------------------------------
    Omar Abbaas
    ------------------------------