{"id":2564,"date":"2020-03-27T19:36:40","date_gmt":"2020-03-27T10:36:40","guid":{"rendered":"https:\/\/julialang.kr\/?p=2564"},"modified":"2020-03-27T19:38:51","modified_gmt":"2020-03-27T10:38:51","slug":"jump-inf-inf-constraint-%ec%a0%9c%ea%b1%b0%ed%95%98%ea%b8%b0","status":"publish","type":"post","link":"https:\/\/julialang.kr\/?p=2564","title":{"rendered":"[JuMP] Inf, -Inf constraint \uc81c\uac70\ud558\uae30"},"content":{"rendered":"\n<p>JuMP constraint\uc5d0 Inf, -Inf\uac00 \ud3ec\ud568\ub41c \uacbd\uc6b0 \uc774\ub97c \uc81c\uac70\ud558\ub294 \ubc29\ubc95\uc744 \uc544\ub798 \uc18c\uac1c \ud55c\ub2e4.<\/p>\n\n\n\n<p>lower\uc5d0 -Inf\ub098 upper\uc5d0 Inf\uac00 \uc788\ub294 \uacbd\uc6b0 \uc608\ub97c \ub4e4\uc5b4<br>@constaint(m, x &lt;= Inf) \ub97c \ud558\uac8c \ub418\uba74<br>==> x + NaN &lt;= Inf<br>\ub77c\ub294 \uc2dd\uc73c\ub85c constraint\uc5d0 NaN\uc774 \ud3ec\ud568\ub418\uc5b4 optimize\uc2dc error\uac00 \ubc1c\uc0dd\ud55c\ub2e4<br>upper\ub098 lower\uc5d0 Inf, -Inf\uac00 \ud3ec\ud568\ub418\ub294 \uacbd\uc6b0 \uc758\ubbf8\uac00 \uc5c6\uae30 \ub54c\ubb38\uc5d0 \uc5d0\ub7ec\ub97c \ubc1c\uc0dd \uc2dc\ud0a4\ub294\uac8c \uc544\ub2d0\uae4c \ud55c\ub2e4.<br>\ub530\ub77c\uc11c \uc0ac\uc804\uc5d0 \uadf8\ub7f0 \uc870\uac74\uc5d0 \uc788\ub294 constraint\ub97c \uc81c\uac70 \ud574\uc8fc\ub294\uac8c \uc88b\ub2e4.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>m = Model(Gurobi.Optimizer)\n@variable(m, x[1:5])\n@constraint(m,x .&lt;= [1,Inf,2,Inf,3])\n@constraint(m,x[2:4] .>= [1,9,-Inf])\nprintln(m)\n\ntypes = list_of_constraint_types(m)\nfor (expr_type, opt_type) in types\n  println(expr_type, \"-\", opt_type)\n  con_lst = JuMP.all_constraints(m,expr_type,opt_type)\n  for con in con_lst\n    if abs(JuMP.normalized_rhs(con)) == Inf\n      JuMP.delete(m,con)\n    end\n  end\nend\nprintln(m)<\/code><\/pre>\n\n\n\n<p>\uacb0\uacfc<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Academic license - for non-commercial use only\nFeasibility\nSubject to\n x[2] \u2265 1.0\n x[3] \u2265 9.0\n x[4] + NaN \u2265 -Inf\n x[1] \u2264 1.0\n x[2] + NaN \u2264 Inf\n x[3] \u2264 2.0\n x[4] + NaN \u2264 Inf\n x[5] \u2264 3.0\n\nGenericAffExpr{Float64,VariableRef}-MathOptInterface.GreaterThan{Float64}\nGenericAffExpr{Float64,VariableRef}-MathOptInterface.LessThan{Float64}\nFeasibility\nSubject to\n x[2] \u2265 1.0\n x[3] \u2265 9.0\n x[1] \u2264 1.0\n x[3] \u2264 2.0\n x[5] \u2264 3.0<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>JuMP constraint\uc5d0 Inf, -Inf\uac00 \ud3ec\ud568\ub41c \uacbd\uc6b0 \uc774\ub97c \uc81c\uac70\ud558\ub294 \ubc29\ubc95\uc744 \uc544\ub798 \uc18c\uac1c \ud55c\ub2e4. lower\uc5d0 -Inf\ub098 upper\uc5d0 Inf\uac00 \uc788\ub294 \uacbd\uc6b0 \uc608\ub97c \ub4e4\uc5b4@constaint(m, x &lt;= Inf) \ub97c \ud558\uac8c \ub418\uba74==> x + NaN &lt;= Inf\ub77c\ub294 \uc2dd\uc73c\ub85c constraint\uc5d0 NaN\uc774 \ud3ec\ud568\ub418\uc5b4 optimize\uc2dc error\uac00 \ubc1c\uc0dd\ud55c\ub2e4upper\ub098 lower\uc5d0 Inf, -Inf\uac00 \ud3ec\ud568\ub418\ub294 \uacbd\uc6b0 \uc758\ubbf8\uac00 \uc5c6\uae30 \ub54c\ubb38\uc5d0 \uc5d0\ub7ec\ub97c \ubc1c\uc0dd \uc2dc\ud0a4\ub294\uac8c \uc544\ub2d0\uae4c \ud55c\ub2e4.\ub530\ub77c\uc11c \uc0ac\uc804\uc5d0 \uadf8\ub7f0 \uc870\uac74\uc5d0 \uc788\ub294 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[20,24],"tags":[],"_links":{"self":[{"href":"https:\/\/julialang.kr\/index.php?rest_route=\/wp\/v2\/posts\/2564"}],"collection":[{"href":"https:\/\/julialang.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/julialang.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/julialang.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/julialang.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2564"}],"version-history":[{"count":3,"href":"https:\/\/julialang.kr\/index.php?rest_route=\/wp\/v2\/posts\/2564\/revisions"}],"predecessor-version":[{"id":2568,"href":"https:\/\/julialang.kr\/index.php?rest_route=\/wp\/v2\/posts\/2564\/revisions\/2568"}],"wp:attachment":[{"href":"https:\/\/julialang.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2564"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/julialang.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2564"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/julialang.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2564"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}