Skip to content
This repository has been archived by the owner on Sep 11, 2019. It is now read-only.

Commit

Permalink
Upload problema con opportuni fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxelweb committed Aug 2, 2019
1 parent 255af1e commit cd27886
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 22 deletions.
4 changes: 2 additions & 2 deletions qcloud.dat
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ H 18
D 9
V1 4
V2 6
V3 0
V4 4
V3 1
V4 9
V5 2
V6 1
V7 3
Expand Down
65 changes: 45 additions & 20 deletions qcloud.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
# ==============================




# Insiemi del modello

set I; # tipi di server
Expand Down Expand Up @@ -40,7 +38,8 @@ check{i in I} : Peso[i] >= 0;
check{i in I} : Costo[i] > 0;

# Controlla che le richieste non siano maggiori di quello che i nodi possono offrire
check : sum{j in J} Risorse[j] >= sum{i in I} Peso[i]*Richieste[i]; # importante!
# importante!
check : sum{j in J} (Risorse[j]+5*Virtual[j]) >= sum{i in I} Peso[i]*Richieste[i];

check{j in J} : Posizione[j] in Bool and Virtual[j] in Bool;

Expand All @@ -56,28 +55,35 @@ var k integer;

maximize fo :
(sum{i in I} sum{j in J} Costo[i]*x[i,j])
- CostoWattMese *
(sum{j in J} (1 - Posizione[j])*(y[j]))
+
(1-w)*(sum{j in J} (Posizione[j]*y[j])
- CostoWattMese * (
sum{j in J} (
(1 - Posizione[j])*y[j]
+
(1-w)*(Posizione[j]*y[j])
)
)
+ 20*(w)
;



# Vincoli

# 1)
subject to PesoMassimoServer{j in J} :
sum{i in I} (Peso[i] * x[i,j]) <=
(Risorse[j] + z[j] - (6)*(Posizione[j])*(w))
;


# DA AGGIUNGERE
subject to NumeroMassimoServerPerNodo{i in I} :
sum{j in J} (x[i,j]) <= Richieste[i]
;

# 2)
subject to TipiServerCompatibili_1 {j in J, i in I diff NotVirt}:
x[i,j] <= N * (Virtual[j])
;

# 2)
subject to TipiServerCompatibili_2 {j in J, i in NotVirt}:
x[i,j] <= N
;
Expand All @@ -86,18 +92,30 @@ subject to PreferenzaPerDedicati {i in I, j in J} :
x['D',j] <= x['D',j]*(1-Virtual[j]);
;
*/

# 3)
subject to ConsumoEnergetico{j in J} :
y[j] = ((100+50*Virtual[j])/4) * (sum{i in I} Peso[i]*x[i,j])
;

# 4)
subject to EccessiNodi_1 {j in J} :
z[j] <= MaxEccessoServer * ((Posizione[j])*(1-w) + (1-Posizione[j]))
;

subject to EccessiNodi_3 {j in J} :
# 4)
subject to EccessiNodi_2 {j in J} :
z[j] <= MaxEccessoServer*Virtual[j]
;

# DA AGGIUNGERE
subject to VenditaMinimaServizi_1 :
sum{i in I} sum{j in J} x[i,j] = k;

subject to VenditaMinimaServizi_2 :
k >= N*0.75;

# Proporzione

/*
s.t. Proporzione14 :
y[1] = y[4];
s.t. Proporzione45 :
Expand All @@ -108,13 +126,20 @@ s.t. Proporzione61 :
y[6] = y[1];
s.t. Proporzione_ded :
y[2] = y[3];
/*
subject to NessunoSpreco :
sum{i in I} sum{j in J} x[i,j] = k;
subject to NessunoSpreco2 :
k >= N-N*0.5;
*/


# Incremento

/*
s.t. Incremento14 :
y[1] >= y[4];
s.t. Incremento_ded :
y[2] >= y[3];
s.t. Incremento45 :
y[4] >= y[5];
s.t. Incremento56 :
y[5] >= y[6];
/**/
1 change: 1 addition & 0 deletions qcloud.run
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ data qcloud.dat;
option solver cplex;
solve;
display fo;
display N;
display sum{i in I} sum{j in J} (x[i,j]);

0 comments on commit cd27886

Please sign in to comment.