Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

run more time with different data at different time the same model

  • 1.  run more time with different data at different time the same model

    Posted 02/19/10 10:14 AM

    Originally posted by: biaigo


    Hello guys

    i'm a new user of opl studio. I have a problem:

    i want to run n-times my model, but at each time i want also change my data. so i want that the solution have to be the same until the data are the same.

    thanks very much
    here is attached my model

    {string} elettrodomestici = ...;
    {string} elettrodomestico = ...;
    //int n = 2; // # di elettrodomenstici
    //range N = 1..n;

    int t = 24; // # di slot temporali
    range T = 1..t;

    int P = 24; //indice che serve per il vincolo sulla continuità

    //Parametri

    //float costo[T];

    float consumo_elettrodomesticoelettrodomestici=...;
    float priorita elettrodomestici[T]=...;
    float input_pannelli_solari [T]=...;
    float massimo [T] =...;
    float riduzione_richiesta [T]=...;
    float costo_energia [T]=...;
    int durata elettrodomestici =...;
    float compenso_riduzione [T] =...;
    float a=0.3;
    float cons=...;
    int temp_ext[T] =...;

    // Variabili Decisionali

    dvar boolean xelettrodomestici[T];
    dvar boolean y[T];
    dvar float+ ingresso_rete[T];
    dvar float+ output[T];
    dvar float+ livello_carica[T];
    dvar int z[T] in 0..3;
    dvar float temp_int[T];

    //Modello

    maximize

    a*(sum (j in T,i in elettrodomestici)priorita[i][j]*x[i][j]) - (1-a)* (sum (j in T) (costo_energia[j]*ingresso_rete[j]
    - compenso_riduzione[j]*riduzione_richiesta[j]*y[j]));
    subject to{
    //vincolo priorità
    forall (j in 1..t) forall (i in elettrodomestici)
    if (priorita[i][j]>4) x[i][j]==1;

    // vincolo di durata del funzionamento dell'elettrodomestico
    forall (i in elettrodomestici)
    sum (j in T) x[i][j] == durata[i];

    //continuità - vincolo preso dalla formulazione di kaplan
    // forall (i in elettrodomestici)
    forall (j in 1..t-1)
    forall (p in durata..P-1)
    ( ( durata * (x[p]- xp+1) ) - (sum (q in (p - durata +1)..(p-1)) x[q] ) )<= 1;
    //output
    forall (j in T)
    output [1]==0;
    forall (j in T)
    livello_carica[1] == input_pannelli_solari[1];
    forall (i in 1..t-1)
    livello_caricai+1 == livello_carica[i] + input_pannelli_solari i+1 - outputi+1;
    forall (j in 1..t)
    livello_carica[j]<=3;
    //soddisfazione dei consumi
    forall (j in 1..t)
    ingresso_rete[j] + output[j] >= sum (i in elettrodomestici) consumo_elettrodomestico[i]*x[i][j] + riduzione_richiesta[j]*y[j]+cons*z[j];
    //vincolo sulla massima disponibilità
    forall (j in T)
    ingresso_rete[j]<=massimo[j];
    //Riscaldamento
    forall (j in 2..t)
    temp_int[j]>=23;

    forall (j in 2..t)
    temp_int[j]<=34;

    temp_int[1]==26;
    //forall (i in T)
    forall (j in 1..t-1)
    temp_intj+1==temp_int[j]-0.01*(temp_int[j]-temp_ext[j])+2*cons*zj+1;
    }
    dexpr float costo = (sum (j in T)(costo_energia[j]*ingresso_rete[j]-compenso_riduzione[j]*riduzione_richiesta[j]*y[j]));

    execute
    {
    var g; var h;
    for(g in elettrodomestici)
    for (h in T)

    if (x[g][h]==1) {writeln (g , '->slot ' ,h-1,' - ',h, ' = ON')}
    else{writeln (g, '->slot ' ,h-1, ' - ',h, ' = off')}

    //writeln (x);
    writeln('');
    writeln('consumo = ',costo, ' €')
    writeln (output);
    }
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: run more time with different data at different time the same model

    Posted 02/22/10 05:07 AM

    Originally posted by: Didier Vidal


    I moved this thread from ILOG OPL (CP Optimizer) to this forum - ILOG OPL (CPLEX) - since the model is a math programming model.

    Didier Vidal.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer