Originally posted by: SystemAdmin
[EdKlotz said:]
have 2 models, and I want to check if the optimal solution of the first model is a feasible solution to the second model.
I am using OPL cplex.
If you had mentioned the specific type of model (e.g. LP, QP, MILP, etc.) you wished to solve, a more precise answer would have been possible. But, here goes.
There are numerous ways to do this, although the specifics depend on the whether your model is a continuous or discrete model. But, fundamentally, all APIs of CPLEX allow you to fix the variable bounds of the second model to the solution values associated with the first model. You can then solve this "fixed" version of the second model. If the fixed model is feasible, then you have a feasible solution to the second model. If it's infeasible, then your solution is infeasible to the second model. While you could also just make use of CPLEX's advanced basis and MIP start features, the advantage of creating the fixed model is that if it is infeasible, you can make use of CPLEX's conflict refiner feature to obtain an explanation of why the solution is infeasible (in the form of a minimal set of constraints and bounds that cause the infeasibility).
Specific to OPL, you can change variable bounds using OPL's scripting language, which offers similar functionality to CPLEX's object oriented APIs. OPL's IloNumVar class treats the variable bounds as properties that you can change directly. See the section in the OPL Language User's Manual ILOG Script for OPL-: Tutorial Flow control and multiple searches -> Doing more with mulprod_main -> Modifying the CPLEX matrix incrementally for more information.
#CPLEXOptimizers#DecisionOptimization