Originally posted by: SystemAdmin
[jfk said:]
hello there,
basically there are 2 solutions:
A.
as far as I know you can't add and then remove constraint in OPL. I've done something similar but long time ago so I don't have any code, I will just outline what I think would work:
1. you can ignore or respect constraint with the "if dataj==1 then constraintj" kind of statement
2. you have to design a script flow control, where you read a constraintDataArray which indicates which constraints should be respected or ignored.
3. And after each run you can manipulate this array and then you can rerun the runconfig with a completely new data set or just you modify 1 data element in the data set - as you put it if it fails you ignore it in the next run and you try with a new one, if the run produces solution then you keep it and you add the next constraint in the array
well, this based on your own way of exploring the constraints which can be respected. Say, you have 10 constraints and adding the first one produces solution but contradict all the rest, meanwhile all the 9 later constraint resolve into a solution. So if you start with the "bad" one you end up adding just 1 constraint, meanwhile if you start with the "good" ones you add up 9 with solution.
so B below maybe better:
B.
the other solution is that you use the constraint relaxation facility (only for LP/MIP problems) where you define priorities for each constraint (this tells the relaxation algorithm in which order you want them relaxed) and then run and wait and you will
1. get a solution
2. with the necessary constraints relaxed
cheers
#DecisionOptimization#OPLusingCPOptimizer