Originally posted by: jon.rosen
CPLEX Errors out when i try running the following:
tuple dist_job {
key string name;
float lower_emp_limit; // minimum labor hours that can be assigned to Employees
float upper_emp_limit;
}
{dist_job} dist_jobs = ...;
// individual record of historical work request or forecast file
tuple aggregated_work_request {
string Date;
string install_wo;
string wr_no;
string job_type_code;
string dist_job;
string district_wr;
string staffing;
float fte_adder;
float fte_sub;
float total_cost;
float labor_hours;
float asb_hours;
float asb_labor;
float emp_avg;
float con_avg;
float emp_stddev;
float con_stddev;
float emp_stderror;
float con_stderror;
}
{aggregated_work_request} AggregatedWorkRequests = ...;
dvar boolean assign_job_to_contr_time[a in AggregatedWorkRequests]; // 1 if true 0 if false
dvar boolean assign_job_to_company[a in AggregatedWorkRequests]; // 1 if true 0 if false
dexpr float ak = sum (t in dist_jobs)
(
sum(a in AggregatedWorkRequests: a.dist_job == t.name) ( a.con_avg * a.asb_hours * assign_job_to_contr_time[a] + a.emp_avg * a.asb_hours * assign_job_to_company[a] ) + // mean cost
1.645 * sqrt(
(sum(a in AggregatedWorkRequests: a.dist_job == t.name) (a.asb_hours * assign_job_to_contr_time[a]))^2 * (max(a in AggregatedWorkRequests: a.job_type_code == t.name) (a.con_stderror))^2 + // variance of contractor mean cost
(sum(a in AggregatedWorkRequests: a.dist_job == t.name) (a.asb_hours * assign_job_to_contr_time[a]))^2 * (max(a in AggregatedWorkRequests: a.job_type_code == t.name) (a.emp_stderror))^2 +
sum(a in AggregatedWorkRequests: a.dist_job == t.name)
(
a.asb_hours^2 * assign_job_to_contr_time[a] * a.con_stddev^2 + // variance of cost for jobs assigned to contractors
a.asb_hours^2 * assign_job_to_company[a] * a.emp_stddev^2 // variance of cost for jobs assigned to employees
)
)
);
// minimize total cost of performing all jobs
minimize ak;
#DecisionOptimization#OPLusingCPLEXOptimizer