[Cmpl] objective function with a percentage (divisor)

James Carlson jddcarlson at gmail.com
Fri Nov 24 22:10:14 EST 2017


good evening, I am new to CMPL.  I took several LP and combination
optimization courses in university - in other words I am very new to this!
I have successfully created a model in SolverStudio and the results seem
reasonable.  I am now attempting to change the objective function so the
that difference between the delivered volume versus the demand is a ratio
(or absolute).  Attached is my model:
------------------------------------------------------------------------------------------------------------------------------------------
%data : sources set, destinations set, s[sources], d[destinations],
c[sources,destinations]
%display nonZeros

parameters:
    { i in sources , j in destinations: costs[i,j]:= c[i,j]*d[j]; }

variables:
    x[sources,destinations]: binary;

objectives:
    Total_cost: sum{i in sources, j in destinations : costs[i,j] * x[i,j]} +
                sum{i in sources  : sum{j in destinations: d[j]*x[i,j]} -
s[i]}  ->min;

constraints:
    supplies {i in sources  : sum{j in destinations: d[j]*x[i,j]} >=
s[i]*0.8;}
    demands  {j in destinations : sum{i in sources : x[i,j]} =  1;}
------------------------------------------------------------------------------------------------------------------------------------------

I would like to try something like this for my objectives:

    Total_cost: sum{i in sources, j in destinations : costs[i,j] * x[i,j]} +
                sum{i in sources  : sum{j in destinations: d[j]*x[i,j]} -
s[i]}*/s[i]*  ->min;

As i mentioned above I am attempting to make the OF minimize the error as a
percentage delivered to each destination.  This is meant to overcome the
problem of an under or over delivery is offset by an equal (negative or
positive) amount so the function is not really minimizing the value (it is
always almost zero due to aggregation of offsetting positive and negative
values).

Attached is an OpenSolver excel model (in a zip file).  Please note I have
made all the costs equal to 1 to better diagnose the OF's second term.

Any suggestions would be appreciated!  thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/cmpl/attachments/20171124/0ea0ac59/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tester.zip
Type: application/zip
Size: 15401 bytes
Desc: not available
URL: <http://list.coin-or.org/pipermail/cmpl/attachments/20171124/0ea0ac59/attachment.zip>


More information about the Cmpl mailing list