Search code examples
cplexopl

How can I write a objective function of p center problem in cplex?


I want to write a code of an OPL model. This model is about p center problems. The objective function of this model is as same as p median problem, except that we need to minimize the maximum weighted distance instead of minimize the sum of total weighted distance. Do you have any idea how can I write this objective function in cplex?


Solution

  • If you start with pmedian from

    https://www.ibm.com/support/knowledgecenter/SSSA5P_12.6.0/ilog.odms.ide.help/OPL_Studio/oplquickstart/topics/opl_quickstart_pmedian.html

    What you can do is simply turn « sum » in the objective to « max »

    minimize 
      max ( c in Customers , w in Warehouses ) 
        Demand[c]*Distance[c][w]*ShipToCustomer[c][w];