You can use PROC OPTMODEL in SAS/OR to formulate the problem and call either the MILP solver or possibly the CLP solver:
Besides the v and w decision variables, you need a binary decision variable x[j,k] that indicates whether observation j fails constraint k. You want to fix x[j,k] = 0 for all observations j with FLAG = 0 and all constraints k. If you are using the MILP solver, you can enforce this relationship by introducing big-M constraints (assuming DC also depends on j):
/* if x[j,k] = 1 then v
/* if x[j,k] = 0 then v
where M1[j,k] and M2[j,k] are upper bounds on the left hand sides, and epsilon is a small positive number, say 1e-6, that represents how far away from 0 you consider "negative" to be.
If you are using the CLP solver, you can enforce the relationship with a single set of REIFY constraints, without big-M or epsilon:
But note that the CLP solver requires all variables to be integer, and I don't know whether your v and w have that restriction.
There is a bit of ambiguity in the problem statement. Does "fail these constraints" mean fail all constraints or fail at least one constraint?
In either case, you need another binary variable y
Thank you for the detailed reply. That was really helpful.
Regarding the questions in your post..
1. "But note that the CLP solver requires all variables to be integer, and I don't know whether your v and w have that restriction."
In my problem, v and w are real numbers
2. "There is a bit of ambiguity in the problem statement. Does "fail these constraints" mean fail all constraints or fail at least one constraint?"
You have it right. "Fail these constraints" means "Fail at least one constraint".
Thanks for your help.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.
Find more tutorials on the SAS Users YouTube channel.