Originally posted by: SystemAdmin
[MaryFenelon said:]
What you have given CPLEX is a set of values that it will use as hints for solution values the next time the solve() method is called. Only solve() can produce a CPLEX solution, so you can only query a solution after a solve() call and only if the solve() call returns IloTrue. A solution is a set of values that is feasible for the problem, that is, satisfies all constraints, bounds and integrality conditions.
If your objective is linear, you can use IloExpr::LinearIterator to query each variable and its associated coefficient and evaluate the objective using your initial variable values.
#CPLEXOptimizers#DecisionOptimization