help-glpk
[Top][All Lists]

## Re: [Help-glpk] KPI simple function

 From: Simone Atzeni Subject: Re: [Help-glpk] KPI simple function Date: Sat, 24 Oct 2009 12:50:49 +0200

```Hi Xypron,

I'm sorry for disturbing you again.

Following your suggestion, I created this model:

var Z1;
var Z2;
var U;

maximize obj : 0.18 * Z1 + 0.82 * Z2;
#maximize obj : 0.5 * Z1 + 0.5 * Z2;

s.t. c1 : 20 * Z1 + 110 * U <= 83; # (0.3,0.7)-(0.85,0.6)
s.t. c2 : 28 * Z1 - 8 * U <= 19; # (0.85,0.6)-(0.75,0.25)
s.t. c3 : 4 * Z1 + 40 * U >= 13; # (0.75,0.25)-(0.25,0.3)
s.t. c4 : 80 * Z1 - 10 * U >= 17; # (0.25,0.3)-(0.3,0.7)

s.t. c5 : 40 * Z2 - 5 * U >= 9; # (0.25,0.2)-(0.3,0.6)
s.t. c6 : 30 * Z2 - 110 * U >= - 57; # (0.3,0.6)-(0.85,0.75)
s.t. c7 : 80 * Z2 - 20 * U <= 53; # (0.85,0.75)-(0.75,0.35)
s.t. c8 : 12 * Z2 - 40 * U <= -5; # (0.75,0.35)-(0.25,0.2)

solve;
printf "U =%6.3f, Z1 = %6.3f, Z2 = %6.3f\n", U, Z1, Z2;
end;

```
When I try to solve this problem I get the same solution whatever is the objective function, but I need that when I change the objective function the result is different.
```The real problem is this:

```
U is an action and Z1 and Z2 are two KPIs that depend on U. I'm looking for just a model to represent this in a simple way to finish my project. Sadly, I don't have the real KPI.
```
Thanks
Simone

On 23/ott/09, at 19:31, xypron wrote:

```
```
Hello Simone,

There was a typo
s.t. c4 : y     >=0; # (3,0)-(0,0)

Best regards

Xypron

xypron wrote:
```
```
Hello Simone,

if the solution of a linear program is unique, it will always be in a
vertex of the
convex polyeder described by the constraints.

```
The objective function gives the optimization direction and hence decides
```which
vertex of the polygon is the solution.

For a two dimensional problem lets think of an polygon given by the
following vertices:
(0,0) (1,1) (2,1) (3,0)
This corresponds to the following inequalities:
s.t. c1 : x - y >= 0; # (0,0)-(1,1)
s.t. c2 : y     <= 1; # (1,1)-(2,1)
s.t. c3 : x + y <= 3; # (2,1)-(3,0)
s.t. c4 : x     >=0; # (3,0)-(0,0)

If our optimization direction is (1,1) the objective is
maximize obj : x + y;
The solution is vertex (2,1)

If our optimization direction is (-1,1) the objective is
maximize obj: -x + y;
The solution is vertex (1,1);

The complete model is:

var x;
var y;

# uncomment the appropriate objective
#maximize obj :  x + y; # direction (1,1);
maximize obj : -x + y; # direction (-1,1);

s.t. c1 : x - y >= 0; # (0,0)-(1,1)
s.t. c2 : y     <= 1; # (1,1)-(2,1)
s.t. c3 : x + y <= 3; # (2,1)-(3,0)
s.t. c4 : x     >=0; # (3,0)-(0,0)
solve;
printf "x = %6.3f, y = %6.3f\n", x, y;
end;

Best regards

Xypron

Simone Atzeni wrote:
```
```
Hi all,

I'm looking for two functions that could represent simple KPIs.

In other world, I would like two MILP, in this way:

MILP 1:

MAX J = 0.5 * Z1 + 0.5 * Z2

Z1 = -AX + C
Z2 = BX + D

and

MILP 2:

MAX J = 0.32 * Z1 + 0.68 * Z2

Z1 = -AX + C
Z2 = BX + D

Z1 and Z2 are the values of the KPI and they depend on X. The
```
constraints should be equal but the results (the values of Z1 and Z2)
```should be different changing the coefficients fo the objective
```
function, in this case (0.5 - 0.5) for the MILP1 and (0.32 - 0.68) for
```the MILP 2.

I can't find a good function. I need just functions where Z1 and Z2
depend on X but changing the coefficients in the objective functions
change the values of Z1, Z2 and X.

MILPs I'm using are the follow:

MAX J = 0.5 Z.1 + 0.5 Z.2

Z.1 = 5X (0.196116135138184 Z.1 - 0.98058067569092 U.1 <= 0) (the
equations have been normalized)
Z.2 = -3X + 4 (0.196116135138184 Z.2 + 0.115384615384615 U.1 <=
0.153846153846154)

and

MAX J = 0.32 Z.1 + 0.68 Z.2

Z.1 = 5X
Z.2 = -3X + 4

This is the picture of the two functions:

Both MILPs have the same solution.

Z.1 = 1
Z.2 = 0.666795
X = 0.2

```
In this case the weights, (0.5 - 0.5) for the MILP1 and (0.32 - 0.68)
```for the MILP 2, don't influence the results of the MILP. I want
```
something in a way that the weights influence the results, so that the
```two MILPs have different result but they should being equal.

Can someone help me?

Thanks
Simone

_______________________________________________
Help-glpk mailing list
http://lists.gnu.org/mailman/listinfo/help-glpk

```
```

```
```
--
View this message in context:
http://www.nabble.com/KPI-simple-function-tp26025826p26030427.html
Sent from the Gnu - GLPK - Help mailing list archive at Nabble.com.

_______________________________________________
Help-glpk mailing list
```