Bilevel JuMP

Product mode gives you a non-convex QCQP problem, which is passed to Gurobi.
Gurobi tells you that you must set the NonConvex parameter to 2, see the Gurobi documentation. If you don’t do that, the solver will abort.

In general, if you encounter an error that is reported by a solver (e.g., a GurobiError or a CPLEXError, you should first check that solver’s documentation to understand what the error means.

1 Like

ok,thankyou!

Product mode should be used with NLP solvers such as Ipopt and Knitro

That is exactly the main difficulty of the Fortuny Amat formulation.
Finding those bounds might be as hard as solving the problem itself, however, sometimes people can find reasonable bounds by carefully analyzing the problem. There is no free lunch…

:grin:OK, I’ll try.
And I tried to run the source code again, ran 125260 seconds, the results are as follows,What does that mean?

Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x7fff450fb83f -- GRBsetlogfile at D:\gurobi\win64\bin\gurobi90.DLL (unknown line)
in expression starting at E:\Julia绋嬪簭\瀹屾暣鐗?jl:213
GRBsetlogfile at D:\gurobi\win64\bin\gurobi90.DLL (unknown line)
GRBsetlogfile at D:\gurobi\win64\bin\gurobi90.DLL (unknown line)
GRBsetlogfile at D:\gurobi\win64\bin\gurobi90.DLL (unknown line)
GRBsetlogfile at D:\gurobi\win64\bin\gurobi90.DLL (unknown line)
GRBsetlogfile at D:\gurobi\win64\bin\gurobi90.DLL (unknown line)
GRBsetlogfile at D:\gurobi\win64\bin\gurobi90.DLL (unknown line)
macro expansion at C:\Users\61940\.juliapro\JuliaPro_v1.4.2-1\packages\Gurobi\7YNJV\src\grb_common.jl:60 [inlined]
optimize at C:\Users\61940\.juliapro\JuliaPro_v1.4.2-1\packages\Gurobi\7YNJV\src\grb_solve.jl:5 [inlined]
optimize! at C:\Users\61940\.juliapro\JuliaPro_v1.4.2-1\packages\Gurobi\7YNJV\src\MOI_wrapper.jl:1920
optimize! at C:\Users\61940\.juliapro\JuliaPro_v1.4.2-1\packages\MathOptInterface\bygN7\src\Bridges\bridge_optimizer.jl:239
#optimize!#42 at C:\Users\61940\.juliapro\JuliaPro_v1.4.2-1\packages\BilevelJuMP\Ll9sk\src\jump.jl:993
optimize! at C:\Users\61940\.juliapro\JuliaPro_v1.4.2-1\packages\BilevelJuMP\Ll9sk\src\jump.jl:919
jl_apply at /cygdrive/d/buildbot/worker/package_win64/build/src\julia.h:1700 [inlined]
do_call at /cygdrive/d/buildbot/worker/package_win64/build/src\interpreter.c:369
eval_value at /cygdrive/d/buildbot/worker/package_win64/build/src\interpreter.c:458
eval_stmt_value at /cygdrive/d/buildbot/worker/package_win64/build/src\interpreter.c:409 [inlined]
eval_body at /cygdrive/d/buildbot/worker/package_win64/build/src\interpreter.c:799
jl_interpret_toplevel_thunk at /cygdrive/d/buildbot/worker/package_win64/build/src\interpreter.c:911
jl_toplevel_eval_flex at /cygdrive/d/buildbot/worker/package_win64/build/src\toplevel.c:819
jl_parse_eval_all at /cygdrive/d/buildbot/worker/package_win64/build/src\ast.c:872
include_string at .\loading.jl:1080
#220 at C:\Users\61940\.juliapro\JuliaPro_v1.4.2-1\packages\Atom\9h5Up\src\eval.jl:174
withpath at C:\Users\61940\.juliapro\JuliaPro_v1.4.2-1\packages\CodeTools\VsjEq\src\utils.jl:30
withpath at C:\Users\61940\.juliapro\JuliaPro_v1.4.2-1\packages\Atom\9h5Up\src\eval.jl:9
#219 at C:\Users\61940\.juliapro\JuliaPro_v1.4.2-1\packages\Atom\9h5Up\src\eval.jl:171 [inlined]
with_logstate at .\logging.jl:398
with_logger at .\logging.jl:505 [inlined]
#218 at C:\Users\61940\.juliapro\JuliaPro_v1.4.2-1\packages\Atom\9h5Up\src\eval.jl:170 [inlined]
hideprompt at C:\Users\61940\.juliapro\JuliaPro_v1.4.2-1\packages\Atom\9h5Up\src\repl.jl:127
macro expansion at C:\Users\61940\.juliapro\JuliaPro_v1.4.2-1\packages\Media\ItEPc\src\dynamic.jl:24 [inlined]
evalall at C:\Users\61940\.juliapro\JuliaPro_v1.4.2-1\packages\Atom\9h5Up\src\eval.jl:160
jl_apply at /cygdrive/d/buildbot/worker/package_win64/build/src\julia.h:1700 [inlined]

That is a gurobi issue.
Might be memory related…
From the stack it seems related to a log file. Maybe its too large?
I don’t know…

1 Like

Maybe you’re right. Thank you

@objective(Lower(model), Min, sum(0.025*PPV+0.029*PWT+0.025*2*PMT))


     @constraint(Lower(model), c1, PGD_EX+PWT+PPV+2*PMT .== PDL)

     
     BilevelJuMP.set_dual_upper_bound(c1, 150)
     BilevelJuMP.set_dual_lower_bound(c1, -150)
     BilevelJuMP.set_primal_upper_bound_hint(PGD_EX, 200)
     BilevelJuMP.set_primal_upper_bound_hint(PGm1, 800)
     BilevelJuMP.set_primal_upper_bound_hint(PGm2, 300)
     BilevelJuMP.set_primal_upper_bound_hint(PMT, 200)
        
        BilevelJuMP.set_primal_lower_bound_hint(PGD_EX, -200)
        BilevelJuMP.set_primal_lower_bound_hint(PGm1, -2)
        BilevelJuMP.set_primal_lower_bound_hint(PGm2, -2)
        BilevelJuMP.set_primal_lower_bound_hint(PMT, -2)

I run the basic scalar successfully, but how can I modify the matrix constraints and variables

LoadError: MethodError: no method matching set_dual_upper_bound(::Array{ConstraintRef{BilevelModel,Int64,ScalarShape},2}, ::Int64)
Closest candidates are:
  set_dual_upper_bound(::ConstraintRef{BilevelModel,Int64,Shape} where Shape<:AbstractShape, ::T) where T<:Number at C:\Users\61940\.juliapro\JuliaPro_v1.4.2-1\packages\BilevelJuMP\Ll9sk\src\jump.jl:602
Stacktrace:
 [1] top-level scope at untitled-a0bdb1d4b669a3031f9496759d22bd8f:129
in expression starting at untitled-a0bdb1d4b669a3031f9496759d22bd8f:129

As the error says You are passing an array while you should be passing one element at a time of the array