Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix setting MOI.TimeLimitSec properly #300

Merged
merged 1 commit into from
Jul 23, 2024
Merged

Fix setting MOI.TimeLimitSec properly #300

merged 1 commit into from
Jul 23, 2024

Conversation

odow
Copy link
Member

@odow odow commented Jul 22, 2024

Fix #299 properly this time.

The issue was that the TimeLimitSec was not being re-set on MOI.empty!.

Now I get:

julia> using JuMP, KNITRO, PowerModels

julia> minlp_solver = JuMP.optimizer_with_attributes(KNITRO.Optimizer, MOI.TimeLimitSec() => 0.0)
MathOptInterface.OptimizerWithAttributes(KNITRO.Optimizer, Pair{MathOptInterface.AbstractOptimizerAttribute, Any}[MathOptInterface.TimeLimitSec() => 0.0])

julia> solve_ots("pglib_opf_case14_ieee__api.m", ACPPowerModel, minlp_solver)
[info | PowerModels]: removing 3 cost terms from generator 4: Float64[]
[info | PowerModels]: removing 1 cost terms from generator 1: [792.0951, 0.0]
[info | PowerModels]: removing 3 cost terms from generator 5: Float64[]
[info | PowerModels]: removing 1 cost terms from generator 2: [2326.9494, 0.0]
[info | PowerModels]: removing 3 cost terms from generator 3: Float64[]
##### This license is only intended for use by JuMP dev. #####
##### License is valid until Dec 31, 2024 #####
##### This license is only intended for use by JuMP dev. #####
##### License is valid until Dec 31, 2024 #####

=======================================
            Student License
       (NOT FOR COMMERCIAL USE)
         Artelys Knitro 13.1.0
=======================================

WARNING: Problem appears to have nonlinear equalities and be non-convex.
         The Knitro mixed integer solver is designed for convex problems.
         For non-convex problems it is only a heuristic, and the reported
         bounds and optimality claims cannot be verified.

datacheck:               0
hessian_no_f:            1
maxtime_real:            0
numthreads:              1
mip_maxtime_real:        0
mip_numthreads:          1
Knitro changing mip_method from AUTO to 1.
Knitro changing mip_rootalg from AUTO to 1.
Knitro changing mip_lpalg from AUTO to 3.
Knitro changing mip_branchrule from AUTO to 2.
Knitro changing mip_selectrule from AUTO to 2.
Knitro changing mip_mir from AUTO to 1.
Knitro changing mip_rounding from AUTO to 3.
Knitro changing mip_heuristic_strategy from AUTO to 1.
Knitro changing mip_heuristic_feaspump from AUTO to 1.
Knitro changing mip_heuristic_misqp from AUTO to 0.
Knitro changing mip_heuristic_mpec from AUTO to 1.
Knitro changing mip_heuristic_diving from AUTO to 0.
Knitro changing mip_heuristic_lns from AUTO to 0.
Knitro changing mip_pseudoinit from AUTO to 1.

Problem Characteristics
-----------------------
Objective goal:  Minimize
Objective type:  linear
Number of variables:                                138
    bounded below only:                               0
    bounded above only:                               0
    bounded below and above:                        121
    fixed:                                            3
    free:                                            14
Number of binary variables:                          20
Number of integer variables:                          0
Number of constraints:                              189
    linear equalities:                               28
    quadratic equalities:                             1
    gen. nonlinear equalities:                       80
    linear one-sided inequalities:                    0
    quadratic one-sided inequalities:                80
    gen. nonlinear one-sided inequalities:            0
    linear two-sided inequalities:                    0
    quadratic two-sided inequalities:                 0
    gen. nonlinear two-sided inequalities:            0
Number of nonzeros in Jacobian:                     812
Number of nonzeros in Hessian:                      302

Knitro detected 0 GUB constraints
Knitro derived 0 knapsack covers after examining 0 constraints
Knitro using Branch and Bound method with 1 thread.

       Nodes        Best solution   Best bound      Gap       Time 
   Expl  |  Unexpl      value         value                  (secs)
   ---------------  -------------   ----------      ---      ------

EXIT: Time limit reached. No integer feasible point found.

HINT: The problem may be a non-convex mixed-integer problem.  Set
      mip_multistart=1 to enable a mixed-integer multistart heuristic,
      which may improve the chances of finding the global solution.

Final Statistics for MIP
------------------------
Final objective value               =
Final bound value                   =  0.00000000000000e+00
Final optimality gap (abs / rel)    =  Infinity
# of nodes processed                =  0 (0.000s)
# of strong branching evaluations   =  0 (0.000s)
# of function evaluations           =  2 (0.012s)
# of gradient evaluations           =  1 (0.048s)
# of hessian evaluations            =  0 (0.000s)
# of hessian-vector evaluations     =  0
# of subproblems processed          =  0 (0.000s)
Total program time (secs)           =  0.07092 (0.061 CPU time)
Time spent in evaluations (secs)    =  0.05981

Cuts statistics (computed / added)
----------------------------------
Knapsack cuts                       =  0 / 0
Mixed-Integer Rounding cuts         =  0 / 0

Heuristics statistics (calls / successes / time)
------------------------------------------------
Feasibility pump                    =  0 / 0 / 0.000s
Rounding heuristic                  =  0 / 0 / 0.000s
MPEC heuristic                      =  0 / 0 / 0.000s

===========================================================================

Dict{String, Any} with 8 entries:
  "solve_time"         => 0.06144
  "optimizer"          => "Knitro"
  "termination_status" => TIME_LIMIT
  "dual_status"        => INFEASIBLE_POINT
  "primal_status"      => INFEASIBLE_POINT
  "objective"          => 0.0
  "solution"           => Dict{String, Any}("baseMVA"=>100.0, "branch"=>Dict{String, Any}("4"=>Dict{
  "objective_lb"       => 0.0

Copy link

codecov bot commented Jul 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.25%. Comparing base (9f9a7e6) to head (000553c).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #300      +/-   ##
==========================================
- Coverage   85.27%   85.25%   -0.02%     
==========================================
  Files           3        3              
  Lines        1005     1004       -1     
==========================================
- Hits          857      856       -1     
  Misses        148      148              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@odow odow merged commit 9e67e94 into master Jul 23, 2024
5 of 6 checks passed
@odow odow deleted the od/time-limit-2 branch July 23, 2024 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant