# Lazy Callback

**URL:** <https://discourse.julialang.org/t/lazy-callback/99680>\
**Category:** General Usage\
**Tags:** question\
**Created:** [May 31, 2023, 3:21pm UTC](https://discourse.julialang.org/t/lazy-callback/99680 "2023-05-31T15:21:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cristian\_Duran](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cristian_duran/32/50398_2.png) [@Cristian\_Duran](https://discourse.julialang.org/u/Cristian_Duran)\
**Post date:** [May 31, 2023, 3:21pm UTC](https://discourse.julialang.org/t/lazy-callback/99680/1 "2023-05-31T15:21:22Z")

</div>

In the callback example provided on the readme of CPLEX.jl we have:

```
# You can select where the callback is run
if context_id != CPX_CALLBACKCONTEXT_CANDIDATE
    return
end

```

and then

```
ispoint_p = Ref{Cint}()
ret = CPXcallbackcandidateispoint(cb_data, ispoint_p)
if ret != 0 || ispoint_p[] == 0
    return # No candidate point available or error
end

```

I do not understand the usefulness of the second part. Can we have the context equal to CPX\_CALLBACKCONTEXT\_CANDIDATE without having any candidate point available?

---

<div class="post-metadata">

**Author:** ![mike\_k](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mike_k/32/211864_2.png) [@mike\_k](https://discourse.julialang.org/u/mike_k)\
**Post date:** [June 2, 2023, 1:16pm UTC](https://discourse.julialang.org/t/lazy-callback/99680/2 "2023-06-02T13:16:59Z")

</div>

Welcome!  
The reason is explained in the CPLEX documentation [here](https://www.ibm.com/docs/en/icos/22.1.0?topic=c-cpxxcallbackcandidateispoint-cpxcallbackcandidateispoint).  
Btw: you are more likely to get help on such issues, if you post them in the category `Optimization (Mathematical)`.
