Infeasible integer - solution CPLEX

Hello Julia’s users,
I have a little question.
I am solving a complex integer problem using CPLEX. Many times, a long computation time does not provide an integer feasible solution.
If I limit the CPU time (for example, 1 hour), there is a way to say for the cplexsolver return this information, for example, “not found integer feasible solution”?
Because in these intances, I set the objective value to -1.
Best regards.
Thanks a lot.

You can query termination_status to check that a time limit was reached:

JuMP.termination_status(model) # should be MOI.TIME_LIMIT

and then primal_status to check the primal result. If CPLEX found a solution it will be

JuMP.primal_status(model)  # should be MOI.FEASIBLE_POINT

if no integer feasible solution was found, CPLEX should report:

JuMP.primal_status(model)  # should be MOI.NO_SOLUTION

The JuMP documentation contains more information: Query Solutions · JuMP

Thank you very much for your response.
But, when I call
JuMP.termination_status(model)
I have an error:
UndefVarError: termination_status not defined
getproperty(::Module, ::Symbol) at sysimg.jl:13
top-level scope at none:0

My version is 0.7 and JuMP.
Are you telling me why this problem? The version of my Julia? How can I enable this function?

This only works on Julia 1.0 and JuMP 0.19. This case was one of the motivations for releasing the new version of JuMP.

I thought that in version 0.7 it worked!
So I’ll have to install version 1.0.
If I install this version, and calling Pkg.add (“JuMP”), will it install version JuMP v0.19?

Julia versions 0.6 and 0.7 are no longer supported.

If I install this version, and calling Pkg.add (“JuMP”), will it install version JuMP v0.19?

Yes.