@@ -407,27 +407,14 @@ end
407407
408408# # Submittables
409409
410- """
411- RejectSolution(callback_data)
412-
413- Reject feasible solution provided by [`CallbackVariablePrimal`](@ref).
414-
415- This can be submitted only from the [`FeasibleSolutionCallback`](@ref). The
416- field `callback_data` is a solver-specific callback type that is passed as the
417- argument to the feasible solution callback.
418- """
419- struct RejectSolution{CBDT} <: AbstractSubmittable
420- callback_data:: CBDT
421- end
422-
423410"""
424411 LazyConstraint(callback_data)
425412
426413Lazy constraint `func`-in-`set` submitted as `func, set`. The optimal
427414solution returned by [`VariablePrimal`](@ref) will satisfy all lazy
428415constraints that have been submitted.
429416
430- This can be submitted only from the [`FeasibleSolutionCallback `](@ref). The
417+ This can be submitted only from the [`LazyConstraint `](@ref). The
431418field `callback_data` is a solver-specific callback type that is passed as the
432419argument to the feasible solution callback.
433420"""
@@ -442,9 +429,9 @@ Heuristically obtained feasible solution. The solution is submitted as
442429`variables, values` where `values[i]` gives the value of `variables[i]`,
443430similarly to [`set`](@ref).
444431
445- This can be submitted only from the [`InfeasibleSolutionCallback `](@ref). The
432+ This can be submitted only from the [`HeuristicCallback `](@ref). The
446433field `callback_data` is a solver-specific callback type that is passed as the
447- argument to the infeasible solution callback.
434+ argument to the heuristic callback.
448435
449436Note that the solver may silently reject the provided solution.
450437"""
@@ -464,7 +451,7 @@ off. Note that, as opposed to [`LazyConstraint`](@ref), the provided constraint
464451cannot modify the feasible set, the constraint should be redundant, e.g., it
465452may be a consequence of affine and integrality constraints.
466453
467- This can be submitted only from the [`InfeasibleSolutionCallback `](@ref). The
454+ This can be submitted only from the [`UserCutCallback `](@ref). The
468455field `callback_data` is a solver-specific callback type that is passed as the
469456argument to the infeasible solution callback.
470457
@@ -565,16 +552,18 @@ to you to provide the appropriate one. If in doubt, give a complete solution.
565552
566553The value of the attribute should be a function taking only one argument, that
567554is commonly called `callback_data`, that can be used for instance in
568- [`FeasibleSolutionCallback`](@ref), [`InfeasibleSolutionCallback`](@ref).
555+ [`LazyConstraintCallback`](@ref), [`HeuristicCallback`](@ref) and
556+ [`UserCutCallback`](@ref).
569557"""
570558abstract type AbstractCallback <: AbstractOptimizerAttribute end
571559
572560"""
573- FeasibleSolutionCallback () <: AbstractCallback
561+ LazyConstraintCallback () <: AbstractCallback
574562
575- The callback can be used to reject a feasible primal solution by submitting
576- [`RejectSolution`](@ref) and/or [`LazyConstraint`](@ref). Note that there
577- is no guarantee that the callback is called at *every* feasible primal solution.
563+ The callback can be used to reduce the feasible set given the current primal
564+ solution by submitting a [`LazyConstraint`](@ref). For instance, it may be
565+ called at an incumbent of a mixed-integer problem. Note that there is no
566+ guarantee that the callback is called at *every* feasible primal solution.
578567
579568The feasible primal solution is accessed through
580569[`CallbackVariablePrimal`](@ref). Trying to access other result
@@ -585,34 +574,23 @@ attributes will throw [`OptimizeInProgress`](@ref) as discussed in
585574
586575```julia
587576x = MOI.add_variables(optimizer, 8)
588- MOI.submit(optimizer, MOI.FeasibleSolutionCallback (), callback_data -> begin
577+ MOI.submit(optimizer, MOI.LazyConstraintCallback (), callback_data -> begin
589578 sol = MOI.get(optimizer, MOI.CallbackVariablePrimal(callback_data), x)
590- if MOI.supports(optimizer, MOI.RejectSolution(callback_data))
591- # determine if it should be rejected only if it's supported as it may
592- # be time consuming.
593- if # should reject
594- MOI.submit(optimizer, MOI.RejectSolution(callback_data))
595- end
596- end
597- if MOI.supports(optimizer, MOI.LazyConstraint(callback_data))
598- # determine the lazy constraint only if it's supported as it may be time
599- # consuming.
600- if # should add a lazy constraint
601- func = # computes function
602- set = # computes set
603- MOI.submit(optimizer, MOI.LazyConstraint(callback_data), func, set)
604- end
579+ if # should add a lazy constraint
580+ func = # computes function
581+ set = # computes set
582+ MOI.submit(optimizer, MOI.LazyConstraint(callback_data), func, set)
605583 end
606584end
607585```
608586"""
609- struct FeasibleSolutionCallback <: AbstractCallback end
587+ struct LazyConstraintCallback <: AbstractCallback end
610588
611589"""
612- InfeasibleSolutionCallback () <: AbstractCallback
590+ HeuristicCallback () <: AbstractCallback
613591
614- The callback can be used to submit [`HeuristicSolution`](@ref) and/or
615- [`UserCut`](@ref) given an infeasible primal solution.
592+ The callback can be used to submit [`HeuristicSolution`](@ref) given the
593+ current primal solution.
616594For instance, it may be called at fractional (i.e., non-integer) nodes in the
617595branch and bound tree of a mixed-integer problem. Note that there is not
618596guarantee that the callback is called *everytime* the solver has an infeasible
@@ -627,30 +605,47 @@ attributes will throw [`OptimizeInProgress`](@ref) as discussed in
627605
628606```julia
629607x = MOI.add_variables(optimizer, 8)
630- MOI.submit(optimizer, MOI.InfeasibleSolutionCallback (), callback_data -> begin
608+ MOI.submit(optimizer, MOI.HeuristicCallback (), callback_data -> begin
631609 sol = MOI.get(optimizer, MOI.CallbackVariablePrimal(callback_data), x)
632- if MOI.supports(optimizer, MOI.HeuristicSolution(callback_data))
633- # determine the heuristic solution only if it it's supported as it may
634- # be time consuming.
635- if # can find a heuristic solution
636- values = # computes heuristic solution
637- MOI.submit(optimizer, MOI.HeuristicSolution(callback_data), x,
638- values)
639- end
610+ if # can find a heuristic solution
611+ values = # computes heuristic solution
612+ MOI.submit(optimizer, MOI.HeuristicSolution(callback_data), x,
613+ values)
640614 end
641- if MOI.supports(optimizer, MOI.UserCut(callback_data))
642- # determine the user cut only if it's supported as it may be time
643- # consuming.
644- if # can find a user cut
645- func = # computes function
646- set = # computes set
647- MOI.submit(optimizer, MOI.UserCut(callback_data), func, set)
648- end
615+ end
616+ ```
617+ """
618+ struct HeuristicCallback <: AbstractCallback end
619+
620+ """
621+ UserCutCallback() <: AbstractCallback
622+
623+ The callback can be used to submit [`UserCut`](@ref) given the current primal
624+ solution. For instance, it may be called at fractional (i.e., non-integer) nodes
625+ in the branch and bound tree of a mixed-integer problem. Note that there is not
626+ guarantee that the callback is called *everytime* the solver has an infeasible
627+ solution.
628+
629+ The infeasible solution is accessed through
630+ [`CallbackVariablePrimal`](@ref). Trying to access other result
631+ attributes will throw [`OptimizeInProgress`](@ref) as discussed in
632+ [`AbstractCallback`](@ref).
633+
634+ ## Examples
635+
636+ ```julia
637+ x = MOI.add_variables(optimizer, 8)
638+ MOI.submit(optimizer, MOI.UserCutCallback(), callback_data -> begin
639+ sol = MOI.get(optimizer, MOI.CallbackVariablePrimal(callback_data), x)
640+ if # can find a user cut
641+ func = # computes function
642+ set = # computes set
643+ MOI.submit(optimizer, MOI.UserCut(callback_data), func, set)
649644 end
650645end
651646```
652647"""
653- struct InfeasibleSolutionCallback <: AbstractCallback end
648+ struct UserCutCallback <: AbstractCallback end
654649
655650# # Model attributes
656651
0 commit comments