Hi Rob, your input was very useful to me, however i have some other questions. here in the code, i have declared two constraints with (if then statement), the single con is broke into two constraints. the real constraint looks like this in python: if f_GP('is_reprice_allowed',tup)==0: opt_prob += new_mac_price[tup] == f_GP('mac_price',tup) opt_prob += lb_slack[tup]==0 elif (f_GP('is_reprice_allowed',tup)==1) & (f_GP('is_present_in_gpi',tup)==1) : opt_prob += new_mac_price[tup] == f_GP('new_mac_price_by_user',tup) opt_prob += lb_slack[tup]==0 elif (f_GP('is_reprice_allowed',tup)==1) & (f_GP('is_present_in_gpi',tup)==0): opt_prob += new_mac_price[tup] <= f_GP('upper_bound',tup) opt_prob += new_mac_price[tup] >= f_GP('lower_bound',tup)-lb_slack[tup] is ok to break the constraints ? is my if then statement is correct? the variables used in the if then statement is not declared any where in my optmodel, but still it gives me results. is this the right way? proc optmodel; set <num> rxid; num mac_price {rxid}; num new_mac_price_by_user{rxid}; num is_reprice_allowed{rxid}; num is_present_in_gpi{rxid}; num lb_slack{rxid}; num upper_bound{rxid}; num lower_bound{rxid}; read data lp.opt_subset into rxid=[rx_id] mac_price new_mac_price_by_user is_reprice_allowed is_present_in_gpi upper_bound lower_bound ; var new_mac_price{rxid} ; var calc_ingred_cost{rxid} >=0; var post_awp_cost{rxid}; /* used a maximum number for objective function*/ max imp =200; con c1{i in rxid}: new_mac_price[i] = (if is_reprice_allowed[i] = 0 then mac_price[i] else if is_reprice_allowed[i] and is_present_in_gpi[i] =1 then new_mac_price_by_user[i] ); con c2{i in rxid}: new_mac_price[i] <= (if is_reprice_allowed[i]=1 and is_present_in_gpi[i] =0 then upper_bound[i]); /*con c2{i in rxid is_reprice_allowed[i] =}:new_mac_price[i] = (if is_reprice_allowed[i] and is_present_in_gpi[i] =0 then new_mac_price[i] <= upper_bound[i]);*/ solve ;expand; print new_mac_price;
... View more