Dear all
My mathematical problem is to schedule the device in a home to achieve the minimum cost during a day. I divide a day into 24 time slots. Each device with have its own Power rate and length of operation time. Main variables in my problem are starting time of devices at which a device is started to run. When I run my program, starting times of devices are always at time slot 1 and these are wrong results. I do not know why my program give wrong results.
Here is my program
Model Main_Test_starting_time {
  Set Time {
    Index: t;
  }
  Set Devices {
    Index: d;
  }
  Parameter Price {
    IndexDomain: t;
  }
  Parameter Power_rate {
    IndexDomain: d;
  }
  Parameter Length_of_operation_time {
    IndexDomain: d;
  }
  Variable Starting_time {
    IndexDomain: d;
    Range: {
      {1..inf}
    }
  }
  Variable Energy_consumtion {
    IndexDomain: t;
    Range: nonnegative;
    Definition: sumnd, if Ord(t) >= Starting_time(d) AND Ord(t) <= Starting_time(d) + Length_of_operation_time(d) - 1 then Power_rate(d) else 0 endif];
  }
  Variable Total_cost {
    Range: free;
    Definition: sumÂt, Energy_consumtion(t) * Price(t)];
  }
  Constraint Contraint {
    IndexDomain: d;
    Definition: Starting_time(d) <= Card(Time) - Length_of_operation_time(d) - 1;
  }
  MathematicalProgram Minimum_Total_cost {
    Objective: Total_cost;
    Direction: minimize;
    Constraints: AllConstraints;
    Variables: AllVariables;
    Type: Automatic;
  }
 Â
Please help me
Thank you very much
Â