Dear Paul
Thank you for prompt reply. It seems what I am trying to do is wrong
since your suggestion solves the error but if I try to solve using
CPLEX I receive the error:
QP Hessian is not positive semi-definite
When I used MINOS I get a wrong solution. I limit my code to the
following:
set cpu;
set job;
param cost {cpu} > 0;
param speed {cpu} > 0;
param risk {cpu} > 0;
param A {cpu} >= 0;
param p {job} > 0; # the reqiuered time for the job
param T > 0; # the time limite
param R > 0; # the Risk limite
param V >=0; #the job arrival time
param index; # the index of the jobs
param y; # the index of the CPUs
var st {j in cpu} >= 0, <= T; # starting time
var ft {j in cpu} >= 0, <= T; # finishing time
param v {i in cpu} =
if V >= A[i] then V else A[i];#the starting time is set to largest
time when
# the CPU or the job is available
minimize Total_cost: sum {j in cpu} cost [j] * (ft[j]-st[j]);
subject to Time1 :sum {i in cpu} (ft[i]-st[i]) * speed[i] = p[index];
subject to Risk {i in cpu}: (ft[i]-st[i]) * risk[i] <= (ft[i]-st[i])
* R;
subject to test1 {i in cpu}: st[i] = v[i];
When I run this code I get the correct answer. What I am trying to do
is schedule a job with a given requirement (Processing time, Deadline,
Risk and Arrival time) on some CPUs with (Speed, cost, Risk and
Available time). My objective is to minimize the cost of scheduling on
the CPUs while insuring the job requirements are guaranteed. The above
code dose the job, but if the CPU available time is not enough to
complete the processing the Job is divided into two, or more, CPUs.
This is because of the use of sum.
I need to change this code so only one CPU is used and if no CPU
existed with enough available time then no solution is available. I
tried your method yet I think I get it wrong. The code I used is:
set cpu;
set job;
param cost {cpu} > 0;
param speed {cpu} > 0;
param risk {cpu} > 0;
param A {cpu} >= 0;
param p {job} > 0; # the reqiuered time for the job
param T > 0; # the time limite
param R > 0; # the Risk limite
param V >=0; #the job arrival time
param index; # the index of the jobs
param y;
var L :=10000;
var M := 10000;
var st {j in cpu} >= 0, <= T;
var ft {j in cpu} >= 0, <= T;
var z { i in cpu} binary;
param v {i in cpu} =
if V >= A[i] then V else A[i];
minimize Total_cost: sum {j in cpu} cost [j] * (ft[j]-st[j]);
subject to Time1 {i in cpu}: -L *(1-z[i]) <= ((ft[i]-st[i]) *
speed[i]) - p[index];
subject to Time2 {i in cpu}: ((ft[i]-st[i]) * speed[i]) - p[index] <=
M*(1-z[i]);
subject to Time3: sum{i in cpu} z[i] >= 1;
subject to Risk {i in cpu}: (ft[i]-st[i]) * risk[i] <= (ft[i]-st[i])
* R;
subject to test1 {i in cpu}: st[i] = v[i];
I know I am asking a great deal, thank you very much for your effort.
I hope you could help me to correct this problem
Regards,
Raid