diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ba39cc5 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +Manifest.toml diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..7613d0c --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,17 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "julia", + "request": "launch", + "name": "Run active Julia file", + "program": "${file}", + "stopOnEntry": false, + "cwd": "${workspaceFolder}", + "juliaEnv": "${command:activeJuliaEnvironment}", + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..532e7f0 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "julia.environmentPath": "/home/ccontard/.julia/environments/v1.9" +} \ No newline at end of file diff --git a/Manifest.toml b/Manifest.toml deleted file mode 100644 index ccfb9b7..0000000 --- a/Manifest.toml +++ /dev/null @@ -1,568 +0,0 @@ -# This file is machine-generated - editing it directly is not advised - -[[Adapt]] -deps = ["LinearAlgebra"] -git-tree-sha1 = "195c5505521008abea5aee4f96930717958eac6f" -uuid = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" -version = "3.4.0" - -[[ArgTools]] -uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f" - -[[Artifacts]] -uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" - -[[Base64]] -uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" - -[[BenchmarkTools]] -deps = ["JSON", "Logging", "Printf", "Profile", "Statistics", "UUIDs"] -git-tree-sha1 = "d9a9701b899b30332bbcb3e1679c41cce81fb0e8" -uuid = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" -version = "1.3.2" - -[[BitFlags]] -git-tree-sha1 = "43b1a4a8f797c1cddadf60499a8a077d4af2cd2d" -uuid = "d1d4a3ce-64b1-5f1a-9ba4-7e7e69966f35" -version = "0.1.7" - -[[Bzip2_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] -git-tree-sha1 = "19a35467a82e236ff51bc17a3a44b69ef35185a2" -uuid = "6e34b625-4abd-537c-b88f-471c36dfa7a0" -version = "1.0.8+0" - -[[CDDLib]] -deps = ["LinearAlgebra", "MathOptInterface", "Polyhedra", "SparseArrays", "cddlib_jll"] -git-tree-sha1 = "97e38cde2e7392911245480c10d5997db438cd21" -uuid = "3391f64e-dcde-5f30-b752-e11513730f60" -version = "0.9.1" - -[[Calculus]] -deps = ["LinearAlgebra"] -git-tree-sha1 = "f641eb0a4f00c343bbc32346e1217b86f3ce9dad" -uuid = "49dc2e85-a5d0-5ad3-a950-438e2897f1b9" -version = "0.5.1" - -[[ChainRulesCore]] -deps = ["Compat", "LinearAlgebra", "SparseArrays"] -git-tree-sha1 = "e7ff6cadf743c098e08fca25c91103ee4303c9bb" -uuid = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" -version = "1.15.6" - -[[ChangesOfVariables]] -deps = ["ChainRulesCore", "LinearAlgebra", "Test"] -git-tree-sha1 = "38f7a08f19d8810338d4f5085211c7dfa5d5bdd8" -uuid = "9e997f8a-9a97-42d5-a9f1-ce6bfc15e2c0" -version = "0.1.4" - -[[CodecBzip2]] -deps = ["Bzip2_jll", "Libdl", "TranscodingStreams"] -git-tree-sha1 = "2e62a725210ce3c3c2e1a3080190e7ca491f18d7" -uuid = "523fee87-0ab8-5b00-afb7-3ecf72e48cfd" -version = "0.7.2" - -[[CodecZlib]] -deps = ["TranscodingStreams", "Zlib_jll"] -git-tree-sha1 = "ded953804d019afa9a3f98981d99b33e3db7b6da" -uuid = "944b1d66-785c-5afd-91f1-9de20f533193" -version = "0.7.0" - -[[CommonSolve]] -git-tree-sha1 = "9441451ee712d1aec22edad62db1a9af3dc8d852" -uuid = "38540f10-b2f7-11e9-35d8-d573e4eb0ff2" -version = "0.2.3" - -[[CommonSubexpressions]] -deps = ["MacroTools", "Test"] -git-tree-sha1 = "7b8a93dba8af7e3b42fecabf646260105ac373f7" -uuid = "bbf7d656-a473-5ed7-a52c-81e309532950" -version = "0.3.0" - -[[Compat]] -deps = ["Dates", "LinearAlgebra", "UUIDs"] -git-tree-sha1 = "00a2cccc7f098ff3b66806862d275ca3db9e6e5a" -uuid = "34da2185-b29b-5c13-b0c7-acf172513d20" -version = "4.5.0" - -[[CompilerSupportLibraries_jll]] -deps = ["Artifacts", "Libdl"] -uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" - -[[ConstructionBase]] -deps = ["LinearAlgebra"] -git-tree-sha1 = "fb21ddd70a051d882a1686a5a550990bbe371a95" -uuid = "187b0558-2788-49d3-abe0-74a17ed4e7c9" -version = "1.4.1" - -[[DataAPI]] -git-tree-sha1 = "e8119c1a33d267e16108be441a287a6981ba1630" -uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a" -version = "1.14.0" - -[[DataDeps]] -deps = ["HTTP", "Libdl", "Reexport", "SHA", "p7zip_jll"] -git-tree-sha1 = "bc0a264d3e7b3eeb0b6fc9f6481f970697f29805" -repo-rev = "cl/bb" -repo-url = "https://github.com/CarloLucibello/DataDeps.jl" -uuid = "124859b0-ceae-595e-8997-d05f6a7a8dfe" -version = "0.7.10" - -[[DataStructures]] -deps = ["Compat", "InteractiveUtils", "OrderedCollections"] -git-tree-sha1 = "d1fff3a548102f48987a52a2e0d114fa97d730f0" -uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" -version = "0.18.13" - -[[DataValueInterfaces]] -git-tree-sha1 = "bfc1187b79289637fa0ef6d4436ebdfe6905cbd6" -uuid = "e2d170a0-9d28-54be-80f0-106bbe20a464" -version = "1.0.0" - -[[Dates]] -deps = ["Printf"] -uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" - -[[DiffResults]] -deps = ["StaticArraysCore"] -git-tree-sha1 = "782dd5f4561f5d267313f23853baaaa4c52ea621" -uuid = "163ba53b-c6d8-5494-b064-1a9d43ac40c5" -version = "1.1.0" - -[[DiffRules]] -deps = ["IrrationalConstants", "LogExpFunctions", "NaNMath", "Random", "SpecialFunctions"] -git-tree-sha1 = "c5b6685d53f933c11404a3ae9822afe30d522494" -uuid = "b552c78f-8df3-52c6-915a-8e097449b14b" -version = "1.12.2" - -[[DocStringExtensions]] -deps = ["LibGit2"] -git-tree-sha1 = "2fb1e02f2b635d0845df5d7c167fec4dd739b00d" -uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" -version = "0.9.3" - -[[Downloads]] -deps = ["ArgTools", "LibCURL", "NetworkOptions"] -uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6" - -[[EarCut_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] -git-tree-sha1 = "e3290f2d49e661fbd94046d7e3726ffcb2d41053" -uuid = "5ae413db-bbd1-5e63-b57d-d24a61df00f5" -version = "2.2.4+0" - -[[Extents]] -git-tree-sha1 = "5e1e4c53fa39afe63a7d356e30452249365fba99" -uuid = "411431e0-e8b7-467b-b5e0-f676ba4f2910" -version = "0.1.1" - -[[ForwardDiff]] -deps = ["CommonSubexpressions", "DiffResults", "DiffRules", "LinearAlgebra", "LogExpFunctions", "NaNMath", "Preferences", "Printf", "Random", "SpecialFunctions", "StaticArrays"] -git-tree-sha1 = "187198a4ed8ccd7b5d99c41b69c679269ea2b2d4" -uuid = "f6369f11-7733-5829-9624-2563aa707210" -version = "0.10.32" - -[[Future]] -deps = ["Random"] -uuid = "9fa8497b-333b-5362-9e8d-4d0656e87820" - -[[GMP_jll]] -deps = ["Artifacts", "Libdl"] -uuid = "781609d7-10c4-51f6-84f2-b8444358ff6d" - -[[GPUArraysCore]] -deps = ["Adapt"] -git-tree-sha1 = "6872f5ec8fd1a38880f027a26739d42dcda6691f" -uuid = "46192b85-c4d5-4398-a991-12ede77f4527" -version = "0.1.2" - -[[GeneralizedGenerated]] -deps = ["DataStructures", "JuliaVariables", "MLStyle", "Serialization"] -git-tree-sha1 = "60f1fa1696129205873c41763e7d0920ac7d6f1f" -uuid = "6b9d7cbe-bcb9-11e9-073f-15a7a543e2eb" -version = "0.3.3" - -[[GenericLinearAlgebra]] -deps = ["LinearAlgebra", "Printf", "Random", "libblastrampoline_jll"] -git-tree-sha1 = "856610594f8759d2a3d3afe3397ce5242982bfdd" -uuid = "14197337-ba66-59df-a3e3-ca00e7dcff7a" -version = "0.3.5" - -[[GeoInterface]] -deps = ["Extents"] -git-tree-sha1 = "fb28b5dc239d0174d7297310ef7b84a11804dfab" -uuid = "cf35fbd7-0cd7-5166-be24-54bfbe79505f" -version = "1.0.1" - -[[GeometryBasics]] -deps = ["EarCut_jll", "GeoInterface", "IterTools", "LinearAlgebra", "StaticArrays", "StructArrays", "Tables"] -git-tree-sha1 = "fe9aea4ed3ec6afdfbeb5a4f39a2208909b162a6" -uuid = "5c1252a2-5f33-56bf-86c9-59e7332b4326" -version = "0.4.5" - -[[HTTP]] -deps = ["Base64", "CodecZlib", "Dates", "IniFile", "Logging", "LoggingExtras", "MbedTLS", "NetworkOptions", "OpenSSL", "Random", "SimpleBufferStream", "Sockets", "URIs", "UUIDs"] -git-tree-sha1 = "2e13c9956c82f5ae8cbdb8335327e63badb8c4ff" -uuid = "cd3eb016-35fb-5094-929b-558a96fad6f3" -version = "1.6.2" - -[[IniFile]] -git-tree-sha1 = "f550e6e32074c939295eb5ea6de31849ac2c9625" -uuid = "83e8ac13-25f8-5344-8a64-a9f2b223428f" -version = "0.5.1" - -[[InteractiveUtils]] -deps = ["Markdown"] -uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" - -[[InverseFunctions]] -deps = ["Test"] -git-tree-sha1 = "49510dfcb407e572524ba94aeae2fced1f3feb0f" -uuid = "3587e190-3f89-42d0-90ee-14403ec27112" -version = "0.1.8" - -[[IrrationalConstants]] -git-tree-sha1 = "7fd44fd4ff43fc60815f8e764c0f352b83c49151" -uuid = "92d709cd-6900-40b7-9082-c6be49f344b6" -version = "0.1.1" - -[[IterTools]] -git-tree-sha1 = "fa6287a4469f5e048d763df38279ee729fbd44e5" -uuid = "c8e1da08-722c-5040-9ed9-7db0dc04731e" -version = "1.4.0" - -[[IteratorInterfaceExtensions]] -git-tree-sha1 = "a3f24677c21f5bbe9d2a714f95dcd58337fb2856" -uuid = "82899510-4779-5014-852e-03e436cf321d" -version = "1.0.0" - -[[JLLWrappers]] -deps = ["Preferences"] -git-tree-sha1 = "abc9885a7ca2052a736a600f7fa66209f96506e1" -uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210" -version = "1.4.1" - -[[JSON]] -deps = ["Dates", "Mmap", "Parsers", "Unicode"] -git-tree-sha1 = "3c837543ddb02250ef42f4738347454f95079d4e" -uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" -version = "0.21.3" - -[[JuMP]] -deps = ["LinearAlgebra", "MathOptInterface", "MutableArithmetics", "OrderedCollections", "Printf", "SparseArrays"] -git-tree-sha1 = "97792e3d04971c41fdc4917e1ae9bf6d313599e3" -uuid = "4076af6c-e467-56ae-b986-b466b2749572" -version = "1.5.0" - -[[JuliaVariables]] -deps = ["MLStyle", "NameResolution"] -git-tree-sha1 = "49fb3cb53362ddadb4415e9b73926d6b40709e70" -uuid = "b14d175d-62b4-44ba-8fb7-3064adc8c3ec" -version = "0.2.4" - -[[LibCURL]] -deps = ["LibCURL_jll", "MozillaCACerts_jll"] -uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21" - -[[LibCURL_jll]] -deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"] -uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0" - -[[LibGit2]] -deps = ["Base64", "NetworkOptions", "Printf", "SHA"] -uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" - -[[LibSSH2_jll]] -deps = ["Artifacts", "Libdl", "MbedTLS_jll"] -uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8" - -[[Libdl]] -uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" - -[[LinearAlgebra]] -deps = ["Libdl", "libblastrampoline_jll"] -uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" - -[[LogExpFunctions]] -deps = ["ChainRulesCore", "ChangesOfVariables", "DocStringExtensions", "InverseFunctions", "IrrationalConstants", "LinearAlgebra"] -git-tree-sha1 = "946607f84feb96220f480e0422d3484c49c00239" -uuid = "2ab3a3ac-af41-5b50-aa03-7779005ae688" -version = "0.3.19" - -[[Logging]] -uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" - -[[LoggingExtras]] -deps = ["Dates", "Logging"] -git-tree-sha1 = "cedb76b37bc5a6c702ade66be44f831fa23c681e" -uuid = "e6f89c97-d47a-5376-807f-9c37f3926c36" -version = "1.0.0" - -[[MLStyle]] -git-tree-sha1 = "060ef7956fef2dc06b0e63b294f7dbfbcbdc7ea2" -uuid = "d8e11817-5142-5d16-987a-aa16d5891078" -version = "0.4.16" - -[[MacroTools]] -deps = ["Markdown", "Random"] -git-tree-sha1 = "42324d08725e200c23d4dfb549e0d5d89dede2d2" -uuid = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" -version = "0.5.10" - -[[Markdown]] -deps = ["Base64"] -uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" - -[[MathOptInterface]] -deps = ["BenchmarkTools", "CodecBzip2", "CodecZlib", "DataStructures", "ForwardDiff", "JSON", "LinearAlgebra", "MutableArithmetics", "NaNMath", "OrderedCollections", "Printf", "SparseArrays", "SpecialFunctions", "Test", "Unicode"] -git-tree-sha1 = "09c6964bf4bca818867494739a9387c0c9cf4e2c" -uuid = "b8f27783-ece8-5eb3-8dc8-9495eed66fee" -version = "1.11.0" - -[[MbedTLS]] -deps = ["Dates", "MbedTLS_jll", "MozillaCACerts_jll", "Random", "Sockets"] -git-tree-sha1 = "03a9b9718f5682ecb107ac9f7308991db4ce395b" -uuid = "739be429-bea8-5141-9913-cc70e7f3736d" -version = "1.1.7" - -[[MbedTLS_jll]] -deps = ["Artifacts", "Libdl"] -uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1" - -[[Mmap]] -uuid = "a63ad114-7e13-5084-954f-fe012c677804" - -[[MozillaCACerts_jll]] -uuid = "14a3606d-f60d-562e-9121-12d972cd8159" - -[[MutableArithmetics]] -deps = ["LinearAlgebra", "SparseArrays", "Test"] -git-tree-sha1 = "aa532179d4a643d4bd9f328589ca01fa20a0d197" -uuid = "d8a4904e-b15c-11e9-3269-09a3773c0cb0" -version = "1.1.0" - -[[NaNMath]] -deps = ["OpenLibm_jll"] -git-tree-sha1 = "a7c3d1da1189a1c2fe843a3bfa04d18d20eb3211" -uuid = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3" -version = "1.0.1" - -[[NameResolution]] -deps = ["PrettyPrint"] -git-tree-sha1 = "1a0fa0e9613f46c9b8c11eee38ebb4f590013c5e" -uuid = "71a1bf82-56d0-4bbc-8a3c-48b961074391" -version = "0.1.5" - -[[NetworkOptions]] -uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" - -[[OpenBLAS_jll]] -deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"] -uuid = "4536629a-c528-5b80-bd46-f80d51c5b363" - -[[OpenLibm_jll]] -deps = ["Artifacts", "Libdl"] -uuid = "05823500-19ac-5b8b-9628-191a04bc5112" - -[[OpenSSL]] -deps = ["BitFlags", "Dates", "MozillaCACerts_jll", "OpenSSL_jll", "Sockets"] -git-tree-sha1 = "df6830e37943c7aaa10023471ca47fb3065cc3c4" -uuid = "4d8831e6-92b7-49fb-bdf8-b643e874388c" -version = "1.3.2" - -[[OpenSSL_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] -git-tree-sha1 = "f6e9dba33f9f2c44e08a020b0caf6903be540004" -uuid = "458c3c95-2e84-50aa-8efc-19380b2a3a95" -version = "1.1.19+0" - -[[OpenSpecFun_jll]] -deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl", "Pkg"] -git-tree-sha1 = "13652491f6856acfd2db29360e1bbcd4565d04f1" -uuid = "efe28fd5-8261-553b-a9e1-b2916fc3738e" -version = "0.5.5+0" - -[[OrderedCollections]] -git-tree-sha1 = "85f8e6578bf1f9ee0d11e7bb1b1456435479d47c" -uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" -version = "1.4.1" - -[[Parsers]] -deps = ["Dates", "SnoopPrecompile"] -git-tree-sha1 = "6466e524967496866901a78fca3f2e9ea445a559" -uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" -version = "2.5.2" - -[[Pkg]] -deps = ["Artifacts", "Dates", "Downloads", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] -uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" - -[[Polyhedra]] -deps = ["GenericLinearAlgebra", "GeometryBasics", "JuMP", "LinearAlgebra", "MutableArithmetics", "RecipesBase", "SparseArrays", "StaticArrays"] -git-tree-sha1 = "d6aaf7dd794fdcd7896cfc98301f6ffe84a99f56" -uuid = "67491407-f73d-577b-9b50-8179a7c68029" -version = "0.7.5" - -[[Preferences]] -deps = ["TOML"] -git-tree-sha1 = "47e5f437cc0e7ef2ce8406ce1e7e24d44915f88d" -uuid = "21216c6a-2e73-6563-6e65-726566657250" -version = "1.3.0" - -[[PrettyPrint]] -git-tree-sha1 = "632eb4abab3449ab30c5e1afaa874f0b98b586e4" -uuid = "8162dcfd-2161-5ef2-ae6c-7681170c5f98" -version = "0.2.0" - -[[Printf]] -deps = ["Unicode"] -uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" - -[[Profile]] -deps = ["Printf"] -uuid = "9abbd945-dff8-562f-b5e8-e1ebf5ef1b79" - -[[REPL]] -deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"] -uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" - -[[Random]] -deps = ["SHA", "Serialization"] -uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" - -[[RecipesBase]] -deps = ["SnoopPrecompile"] -git-tree-sha1 = "18c35ed630d7229c5584b945641a73ca83fb5213" -uuid = "3cdcf5f2-1ef4-517c-9805-6587b60abb01" -version = "1.3.2" - -[[Reexport]] -git-tree-sha1 = "45e428421666073eab6f2da5c9d310d99bb12f9b" -uuid = "189a3867-3050-52da-a836-e630ba90ab69" -version = "1.2.2" - -[[Roots]] -deps = ["ChainRulesCore", "CommonSolve", "Printf", "Setfield"] -git-tree-sha1 = "a3db467ce768343235032a1ca0830fc64158dadf" -uuid = "f2b01f46-fcfa-551c-844a-d8ac1e96c665" -version = "2.0.8" - -[[SHA]] -uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" - -[[Serialization]] -uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" - -[[Setfield]] -deps = ["ConstructionBase", "Future", "MacroTools", "StaticArraysCore"] -git-tree-sha1 = "e2cc6d8c88613c05e1defb55170bf5ff211fbeac" -uuid = "efcf1570-3423-57d1-acb7-fd33fddbac46" -version = "1.1.1" - -[[SimpleBufferStream]] -git-tree-sha1 = "874e8867b33a00e784c8a7e4b60afe9e037b74e1" -uuid = "777ac1f9-54b0-4bf8-805c-2214025038e7" -version = "1.1.0" - -[[SnoopPrecompile]] -git-tree-sha1 = "f604441450a3c0569830946e5b33b78c928e1a85" -uuid = "66db9d55-30c0-4569-8b51-7e840670fc0c" -version = "1.0.1" - -[[Sockets]] -uuid = "6462fe0b-24de-5631-8697-dd941f90decc" - -[[SparseArrays]] -deps = ["LinearAlgebra", "Random"] -uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" - -[[SpecialFunctions]] -deps = ["ChainRulesCore", "IrrationalConstants", "LogExpFunctions", "OpenLibm_jll", "OpenSpecFun_jll"] -git-tree-sha1 = "d75bda01f8c31ebb72df80a46c88b25d1c79c56d" -uuid = "276daf66-3868-5448-9aa4-cd146d93841b" -version = "2.1.7" - -[[StaticArrays]] -deps = ["LinearAlgebra", "Random", "StaticArraysCore", "Statistics"] -git-tree-sha1 = "ffc098086f35909741f71ce21d03dadf0d2bfa76" -uuid = "90137ffa-7385-5640-81b9-e52037218182" -version = "1.5.11" - -[[StaticArraysCore]] -git-tree-sha1 = "6b7ba252635a5eff6a0b0664a41ee140a1c9e72a" -uuid = "1e83bf80-4336-4d27-bf5d-d5a4f845583c" -version = "1.4.0" - -[[Statistics]] -deps = ["LinearAlgebra", "SparseArrays"] -uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" - -[[StructArrays]] -deps = ["Adapt", "DataAPI", "GPUArraysCore", "StaticArraysCore", "Tables"] -git-tree-sha1 = "b03a3b745aa49b566f128977a7dd1be8711c5e71" -uuid = "09ab397b-f2b6-538f-b94a-2f83cf4a842a" -version = "0.6.14" - -[[TOML]] -deps = ["Dates"] -uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76" - -[[TableTraits]] -deps = ["IteratorInterfaceExtensions"] -git-tree-sha1 = "c06b2f539df1c6efa794486abfb6ed2022561a39" -uuid = "3783bdb8-4a98-5b6b-af9a-565f29a5fe9c" -version = "1.0.1" - -[[Tables]] -deps = ["DataAPI", "DataValueInterfaces", "IteratorInterfaceExtensions", "LinearAlgebra", "OrderedCollections", "TableTraits", "Test"] -git-tree-sha1 = "c79322d36826aa2f4fd8ecfa96ddb47b174ac78d" -uuid = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" -version = "1.10.0" - -[[Tar]] -deps = ["ArgTools", "SHA"] -uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e" - -[[Test]] -deps = ["InteractiveUtils", "Logging", "Random", "Serialization"] -uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" - -[[TranscodingStreams]] -deps = ["Random", "Test"] -git-tree-sha1 = "e4bdc63f5c6d62e80eb1c0043fcc0360d5950ff7" -uuid = "3bb67fe8-82b1-5028-8e26-92a6c54297fa" -version = "0.9.10" - -[[URIs]] -git-tree-sha1 = "ac00576f90d8a259f2c9d823e91d1de3fd44d348" -uuid = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4" -version = "1.4.1" - -[[UUIDs]] -deps = ["Random", "SHA"] -uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" - -[[Unicode]] -uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" - -[[Zlib_jll]] -deps = ["Libdl"] -uuid = "83775a58-1f1d-513f-b197-d71354ab007a" - -[[cddlib_jll]] -deps = ["Artifacts", "GMP_jll", "JLLWrappers", "Libdl", "Pkg"] -git-tree-sha1 = "c25e5fe14395ea7b1d702f4eb90c52bdf50e3450" -uuid = "f07e07eb-5685-515a-97c8-3014f6152feb" -version = "0.94.13+0" - -[[libblastrampoline_jll]] -deps = ["Artifacts", "Libdl", "OpenBLAS_jll"] -uuid = "8e850b90-86db-534c-a0d3-1478176c7d93" - -[[nghttp2_jll]] -deps = ["Artifacts", "Libdl"] -uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d" - -[[p7zip_jll]] -deps = ["Artifacts", "Libdl"] -uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0" diff --git a/Project.toml b/Project.toml index 74148ac..8654270 100644 --- a/Project.toml +++ b/Project.toml @@ -9,7 +9,10 @@ Calculus = "49dc2e85-a5d0-5ad3-a950-438e2897f1b9" DataDeps = "124859b0-ceae-595e-8997-d05f6a7a8dfe" ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" GeneralizedGenerated = "6b9d7cbe-bcb9-11e9-073f-15a7a543e2eb" +IntervalArithmetic = "d1acc4aa-44c8-5952-acd4-ba5d80a2a253" +IntervalRootFinding = "d2bf35a9-74e0-55ec-b149-d360ff49b807" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" +Optim = "429524aa-4258-5aef-a3af-852621145aeb" Polyhedra = "67491407-f73d-577b-9b50-8179a7c68029" -Roots = "f2b01f46-fcfa-551c-844a-d8ac1e96c665" +PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/pbKnap_1_10eps_grb.lp b/pbKnap_1_10eps_grb.lp new file mode 100644 index 0000000..a87d6c3 --- /dev/null +++ b/pbKnap_1_10eps_grb.lp @@ -0,0 +1,215 @@ +\ Model pbmcnd_1_10_eps_grb.lp +\ LP format - for model browsing. Use MPS format to capture full model detail. +Minimize + __pwl(w(1,1)) + __pwl(w(1,2)) + __pwl(w(1,3)) + __pwl(w(1,4)) + + __pwl(w(1,5)) + __pwl(w(1,6)) + __pwl(w(1,7)) + __pwl(w(1,8)) + + __pwl(w(1,9)) + __pwl(w(1,10)) +Subject To + R0: 66 w(1,1) + 85 w(1,2) + 12 w(1,3) + 3 w(1,4) + 7 w(1,5) + 98 w(1,6) + + 69 w(1,7) + 7 w(1,8) + 79 w(1,9) + 20 w(1,10) <= 22300 + R1: w(1,1) <= 100 + R2: w(1,2) <= 100 + R3: w(1,3) <= 100 + R4: w(1,4) <= 100 + R5: w(1,5) <= 100 + R6: w(1,6) <= 100 + R7: w(1,7) <= 100 + R8: w(1,8) <= 100 + R9: w(1,9) <= 100 + R10: w(1,10) <= 100 +Bounds +PWLObj + w(1,1): (0, 0) (0.00100497664181339, 0) (0.00100497664181339, 0) + (0.0183148958241241, -1.58798e-05) (0.0183148958241241, -1.58794e-05) + (0.0722547444659632, -2.4714871222250557e-04) + (0.0722547444659632, -2.4714871219485212e-04) + (0.2707126578037662, -0.00346920865949329) + (0.2707126578037662, -0.00346920865858439) + (1.011059867203085, -0.0483721426122064) + (1.011059867203085, -0.0483721426119305) + (3.798072296936303, -0.6788025175853192) + (3.798072296936303, -0.6788025175727084) + (15.9255252339291, -10.80872516587127) + (15.9255252339291, -11.10741379224582) + (36.47864428697302, -38.05788170074451) + (36.47864428697302, -38.05758448924624) + (46.14291673660328, -44.24756593021778) + (46.14291673660328, -44.32578101081694) + (54.32119140740574, -46.70680601361988) + (54.32119140740574, -46.51980486768328) + (69.74132591320534, -47.08283169110208) + (69.74132591320534, -46.92593828846264) + (89.98861268668944, -58.72328804206435) + (89.98861268668944, -58.72328804206334) + (96.0575915156751, -68.60972959084388) + (96.0575915156751, -68.60972959084322) (100, -77.84403731319327) + w(1,2): (0, 0) (0.00100497664181339, 0) (0.00100497664181339, 0) + (0.0183148958241241, -1.34895e-05) (0.0183148958241241, -1.34892e-05) + (0.0722547444659632, -2.0994741873072925e-04) + (0.0722547444659632, -2.099474187072383e-04) + (0.2707126578037664, -0.00294701678414242) + (0.2707126578037664, -0.00294701678337033) + (1.011059867203087, -0.0410910758489588) + (1.011059867203087, -0.0410910758487244) + (3.798072296936308, -0.5766278736126105) + (3.798072296936308, -0.5766278736018982) + (15.92552523392913, -9.181775328457125) + (15.92552523392913, -9.435504775588957) + (36.47864428697304, -32.3293370763644) + (36.47864428697304, -32.32908460170523) + (46.1429167366033, -37.58733828159129) + (46.1429167366033, -37.65378027973055) + (54.32119140740598, -39.67640887761607) + (54.32119140740598, -39.51755549927541) + (69.74132591320537, -39.99583445606202) + (69.74132591320537, -39.86255694632377) + (89.98861268668949, -49.8841472121975) + (89.98861268668949, -49.88414721219671) (100, -69.48738614038332) + w(1,3): (0, 0) (0.00100497664181339, 0) (0.00100497664181339, 0) + (0.0183148958241241, -1.707e-05) (0.0183148958241241, -1.70697e-05) + (0.0722547444659632, -2.6567324674041349e-04) + (0.0722547444659632, -2.6567324671068759e-04) + (0.2707126578037662, -0.00372923621531058) + (0.2707126578037662, -0.00372923621433355) + (1.011059867203085, -0.0519977792480076) + (1.011059867203085, -0.0519977792477109) + (3.798072296936303, -0.7296807946953832) + (3.798072296936303, -0.7296807946818276) + (15.92552523392909, -11.61887141599415) + (15.92552523392909, -17.43168814605093) + (69.74132591320534, -75.6681472818323) + (69.74132591320534, -50.44317758861016) + (89.98861268668946, -63.12477395942136) + (89.98861268668946, -63.12477395942027) + (96.05759151567499, -73.7522338452283) + (96.05759151567499, -73.75223384522755) (100, -83.67868052558973) + w(1,4): (0, 0) (0.00100497664181339, 0) (0.00100497664181339, 0) + (0.0183148958241241, -4.17802e-06) (0.0183148958241241, -4.17794e-06) + (0.0722547444659632, -6.50257e-05) (0.0722547444659632, -6.50257e-05) + (0.2707126578037659, -0.000912761) (0.2707126578037659, -0.000912761) + (1.011059867203084, -0.0127268798581597) + (1.011059867203084, -0.012726879858087) + (3.798072296936299, -0.178595315861503) + (3.798072296936299, -0.1785953158581849) + (15.92552523392907, -2.843813384673137) + (15.92552523392907, -4.266547609688488) + (69.74132591320534, -18.520395168267) + (69.74132591320534, -12.34637844381892) + (89.98861268668946, -15.45030241432527) + (89.98861268668946, -15.45030241432501) + (96.05759151567507, -18.05145975450651) + (96.05759151567507, -18.05145975450633) (100, -20.48103840471842) + w(1,5): (0, 0) (0.00100497664181339, 0) (0.00100497664181339, 0) + (0.0183148958241241, -2.31441e-06) (0.0183148958241241, -2.31436e-06) + (0.0722547444659632, -3.60209e-05) (0.0722547444659632, -3.60209e-05) + (0.2707126578037659, -0.000505623) (0.2707126578037659, -0.000505623) + (1.011059867203083, -0.00705004220509872) + (1.011059867203083, -0.0070500422050585) + (3.798072296936297, -0.0989326943044312) + (3.798072296936297, -0.0989326943025933) + (15.92552523392907, -1.575327543656832) + (15.92552523392907, -1.772242805649195) + (46.14291673660333, -7.211499460883049) + (46.14291673660333, -6.564670513996535) + (69.74132591320534, -7.118161670900169) + (69.74132591320534, -6.839263832072592) + (89.98861268668946, -8.558679371259718) + (89.98861268668946, -8.558679371259572) + (96.0575915156752, -9.999587844880864) + (96.0575915156752, -9.999587844880764) (100, -11.34545047700264) + w(1,6): (0, 0) (0.00100497664181339, 0) (0.00100497664181339, 0) + (0.0183148958241241, 0) (0.0183148958241241, 0) + (0.0722547444659633, -1.48464e-06) (0.0722547444659633, -1.48464e-06) + (0.2707126578037663, -2.08397e-05) (0.2707126578037663, -2.08397e-05) + (1.011059867203086, -2.9057426715499001e-04) + (1.011059867203086, -2.9057426715333183e-04) + (3.798072296936304, -0.00407760610629935) + (3.798072296936304, -0.00407760610622361) + (15.9255252339291, -0.0649286391783727) + (15.9255252339291, -0.0974118526130548) + (69.74132591320534, -0.4228491439706388) + (69.74132591320534, -0.2818868338755263) (100, -0.6512720552453671) + w(1,7): (0, 0) (0.00100497664181339, 0) (0.00100497664181339, 0) + (0.0183148958241241, -1.29143e-05) (0.0183148958241241, -1.2914e-05) + (0.0722547444659632, -2.0099465064133288e-04) + (0.0722547444659632, -2.0099465061884365e-04) + (0.2707126578037664, -0.00282134742376879) + (0.2707126578037664, -0.00282134742302963) + (1.011059867203086, -0.0393388329547922) + (1.011059867203086, -0.0393388329545677) + (3.798072296936306, -0.5520387852706542) + (3.798072296936306, -0.5520387852603985) + (15.92552523392909, -8.790237744134371) + (15.92552523392909, -9.033147430245297) + (36.47864428697302, -30.95072018705727) + (36.47864428697302, -30.95047847865132) + (46.1429167366033, -35.9845049399517) + (46.1429167366033, -36.04811365819483) + (54.32119140740592, -37.98449149444998) + (54.32119140740592, -37.83241208582565) + (69.74132591320534, -38.29029583790799) + (69.74132591320534, -38.16270166851959) + (89.98861268668946, -47.75694220044685) + (89.98861268668946, -47.75694220044603) (100, -66.52424204928555) + w(1,8): (0, 0) (0.00100497664181339, 0) (0.00100497664181339, 0) + (0.0183148958241241, -2.41462e-06) (0.0183148958241241, -2.41457e-06) + (0.0722547444659631, -3.75805e-05) (0.0722547444659631, -3.75805e-05) + (0.270712657803766, -5.2751514154907866e-04) + (0.270712657803766, -5.2751514141087443e-04) + (1.011059867203083, -0.00735529054652978) + (1.011059867203083, -0.0073552905464878) + (3.798072296936298, -0.1032162205545143) + (3.798072296936298, -0.1032162205525969) + (15.92552523392905, -1.643535095600864) + (15.92552523392905, -1.848976272102243) + (46.1429167366033, -7.523738478129424) + (46.1429167366033, -6.848903533905204) + (69.74132591320532, -7.426359406583082) + (69.74132591320532, -7.135386022637595) + (89.98861268668944, -8.929247746159342) + (89.98861268668944, -8.929247746159188) + (96.05759151567518, -10.43254377845478) + (96.05759151567518, -10.43254377845468) (100, -11.83667873353543) + w(1,9): (0, 0) (0.00100497664181339, 0) (0.00100497664181339, 0) + (0.0183148958241241, -1.7131e-05) (0.0183148958241241, -1.71307e-05) + (0.0722547444659632, -2.6662345614042899e-04) + (0.0722547444659632, -2.6662345611059689e-04) + (0.2707126578037663, -0.00374257423616945) + (0.2707126578037663, -0.00374257423518893) + (1.011059867203086, -0.0521837549878595) + (1.011059867203086, -0.0521837549875616) + (3.798072296936302, -0.732290577797886) + (3.798072296936302, -0.7322905777842812) + (15.92552523392908, -11.66042757933577) + (15.92552523392908, -11.70955209715275) + (33.48044771499282, -36.94053911942754) + (33.48044771499282, -36.9401947312544) + (36.47864428697302, -39.81230391301386) + (36.47864428697302, -41.05643366550878) + (46.1429167366033, -47.73417125271137) + (46.1429167366033, -47.81854949981663) + (54.32119140740604, -50.38719373710711) + (54.32119140740604, -50.18545733563656) + (69.74132591320534, -50.79284936373882) + (69.74132591320534, -50.62359312573867) + (89.98861268668951, -63.35054661182815) + (89.98861268668951, -63.35054661182707) (100, -84.74456773502968) + w(1,10): (0, 0) (0.00100497664181339, 0) (0.00100497664181339, 0) + (0.0183148958241241, -1.58456e-05) (0.0183148958241241, -1.58453e-05) + (0.0722547444659632, -2.4661750248128193e-04) + (0.0722547444659632, -2.4661750245368811e-04) + (0.2707126578037664, -0.00346175210664425) + (0.2707126578037664, -0.0034617521057373) + (1.011059867203086, -0.0482681738189711) + (1.011059867203086, -0.0482681738186957) + (3.79807229693631, -0.6773435315907518) + (3.79807229693631, -0.6773435315781686) + (15.92552523392914, -10.78549340372015) + (15.92552523392914, -16.18137861962488) + (69.74132591320537, -70.24075524723358) + (69.74132591320537, -46.82507789833261) + (89.98861268668944, -58.59707098689901) + (89.98861268668944, -58.59707098689798) + (96.05759151567509, -68.46226308627) + (96.05759151567509, -68.46226308626936) (100, -77.67672302478371) +End diff --git a/pbMCND_4_4_1_eps_grb.lp b/pbMCND_4_4_1_eps_grb.lp new file mode 100644 index 0000000..856f8b8 --- /dev/null +++ b/pbMCND_4_4_1_eps_grb.lp @@ -0,0 +1,81 @@ +\ Model pbmcnd_4_4_1_4_grb.lp +\ LP format - for model browsing. Use MPS format to capture full model detail. +Minimize + __pwl(w(1)) + __pwl(w(2)) + __pwl(w(3)) + __pwl(w(4)) +Subject To + R0: - w(1) <= 0 + R1: xx(1,1) + xx(2,1) = 4400 + R2: - w(2) + xx(1,1) <= 0 + R3: - xx(1,1) + xx(3,1) = 0 + R4: - w(3) + xx(2,1) <= 0 + R5: - xx(2,1) + xx(4,1) = 0 + R6: - w(4) + xx(3,1) + xx(4,1) <= 0 + R7: - xx(3,1) - xx(4,1) = -4400 + R8: xx(1,1) <= 3000 + R9: xx(2,1) <= 3000 + R10: xx(3,1) <= 3000 + R11: xx(4,1) <= 3000 +Bounds + w(1) <= 3000 + w(2) <= 2538 + w(3) <= 3471 + w(4) <= 5000 + xx(1,1) <= 3000 + xx(2,1) <= 3000 + xx(3,1) <= 3000 + xx(4,1) <= 3000 +PWLObj + w(1): (0, 0) (0.0301492992544017, 0) (0.0301492992544017, -0.000140823) + (1.771069327029144, 0.0011163743859063) + (1.771069327029144, 0.00111635493658418) + (10.5963463979175, 0.044874146407175) + (10.5963463979175, 0.044874006206622) + (61.83248456053261, 1.532078529957809) + (61.83248456053261, 1.532078529955966) + (365.6355153849695, 52.89455536855384) + (365.6355153849695, 98.16354945469749) (3000, 1994.722323334137) + w(2): (0, 0) (0.0255063071692238, 0) + (0.0255063071692238, -1.156743401672986e-04) + (1.498324650666656, 9.1700817672289475e-04) + (1.498324650666656, 9.1699220073165541e-04) + (8.964509052638203, 0.0368603576885485) + (8.964509052638203, 0.0368602425255215) + (52.31028193821063, 1.258474358682417) + (52.31028193821063, 1.258474358680903) + (309.3276460156843, 43.44845276766947) + (309.3276460156843, 76.03487932368424) + (691.7776572782064, 360.6769367449212) + (691.7776572782064, 411.9638828451899) + (2414.578885627653, 2369.457260743314) + (2414.578885627653, 2369.623534644207) (2538, 2382.242425911711) + w(3): (0, 0) (0.0348827392373428, 0) + (0.0348827392373428, -1.8427919664303083e-04) + (2.04912721137272, 0.00146087308453356) + (2.04912721137272, 0.00146084763340216) + (12.25997278239055, 0.0587217276795909) + (12.25997278239055, 0.0587215442149604) + (71.5401846365362, 2.004858151586935) + (71.5401846365362, 2.004858151584525) + (423.0402913004099, 69.21713112717025) + (423.0402913004099, 103.8257890687939) + (1550.410513692416, 1182.555415173376) + (1550.410513692416, 1576.740806580142) + (2269.622566224396, 2751.942079253717) + (2269.622566224396, 2751.942079253717) + (2675.582771962077, 3278.075182665474) + (2675.582771962077, 3288.778016659812) (3471, 3786.778634545354) + w(4): (0, 0) (0.0502488320906695, 0) (0.0502488320906695, -6.58587e-05) + (2.95178221171524, 0.000522095) (2.95178221171524, 0.000522086) + (17.66057732986249, 0.020986301107974) + (17.66057732986249, 0.0209862355403531) + (103.054140934221, 0.7165074753514616) + (103.054140934221, 0.7165074753506007) + (609.3925256416154, 24.73720738584093) + (609.3925256416154, 37.10584409334402) + (2233.377288522649, 422.6283013181734) + (2233.377288522649, 563.5044931549867) + (3854.195868571132, 1175.361973535678) + (3854.195868571132, 1175.361973535678) + (4483.182926771389, 1314.100650871111) + (4483.182926771389, 1314.10065092259) (5000, 1360.662411716183) +End diff --git a/pbUFLPnlass_5_5_grb.lp b/pbUFLPnlass_5_5_grb.lp new file mode 100644 index 0000000..efb5de7 --- /dev/null +++ b/pbUFLPnlass_5_5_grb.lp @@ -0,0 +1,419 @@ +\ Model pbUFLPnlass_5_5_grb.lp +\ LP format - for model browsing. Use MPS format to capture full model detail. +Minimize + __pwl(w(1,1)) + __pwl(w(1,2)) + __pwl(w(1,3)) + __pwl(w(1,4)) + + __pwl(w(1,5)) + __pwl(w(2,1)) + __pwl(w(2,2)) + __pwl(w(2,3)) + + __pwl(w(2,4)) + __pwl(w(2,5)) + __pwl(w(3,1)) + __pwl(w(3,2)) + + __pwl(w(3,3)) + __pwl(w(3,4)) + __pwl(w(3,5)) + __pwl(w(4,1)) + + __pwl(w(4,2)) + __pwl(w(4,3)) + __pwl(w(4,4)) + __pwl(w(4,5)) + + __pwl(w(5,1)) + __pwl(w(5,2)) + __pwl(w(5,3)) + __pwl(w(5,4)) + + __pwl(w(5,5)) + 366 y(1) + 314 y(2) + 504 y(3) + 504 y(4) + 580 y(5) +Subject To + R0: w(1,1) + w(2,1) + w(3,1) + w(4,1) + w(5,1) >= 1 + R6: w(1,2) + w(2,2) + w(3,2) + w(4,2) + w(5,2) >= 1 + R12: w(1,3) + w(2,3) + w(3,3) + w(4,3) + w(5,3) >= 1 + R18: w(1,4) + w(2,4) + w(3,4) + w(4,4) + w(5,4) >= 1 + R24: w(1,5) + w(2,5) + w(3,5) + w(4,5) + w(5,5) >= 1 +Lazy Constraints + R1: w(1,1) - y(1) <= 0 + R2: w(2,1) - y(2) <= 0 + R3: w(3,1) - y(3) <= 0 + R4: w(4,1) - y(4) <= 0 + R5: w(5,1) - y(5) <= 0 + R7: w(1,2) - y(1) <= 0 + R8: w(2,2) - y(2) <= 0 + R9: w(3,2) - y(3) <= 0 + R10: w(4,2) - y(4) <= 0 + R11: w(5,2) - y(5) <= 0 + R13: w(1,3) - y(1) <= 0 + R14: w(2,3) - y(2) <= 0 + R15: w(3,3) - y(3) <= 0 + R16: w(4,3) - y(4) <= 0 + R17: w(5,3) - y(5) <= 0 + R19: w(1,4) - y(1) <= 0 + R20: w(2,4) - y(2) <= 0 + R21: w(3,4) - y(3) <= 0 + R22: w(4,4) - y(4) <= 0 + R23: w(5,4) - y(5) <= 0 + R25: w(1,5) - y(1) <= 0 + R26: w(2,5) - y(2) <= 0 + R27: w(3,5) - y(3) <= 0 + R28: w(4,5) - y(4) <= 0 + R29: w(5,5) - y(5) <= 0 +Bounds + y(1) free + y(2) free + y(3) free + y(4) free + y(5) free +Binaries + y(1) y(2) y(3) y(4) y(5) +PWLObj + w(1,1): (0, 0) (1.00498e-05, 0) (1.00498e-05, -1.25262e-05) + (5.9035644234304847e-04, 9.93012e-05) + (5.9035644234304847e-04, 9.92994e-05) + (0.00353211546597251, 0.00399154227364541) + (0.00353211546597251, 0.00399152980284699) + (0.0206108281868443, 0.1362779397157141) + (0.0206108281868443, 0.1362779397155501) + (0.1218785051283237, 4.704955318448203) + (0.1218785051283237, 8.233681226221591) + (0.2725680288724228, 39.05706103860065) + (0.2725680288724228, 44.61083279456483) + (0.9513707193174361, 256.5842931250572) + (0.9513707193174361, 256.6022986286938) (1, 257.9687758171782) + w(1,2): (0, 0) (1.00498e-05, 0) (1.00498e-05, -1.15144e-05) + (5.9035644234304847e-04, 9.12807e-05) + (5.9035644234304847e-04, 9.12791e-05) + (0.00353211546597251, 0.0036691484746202) + (0.00353211546597251, 0.00366913701107858) + (0.0206108281868443, 0.1252708753540603) + (0.0206108281868443, 0.1252708753539096) + (0.1218785051283236, 4.324939696573541) + (0.1218785051283236, 7.568653127180609) + (0.2725680288724228, 35.90245226240597) + (0.2725680288724228, 41.00765014577307) + (0.9513707193174361, 235.8601771418798) + (0.9513707193174361, 235.8767283548377) (1, 237.1328362319446) + w(1,3): (0, 0) (1.00498e-05, 0) (1.00498e-05, -2.01382e-05) + (5.9035644234304847e-04, 1.5964573838824254e-04) + (5.9035644234304847e-04, 0.000159643) + (0.00353211546597251, 0.00641717180916839) + (0.00353211546597251, 0.00641715175996171) + (0.0206108281868443, 0.2190929953891098) + (0.0206108281868443, 0.2190929953888465) + (0.1218785051283237, 7.564120473505197) + (0.1218785051283237, 13.23722597138703) + (0.2725680288724232, 62.79173659282738) + (0.2725680288724232, 71.72049272356982) + (0.9513707193174361, 412.5085943318223) + (0.9513707193174361, 412.5375416415154) (1, 414.7344165060788) + w(1,4): (0, 0) (1.00498e-05, 0) (1.00498e-05, -2.68349e-05) + (5.9035644234304847e-04, 2.1273367531639018e-04) + (5.9035644234304847e-04, 0.00021273) + (0.00353211546597251, 0.0085511117170019) + (0.00353211546597251, 0.00855108500071453) + (0.0206108281868443, 0.2919492785448183) + (0.0206108281868443, 0.2919492785444675) + (0.1218785051283236, 10.07946197067558) + (0.1218785051283236, 17.63907862694394) + (0.2725680288724225, 83.67224230192505) + (0.2725680288724225, 95.5701302560483) + (0.9513707193174361, 549.6825048871407) + (0.9513707193174361, 549.7210782160863) (1, 552.6484928083395) + w(1,5): (0, 0) (1.00498e-05, 0) (1.00498e-05, -1.66694e-05) + (5.9035644234304858e-04, 0.000132147) + (5.9035644234304858e-04, 1.3214464866853506e-04) + (0.00353211546597251, 0.00531182164108197) + (0.00353211546597251, 0.00531180504532716) + (0.0206108281868443, 0.1813544890062968) + (0.0206108281868443, 0.181354489006079) + (0.1218785051283239, 6.261209769934942) + (0.1218785051283239, 10.957129631818) + (0.2725680288724233, 51.97593507444563) + (0.2725680288724233, 59.36672364199801) + (0.9513707193174361, 341.4544823894985) + (0.9513707193174361, 341.4784435597232) (1, 343.2969093567064) + w(2,1): (0, 0) (1.00498e-05, 0) (1.00498e-05, 0) + (5.9035644234304847e-04, 6.14903e-05) + (5.9035644234304847e-04, 6.14893e-05) + (0.00353211546597251, 0.00247168579252658) + (0.00353211546597251, 0.00247167807022449) + (0.0206108281868443, 0.084387493439346) + (0.0206108281868443, 0.0843874934392445) + (0.1218785051283237, 2.91345310103908) + (0.1218785051283237, 5.462736381648567) + (0.2098758511052353, 15.78325674050166) + (0.2098758511052353, 15.78325671580131) + (0.2725680288724228, 27.64033031442283) + (0.2725680288724228, 26.77662040819444) + (0.4654665511580453, 68.75194144846212) + (0.4654665511580453, 70.96975484101689) + (0.7782194765912979, 139.6365409070694) + (0.7782194765912979, 139.6365409070694) + (0.9513707193174361, 158.6623904648945) + (0.9513707193174361, 158.8960387662296) (1, 159.7422034867911) + w(2,2): (0, 0) (1.00498e-05, 0) (1.00498e-05, -1.38751e-05) + (5.9035644234304847e-04, 1.099951498942915e-04) + (5.9035644234304847e-04, 1.0999323357380978e-04) + (0.0035321154659725, 0.00442140067234568) + (0.0035321154659725, 0.0044213868585382) + (0.0206108281868443, 0.1509540255312526) + (0.0206108281868443, 0.2264508625338947) + (0.0620568436173463, 2.046639934643703) + (0.0620568436173463, 2.04663993464349) + (0.1218785051283237, 9.887408880288305) + (0.1218785051283237, 9.7718514156198) + (0.2098758511052354, 28.23340336189119) + (0.2098758511052354, 28.23340331770672) + (0.2725680288724233, 49.44357223946459) + (0.2725680288724233, 48.22578448265277) + (0.838160294067323, 265.3254546838187) + (0.838160294067323, 265.3258854611715) + (0.9513707193174361, 283.4712154720937) + (0.9513707193174361, 284.2363923271685) (1, 285.7500285974897) + w(2,3): (0, 0) (1.00498e-05, 0) (1.00498e-05, -2.73649e-05) + (5.9035644234304847e-04, 2.1693487895818608e-04) + (5.9035644234304847e-04, 0.000216931) + (0.00353211546597251, 0.00871998465934843) + (0.00353211546597251, 0.00871995741545034) + (0.0206108281868443, 0.297714883686637) + (0.0206108281868443, 0.4466114233307361) + (0.0620568436173463, 4.036428759991752) + (0.0620568436173463, 4.036428759991338) + (0.1218785051283237, 19.50016751390193) + (0.1218785051283237, 17.98742667882255) + (0.2725680288724229, 85.32465642278916) + (0.2725680288724229, 97.45751164351095) + (0.9513707193174361, 560.5379942116638) + (0.9513707193174361, 560.5773293119155) (1, 497.0000564477768) + w(2,4): (0, 0) (1.00498e-05, 0) (1.00498e-05, -1.82593e-05) + (5.9035644234304847e-04, 1.4475056184005722e-04) + (5.9035644234304847e-04, 0.000144748) + (0.0035321154659725, 0.00581844046812157) + (0.0035321154659725, 0.00581842228953465) + (0.0206108281868442, 0.1986513044317522) + (0.0206108281868442, 0.2980030447928678) + (0.0620568436173462, 2.693321302881811) + (0.0620568436173462, 2.693321302881532) + (0.1218785051283236, 13.01155543621271) + (0.1218785051283236, 12.00217378745377) + (0.2725680288724227, 56.93317743703705) + (0.2725680288724227, 63.03316232736448) + (0.4654665511580443, 161.8446323538326) + (0.4654665511580443, 167.0654477313376) + (0.7782194765912975, 328.7096211414861) + (0.7782194765912975, 328.7096211414861) + (0.9513707193174361, 364.169745076862) + (0.9513707193174361, 374.0471968472114) (1, 376.0391001335021) + w(2,5): (0, 0) (1.00498e-05, 0) (1.00498e-05, -1.88856e-05) + (5.9035644234304869e-04, 1.4971562068945244e-04) + (5.9035644234304869e-04, 0.000149713) + (0.00353211546597251, 0.00601801758180385) + (0.00353211546597251, 0.00601799877967701) + (0.0206108281868443, 0.2054652014175384) + (0.0206108281868443, 0.3082247851155788) + (0.0620568436173463, 2.785704355487264) + (0.0620568436173463, 2.785704355486978) + (0.1218785051283237, 13.45786208705908) + (0.1218785051283237, 13.30057553792696) + (0.2098758511052354, 38.42879902035192) + (0.2098758511052354, 38.42879896021196) + (0.2725680288724228, 67.29819554814712) + (0.2725680288724228, 65.64065110138822) + (0.838160294067323, 361.1374244307535) + (0.838160294067323, 361.1380107665946) + (0.9513707193174361, 385.8358210592387) + (0.9513707193174361, 386.877311778646) (1, 388.937538924361) + w(3,1): (0, 0) (1.00498e-05, 0) (1.00498e-05, -3.23753e-05) + (5.9035644234304847e-04, 2.5665534975334684e-04) + (5.9035644234304847e-04, 2.5665087833888923e-04) + (0.00353211546597251, 0.0103166015688066) + (0.00353211546597251, 0.0103165693365892) + (0.0206108281868443, 0.3522260595729227) + (0.0206108281868443, 0.5283853459124206) + (0.0620568436173463, 4.775493180835308) + (0.0620568436173463, 4.775493180834815) + (0.1218785051283237, 23.07062072067271) + (0.1218785051283237, 22.56787726088179) (1, 458.5882317073351) + w(3,2): (0, 0) (1.00498e-05, 0) (1.00498e-05, -1.29116e-05) + (5.9035644234304858e-04, 1.0235659781829908e-04) + (5.9035644234304858e-04, 1.0235481457562844e-04) + (0.0035321154659725, 0.00411435895898834) + (0.0035321154659725, 0.00411434610447305) + (0.0206108281868442, 0.1404711070915821) + (0.0206108281868442, 0.1404711070914132) + (0.1218785051283236, 4.849723174400455) + (0.1218785051283236, 8.487027161461377) + (0.2725679398108412, 40.25879398392044) + (0.2725679398108412, 40.25879385929019) + (0.4466754577045304, 110.4524136025373) + (0.4466754577045304, 110.4749116060984) + (0.7708391737142266, 230.4294139777336) + (0.7708391737142266, 230.4294139777336) + (0.8966365853542819, 257.6290961473729) + (0.8966365853542819, 257.6290961574653) (1, 266.7575174396026) + w(3,3): (0, 0) (1.00498e-05, 0) (1.00498e-05, 0) + (5.9035644234304847e-04, 4.65952e-05) + (5.9035644234304847e-04, 4.65944e-05) + (0.00353211546597251, 0.00187295445147977) + (0.00353211546597251, 0.00187294859979743) + (0.0206108281868443, 0.0639458024819889) + (0.0206108281868443, 0.063945802481912) + (0.1218785051283237, 2.20770980327185) + (0.1218785051283237, 3.863496575380901) + (0.2725680288724229, 18.3267747950357) + (0.2725680288724229, 20.29035832173741) + (0.4654665511580108, 52.09774445162347) + (0.4654665511580108, 53.77832354411834) + (0.7782194765912855, 105.8115403146722) + (0.7782194765912855, 105.8115403146722) + (0.9513707193174361, 120.228643706318) + (0.9513707193174361, 120.4056939719255) (1, 121.0468871142144) + w(3,4): (0, 0) (1.00498e-05, 0) (1.00498e-05, -1.42124e-05) + (5.9035644234304847e-04, 1.1266864312088886e-04) + (5.9035644234304847e-04, 1.1266668022317345e-04) + (0.0035321154659725, 0.00452886527202075) + (0.0035321154659725, 0.004528851122461) + (0.0206108281868442, 0.1546230469851369) + (0.0206108281868442, 0.154623046984951) + (0.1218785051283236, 5.338314688239305) + (0.1218785051283236, 8.007479156939702) + (0.4466754577045336, 91.20362025520328) + (0.4466754577045336, 121.604846730595) + (0.7708391737142279, 253.6443176247444) + (0.7708391737142279, 253.6443176247445) + (0.8966365853542828, 283.5842662816233) + (0.8966365853542828, 283.5842662927324) (1, 293.6323419577715) + w(3,5): (0, 0) (1.00498e-05, 0) (1.00498e-05, -1.65731e-05) + (5.9035644234304847e-04, 0.000131383) + (5.9035644234304847e-04, 1.3138080676871743e-04) + (0.0035321154659725, 0.00528111746974623) + (0.0035321154659725, 0.00528110096992063) + (0.0206108281868443, 0.1803061971623294) + (0.0206108281868443, 0.1803061971621125) + (0.1218785051283237, 6.225017805946855) + (0.1218785051283237, 10.89379605799521) + (0.2725679398108413, 51.67546690473374) + (0.2725679398108413, 51.67546674476058) + (0.4466754577045314, 141.7747398480339) + (0.4466754577045314, 141.8036178824552) + (0.7708391737142271, 295.7750686878373) + (0.7708391737142271, 295.7750686878373) + (0.8966365853542823, 330.6880935622995) + (0.8966365853542823, 330.688093575254) (1, 342.4051716388929) + w(4,1): (0, 0) (1.00498e-05, 0) (1.00498e-05, 0) + (5.9035644234304847e-04, 5.46156e-05) + (5.9035644234304847e-04, 5.46147e-05) + (0.00353211546597251, 0.00219534825050498) + (0.00353211546597251, 0.00219534139156585) + (0.0206108281868443, 0.0749528668436429) + (0.0206108281868443, 0.074952866843553) + (0.1218785051283238, 2.587725425146521) + (0.1218785051283238, 4.528524674421886) + (0.2725680288724234, 21.48138357123043) + (0.2725680288724234, 23.94544160076163) + (0.838160294067323, 131.741458402035) + (0.838160294067323, 131.7416722949567) + (0.9513707193174361, 132.3105743435466) + (0.9513707193174361, 141.1312642457816) (1, 141.882826699448) + w(4,2): (0, 0) (1.00498e-05, 0) (1.00498e-05, -1.89338e-05) + (5.9035644234304847e-04, 1.50097548293252e-04) + (5.9035644234304847e-04, 0.000150095) + (0.0035321154659725, 0.00603336966747171) + (0.0035321154659725, 0.00603335081738025) + (0.0206108281868443, 0.2059893473395217) + (0.0206108281868443, 0.205989347339274) + (0.1218785051283236, 7.1117209236544) + (0.1218785051283236, 12.4455258534811) + (0.2725680288724227, 59.03624995450015) + (0.2725680288724227, 67.43098957024606) + (0.9513707193174361, 387.8370276851829) + (0.9513707193174361, 387.8642436964491) (1, 343.8750390562968) + w(4,3): (0, 0) (1.00498e-05, 0) (1.00498e-05, 0) + (5.9035644234304847e-04, 1.10759e-05) + (5.9035644234304847e-04, 1.10757e-05) + (0.0035321154659725, 4.4521048436814149e-04) + (0.0035321154659725, 0.000445209) + (0.0206108281868443, 0.015200231737522) + (0.0206108281868443, 0.0152002317375037) + (0.1218785051283237, 0.5247834778269157) + (0.1218785051283237, 0.9183721367708706) + (0.272568028872423, 4.356364500459308) + (0.272568028872423, 4.975823657855316) + (0.9513707193174361, 28.61901731010249) + (0.9513707193174361, 28.62102561627739) (1, 28.77344037960834) + w(4,4): (0, 0) (1.00498e-05, 0) (1.00498e-05, -3.16045e-05) + (5.9035644234304847e-04, 2.505445080925529e-04) + (5.9035644234304847e-04, 2.5054014314034468e-04) + (0.0035321154659725, 0.0100709681981207) + (0.0035321154659725, 0.010070936733337) + (0.0206108281868443, 0.3438397248211862) + (0.0206108281868443, 0.5158047424383152) + (0.0620568436173463, 4.661790962243987) + (0.0620568436173463, 4.661790962243501) + (0.1218785051283236, 22.52132022732333) + (0.1218785051283236, 20.77421109385138) + (0.2725680288724227, 98.54396938969998) + (0.2725680288724227, 112.5565627432096) + (0.9513707193174361, 647.381908807836) + (0.9513707193174361, 647.4273380785512) (1, 574.000065193208) + w(4,5): (0, 0) (1.00498e-05, 0) (1.00498e-05, -3.15081e-05) + (5.9035644234304847e-04, 2.4978065288495363e-04) + (5.9035644234304847e-04, 2.4977630124052683e-04) + (0.0035321154659725, 0.010040264026785) + (0.0035321154659725, 0.0100402326579305) + (0.0206108281868443, 0.3427914329772191) + (0.0206108281868443, 0.3427914329768074) + (0.1218785051283235, 11.83477222409662) + (0.1218785051283235, 20.7108750844189) + (0.272568028872423, 98.24353045863407) + (0.272568028872423, 112.213402490944) + (0.9513707193174361, 645.408183476105) + (0.9513707193174361, 645.4534742429455) (1, 572.2500649944479) + w(5,1): (0, 0) (1.00498e-05, 0) (1.00498e-05, -1.13217e-05) + (5.9035644234304847e-04, 8.9753e-05) + (5.9035644234304847e-04, 8.97514e-05) + (0.0035321154659725, 0.00360774013194873) + (0.0035321154659725, 0.00360772886026554) + (0.0206108281868442, 0.123174291666126) + (0.0206108281868442, 0.1231742916659778) + (0.1218785051283235, 4.252555768597407) + (0.1218785051283235, 7.441981108315654) + (0.2725680288724222, 35.30157440027352) + (0.2725680288724222, 40.32132964124114) + (0.9513707193174361, 231.9127264784169) + (0.9513707193174361, 231.929000683627) (1, 205.6250233542739) + w(5,2): (0, 0) (1.00498e-05, 0) (1.00498e-05, -1.58504e-05) + (5.9035644234304847e-04, 1.2565418165007608e-04) + (5.9035644234304847e-04, 0.000125652) + (0.00353211546597251, 0.00505083618472823) + (0.00353211546597251, 0.00505082040437177) + (0.0206108281868443, 0.1724440083325767) + (0.0206108281868443, 0.1724440083323693) + (0.1218785051283237, 5.953578076036385) + (0.1218785051283237, 10.41877355164194) + (0.2725680288724225, 49.422204160383) + (0.2725680288724225, 56.44986149773771) + (0.9513707193174361, 324.6778170697838) + (0.9513707193174361, 324.700600957078) (1, 287.8750326959837) + w(5,3): (0, 0) (1.00498e-05, 0) (1.00498e-05, -3.08336e-05) + (5.9035644234304858e-04, 2.4443366643175896e-04) + (5.9035644234304858e-04, 2.4442940794179948e-04) + (0.00353211546597251, 0.00982533482743485) + (0.00353211546597251, 0.0098253041300849) + (0.0206108281868443, 0.33545339006945) + (0.0206108281868443, 0.3354533900690471) + (0.1218785051283237, 11.5814284761802) + (0.1218785051283237, 20.26752301839161) + (0.272568028872423, 96.14045794117095) + (0.272568028872423, 109.8112807250829) + (0.9513707193174361, 631.5921061539863) + (0.9513707193174361, 631.6364273937081) (1, 560.0000636031293) + w(5,4): (0, 0) (1.00498e-05, 0) (1.00498e-05, -2.49078e-05) + (5.9035644234304858e-04, 1.9745657116440531e-04) + (5.9035644234304858e-04, 1.9745313110298502e-04) + (0.00353211546597251, 0.00793702829028722) + (0.00353211546597251, 0.00793700349258424) + (0.0206108281868443, 0.2709834416654782) + (0.0206108281868443, 0.2709834416651529) + (0.1218785051283238, 9.355622690914332) + (0.1218785051283238, 16.37235843829449) + (0.2725680288724231, 77.66346368060218) + (0.2725680288724231, 88.706925210731) + (0.9513707193174361, 510.2079982525183) + (0.9513707193174361, 510.2438015039797) (1, 452.375051379403) + w(5,5): (0, 0) (1.00498e-05, 0) (1.00498e-05, -1.58504e-05) + (5.9035644234304847e-04, 1.2565418165007608e-04) + (5.9035644234304847e-04, 0.000125652) + (0.00353211546597251, 0.00505083618472823) + (0.00353211546597251, 0.00505082040437177) + (0.0206108281868443, 0.1724440083325767) + (0.0206108281868443, 0.1724440083323693) + (0.1218785051283237, 5.953578076036385) + (0.1218785051283237, 10.41877355164194) + (0.2725680288724225, 49.422204160383) + (0.2725680288724225, 56.44986149773771) + (0.9513707193174361, 324.6778170697838) + (0.9513707193174361, 324.700600957078) (1, 287.8750326959837) +End diff --git a/pbUFLPnldep_5_5_grb.lp b/pbUFLPnldep_5_5_grb.lp new file mode 100644 index 0000000..9248897 --- /dev/null +++ b/pbUFLPnldep_5_5_grb.lp @@ -0,0 +1,108 @@ +\ Model pbUFLPnldep_5_5_grb.lp +\ LP format - for model browsing. Use MPS format to capture full model detail. +Minimize + __pwl(w(1)) + __pwl(w(2)) + __pwl(w(3)) + __pwl(w(4)) + __pwl(w(5)) + + 260 x(1,1) + 239 x(1,2) + 418 x(1,3) + 557 x(1,4) + 346 x(1,5) + + 161 x(2,1) + 288 x(2,2) + 568 x(2,3) + 379 x(2,4) + 392 x(2,5) + + 672 x(3,1) + 268 x(3,2) + 122 x(3,3) + 295 x(3,4) + 344 x(3,5) + + 143 x(4,1) + 393 x(4,2) + 29 x(4,3) + 656 x(4,4) + 654 x(4,5) + + 235 x(5,1) + 329 x(5,2) + 640 x(5,3) + 517 x(5,4) + 329 x(5,5) +Subject To + R0: x(1,1) + x(2,1) + x(3,1) + x(4,1) + x(5,1) = 1 + R6: x(1,2) + x(2,2) + x(3,2) + x(4,2) + x(5,2) = 1 + R12: x(1,3) + x(2,3) + x(3,3) + x(4,3) + x(5,3) = 1 + R18: x(1,4) + x(2,4) + x(3,4) + x(4,4) + x(5,4) = 1 + R24: x(1,5) + x(2,5) + x(3,5) + x(4,5) + x(5,5) = 1 + R30: w(1) - 49 x(1,1) - 29 x(1,2) - 23 x(1,3) - 40 x(1,4) - 18 x(1,5) = 0 + R31: w(2) - 49 x(2,1) - 29 x(2,2) - 23 x(2,3) - 40 x(2,4) - 18 x(2,5) = 0 + R32: w(3) - 49 x(3,1) - 29 x(3,2) - 23 x(3,3) - 40 x(3,4) - 18 x(3,5) = 0 + R33: w(4) - 49 x(4,1) - 29 x(4,2) - 23 x(4,3) - 40 x(4,4) - 18 x(4,5) = 0 + R34: w(5) - 49 x(5,1) - 29 x(5,2) - 23 x(5,3) - 40 x(5,4) - 18 x(5,5) = 0 +Lazy Constraints + R1: - y(1) + x(1,1) <= 0 + R2: - y(2) + x(2,1) <= 0 + R3: - y(3) + x(3,1) <= 0 + R4: - y(4) + x(4,1) <= 0 + R5: - y(5) + x(5,1) <= 0 + R7: - y(1) + x(1,2) <= 0 + R8: - y(2) + x(2,2) <= 0 + R9: - y(3) + x(3,2) <= 0 + R10: - y(4) + x(4,2) <= 0 + R11: - y(5) + x(5,2) <= 0 + R13: - y(1) + x(1,3) <= 0 + R14: - y(2) + x(2,3) <= 0 + R15: - y(3) + x(3,3) <= 0 + R16: - y(4) + x(4,3) <= 0 + R17: - y(5) + x(5,3) <= 0 + R19: - y(1) + x(1,4) <= 0 + R20: - y(2) + x(2,4) <= 0 + R21: - y(3) + x(3,4) <= 0 + R22: - y(4) + x(4,4) <= 0 + R23: - y(5) + x(5,4) <= 0 + R25: - y(1) + x(1,5) <= 0 + R26: - y(2) + x(2,5) <= 0 + R27: - y(3) + x(3,5) <= 0 + R28: - y(4) + x(4,5) <= 0 + R29: - y(5) + x(5,5) <= 0 +Bounds + y(1) free + y(2) free + y(3) free + y(4) free + y(5) free +Binaries + y(1) y(2) y(3) y(4) y(5) +PWLObj + w(1): (0, 0) (0.00159791286048329, 0) (0.00159791286048329, -9.70467e-06) + (0.0471282365829873, 8.86375e-05) (0.0471282365829873, 8.86343e-05) + (0.2811759287272458, 0.00349458094137608) + (0.2811759287272458, 0.00349458057084532) + (1.640718029666514, 0.1192620662381446) + (1.640718029666514, 0.1192620662327337) + (9.727303853778347, 4.129327996195428) + (9.727303853778347, 8.258675627409364) + (92.7382763005877, 220.9332490853234) + (92.7382763005877, 178.3997967914661) (159, 284.8826566368758) + w(2): (0, 0) (0.00159791286048329, 0) (0.00159791286048329, -8.32587e-06) + (0.0471282365829873, 7.60442e-05) (0.0471282365829873, 7.60414e-05) + (0.2811759287272461, 0.00299808310271063) + (0.2811759287272461, 0.00299808278482359) + (1.640718029666516, 0.1023177289584084) + (1.640718029666516, 0.1023177289537665) + (9.727303853778354, 3.542647515861659) + (9.727303853778354, 7.085311877067058) + (92.73827630058807, 189.5438257180104) + (92.73827630058807, 153.0533775751922) (159, 244.4075250928393) + w(3): (0, 0) (0.00159791286048329, 0) (0.00159791286048329, -1.33638e-05) + (0.0471282365829873, 1.2205822305003229e-04) + (0.0471282365829873, 1.2205374559266476e-04) + (0.2811759287272459, 0.00481220982091133) + (0.2811759287272459, 0.00481220931067225) + (1.640718029666514, 0.1642297305574451) + (1.640718029666514, 0.1642297305499939) + (9.727303853778347, 5.686287732465837) + (9.727303853778347, 11.3726025033178) + (92.73827630058805, 304.2359495601186) + (92.73827630058805, 245.6652939423465) (159, 392.2974288114364) + w(4): (0, 0) (0.00159791286048329, 0) (0.00159791286048329, -1.33638e-05) + (0.0471282365829873, 1.2205822305003229e-04) + (0.0471282365829873, 1.2205374559266476e-04) + (0.2811759287272459, 0.00481220982091133) + (0.2811759287272459, 0.00481220931067225) + (1.640718029666514, 0.1642297305574451) + (1.640718029666514, 0.1642297305499939) + (9.727303853778347, 5.686287732465837) + (9.727303853778347, 11.37260250331781) + (69.13091919179129, 277.30164754803) + (69.13091919179129, 269.4946318823769) + (134.7850723979796, 324.4618201304042) + (134.7850723979796, 324.4618190704) (159, 485.736019229252) + w(5): (0, 0) (0.00159791286048329, 0) (0.00159791286048329, -1.5379e-05) + (0.0471282365829873, 1.4046382811313242e-04) + (0.0471282365829873, 1.4045867548362226e-04) + (0.281175928727246, 0.00553786050819161) (0.281175928727246, 0.00553786) + (1.640718029666516, 0.1889945311970601) + (1.640718029666516, 0.1889945311884855) + (9.727303853778359, 6.543743819107524) + (9.727303853778359, 10.715087150007) (159, 438.7115356094187) +End diff --git a/src/LinA.jl b/src/LinA.jl index 9b7cc92..6baaac4 100644 --- a/src/LinA.jl +++ b/src/LinA.jl @@ -1,9 +1,11 @@ - module LinA +module LinA -using Roots +# using Roots using Calculus using GeneralizedGenerated - +using IntervalArithmetic, IntervalRootFinding +using PrecompileTools +using Optim export Linearize , LinearBounding @@ -27,5 +29,13 @@ include("exactMethod.jl") include("linearizeDispatch.jl") include("bounding.jl") - +@setup_workload begin + f = x -> x * (x + 1) * log(x + 2) + 1 + @compile_workload begin + for e in [Relative(1e-1), Absolute(1e-1)], alg in [HeuristicLin, ExactLin], bounding in [Under, Over, Best] + pwl = Linearize(f, 0, 1, e, alg(); bounding = bounding()) + pwl(0.5, bounding) + end + end +end end # module diff --git a/src/convexConcaveSplit.jl b/src/convexConcaveSplit.jl index 9fdb233..59a9ca6 100644 --- a/src/convexConcaveSplit.jl +++ b/src/convexConcaveSplit.jl @@ -1,12 +1,4 @@ - - - - - - - - function ConcavitySplit(x1::Real,x2::Real,expr_fnc::Ef) - +function ConcavitySplit(x1::Real,x2::Real,expr_fnc::Ef) d2_f = Derive(Derive(expr_fnc)) #special case for constant second derivative typeof(d2_f) <: Number && return Float64[] @@ -15,7 +7,6 @@ f(x) = temp(x) try - return find_zeros(f,x1,x2) catch y #if the second derivative is almost zero on an interval diff --git a/src/convexCorridor.jl b/src/convexCorridor.jl index 3cfe0b4..fb8b929 100644 --- a/src/convexCorridor.jl +++ b/src/convexCorridor.jl @@ -10,47 +10,69 @@ Makes an optimal piecewise Linear approximation from x1 to x2 of a convex corrid - du : derivative of the upper function """ -function LinearizeConvex(x1,x2,lower::Function,upper::Function,du::Function) +function LinearizeConvex(x1,x2,e::ErrorType,lower::Function,upper::Function,du::Function) - tol = 0.00001 - slope = 0.0; - b = 0.0; + slope = 0.0 + b = 0.0 pwl = Array{LinearPiece}(undef, 0) - - lin(x) = slope * x + b #Δ represent the distance between the linear function and the bottom of the corridor - Δ(x) = lin(x) - lower(x) - #distance between the linear function and the bottom of the corridor at the start of the coridor if tangeant in "a" - f(a)= upper(a) + du(a)*(x1-a) - lower(x1) + Δ(x, (slope, b)) = slope * x + b - lower(x) - while x2 - x1 > tol + #distance between the linear function and the bottom of the corridor at the start of the coridor if tangeant in "a" + f(a, x1) = upper(a) + du(a) * (x1 - a) - lower(x1) - #find the tangence point if possible - if f(x2) >= 0 + while x2 - x1 > EPS + if f(x2, x1) >= 0.0 slope = (upper(x2) - lower(x1)) / (x2 - x1) b = lower(x1) - slope * x1 push!(pwl,LinearPiece(x1,x2,slope,b,ParaToFncLin(slope,b))) break end + + a = find_zero(x -> f(x, x1), x1, x2) + + # @assert(!isnan(a), "a is still NAN!, f(x1) = $(f(x1)), f(x2) = $(f(x2))") - a = find_zero(f,(x1,x2), Bisection()) slope = du(a) b = lower(x1) - slope * x1 #find the second end of the segment - if Δ(x2) <= 0 - nextX1 = find_zero(Δ,(a,x2),Bisection()) + if Δ(x2, (slope, b)) <= 0.0 + nextX1 = find_zero(x -> Δ(x, (slope, b)), a, x2) else nextX1 = x2 end push!(pwl,LinearPiece(x1,nextX1,slope,b,ParaToFncLin(slope,b))) - x1 = nextX1 end - return pwl end + +function perform_binary_sarch_lowf(f, x1, x2) + eps = 1e-3 + xp = x1 + for _ in 1:5 + t = 1 + eps + while f(xp) * f(x2) > 0 && abs(f(xp)) < EPS + xp = min(xp + t * EPS, x2) + t *= (1 + eps) + end + eps *= 0.5 + t = 1 + eps + while f(xp) * f(x2) < 0 || abs(f(xp)) > EPS + xp = max(xp - t * EPS, x1) + t *= (1 + eps) + end + eps *= 0.5 + end + t = 1 + eps + while f(xp) * f(x2) > 0 && abs(f(xp)) < EPS + xp = min(xp + t * EPS, x2) + t *= (1 + eps) + end + return xp +end diff --git a/src/corridorFromInfo.jl b/src/corridorFromInfo.jl index a5da28f..f09965a 100644 --- a/src/corridorFromInfo.jl +++ b/src/corridorFromInfo.jl @@ -27,7 +27,7 @@ function CorridorFromInfo(x1::Real,x2::Real,expr_fct::Ef,e::ErrorType,bounding:: df = y::Real -> TempEval(y) #note that Upper return the function and it's derivative - return x1,x2,Lower(x1,x2,f,e,bounding),Upper(x1,x2,f,df,e,bounding)... + return x1,x2,e,Lower(x1,x2,f,e,bounding),Upper(x1,x2,f,df,e,bounding)... end #In the case of underestimation or overestimation one of the bound is the function itself @@ -47,24 +47,26 @@ Upper(x1::Real,x2::Real,f::Function,df::Function,e::Absolute,::Over) = x::Real - #Relative error case -function Lower(x1::Real,x2::Real,f::Function,e::Relative,::Under;ε = 1e-5) +function Lower(x1::Real,x2::Real,f::Function,e::Relative,::Under;ε = EPS) # TODO ADD TOLERANCE as a parameter to the user # This 10.0^(-5) seems arbitrairy but commes from the litterature # and it helps to gives a sensible definition for a relative corridor that starts at y=0 if f((x1+x2)/2) >= 0 return x::Real -> f(x)*(1 - e.percent/100) - ε + else + return x::Real -> f(x)*(1 + e.percent/100) + ε end - return x::Real -> f(x)*(1 + e.percent/100) + ε end -function Upper(x1::Real,x2::Real,f::Function,df::Function,e::Relative,::Over;ε = 1e-5) +function Upper(x1::Real,x2::Real,f::Function,df::Function,e::Relative,::Over;ε = EPS) # TODO ADD TOLERANCE as a parameter to the user # This 10.0^(-5) seems arbitrairy but commes from the litterature # and it helps to gives a sensible definition for a relative corridor that starts at y=0 if f((x1+x2)/2) >= 0 - return x::Real -> f(x)*(1 + e.percent/100) + ε ,x->(1 + e.percent/100)*df(x)#f(x)*(1 + e.percent/100) + 10.0^(-5),x->(1 + e.percent/100)*df(x) + return x::Real -> f(x)*(1 + e.percent/100) + ε ,x->(1 + e.percent/100)*df(x)#f(x)*(1 + e.percent/100) + 10.0^(-5),x->(1 + e.percent/100)*df(x) + else + return x::Real -> f(x)*(1 - e.percent/100) - ε ,x->(1 - e.percent/100)*df(x)#f(x)*(1 - e.percent/100) + 10.0^(-5),x->(1 - e.percent/100)*df(x) end - return x::Real -> f(x)*(1 - e.percent/100) - ε ,x->(1 - e.percent/100)*df(x)#f(x)*(1 - e.percent/100) + 10.0^(-5),x->(1 - e.percent/100)*df(x) end diff --git a/src/exactMethod.jl b/src/exactMethod.jl index f0fd8da..d66d297 100644 --- a/src/exactMethod.jl +++ b/src/exactMethod.jl @@ -2,14 +2,16 @@ function ExactLin(expr_fct::Ef,x1::Real,x2::Real, e::ErrorType; bounding = Best() ::BoundingType, ConcavityChanges = [Inf]::Array{Float64,1} ) + + # println("running ExactLin") if x1 >= x2 return Float64[] end - if ConcavityChanges == [Inf] ConcavityChanges = ConcavitySplit(x1,x2,expr_fct) end + ConcavityChanges = [x1;ConcavityChanges;x2] ConcavityChanges = sort(unique(ConcavityChanges)) # make sure that the bounds are there pwl = Array{LinearPiece}(undef, 0) @@ -17,8 +19,9 @@ function ExactLin(expr_fct::Ef,x1::Real,x2::Real, e::ErrorType; bounding = Best( x2Temp = -1 i=1 + # println("entering while") while x1 < x2 - + # println("diff $(x2 - x1)") #find next concavity change i = searchsortedfirst(ConcavityChanges,x1) ConcavityChanges[i] == x1 ? x2Temp = ConcavityChanges[i+1] : x2Temp = ConcavityChanges[i] @@ -34,5 +37,6 @@ function ExactLin(expr_fct::Ef,x1::Real,x2::Real, e::ErrorType; bounding = Best( x1 = pwl[end].xMax end + # println("done") return pwl -end \ No newline at end of file +end diff --git a/src/exactPiece.jl b/src/exactPiece.jl index 31b3bf6..180adbb 100644 --- a/src/exactPiece.jl +++ b/src/exactPiece.jl @@ -11,21 +11,20 @@ Computes the maximal linear piece starting at `start` which lies in between `low - `lower` : lower bound of the corridor - `upper` : upper bound of the corridor """ -function ExactPiece(start::Real,maximum::Real,lower,upper) +function ExactPiece(start::Real,maximum::Real,e::ErrorType,lower,upper) #TODO: add epsilon as an argument for the user #TODO: If intersections are epsilon close skip intersections #numerical precision - epsilon = 1e-5 line = LinearPiece(0,0,0,0,x->0) pts = collect(range(start,maximum,length=50)) data = FctSample.(pts, lower,upper) - succes=false; + success = false topIntersec = [] lowIntersec = [] - while !succes + while !success crossing = true @@ -38,16 +37,19 @@ function ExactPiece(start::Real,maximum::Real,lower,upper) #find if the solution on the discretized problem works on the original problem topDistance = x-> upper(x) - line.fct(x) lowerDistance = x-> line.fct(x) - lower(x) - + + topDistanceRel = x -> (topDistance(x) / max(EPS, abs(upper(x)))) + lowerDistanceRel = x -> (lowerDistance(x) / max(EPS, abs(lower(x)))) + #try catch to handle rare cases with function asymptotic to zero try - topIntersec = find_zeros(topDistance,line.xMin,line.xMax) + topIntersec = find_zeros(topDistanceRel,line.xMin,line.xMax) catch topIntersec = [] end try - lowIntersec = find_zeros(lowerDistance,line.xMin,line.xMax) + lowIntersec = find_zeros(lowerDistanceRel,line.xMin,line.xMax) catch lowIntersec = [] end @@ -56,36 +58,29 @@ function ExactPiece(start::Real,maximum::Real,lower,upper) crossing = false for i in 1: length(topIntersec) -1 - - #other criteria if differentiable - #if topDistance'(topIntersec[i]) < 0 - if topDistance((topIntersec[i]+topIntersec[i+1])/2) <- epsilon - - push!(pts,topIntersec[i]) - push!(pts,(topIntersec[i]+topIntersec[i+1])/2) - push!(pts,topIntersec[i+1]) - - #previously any precision of 1e-5 or below very rarely caused an infinite loop here because of the conversion - #Rational{BigInt} <-> float64 used in ORourke ( method CDDLib.Library(:exact)) which is why randomization was used - push!(pts,RandomMidPoint(topIntersec[i], topIntersec[i+1])) - - crossing = true; + dp = topIntersec[i + 1] - topIntersec[i] + midpoints = collect(topIntersec[i] : dp / 10 : topIntersec[i + 1]) + topdpoints = [(topDistanceRel(p), p) for p in midpoints] + sort!(topdpoints) + for (topd, p) in topdpoints[1 : 1] + if topd < - EPS + push!(pts,p) + crossing = true; + end end - end for i in 1: length(lowIntersec) -1 - #other criteria if differentiable - #if lowerDistance'(lowIntersec[i]) < 0 - if lowerDistance((lowIntersec[i] + lowIntersec[i+1])/2) < - epsilon - - - push!(pts,lowIntersec[i]) - push!(pts,(lowIntersec[i] + lowIntersec[i+1])/2) - push!(pts,lowIntersec[i+1]) - + dp = lowIntersec[i + 1] - lowIntersec[i] + midpoints = collect(lowIntersec[i] : dp / 10 : lowIntersec[i + 1]) + lowdpoints = [(lowerDistanceRel(p), p) for p in midpoints] + sort!(lowdpoints) + for (lowd, p) in lowdpoints[1 : 1] + if lowd < - EPS + push!(pts,p) + crossing = true + end end - end @@ -100,11 +95,16 @@ function ExactPiece(start::Real,maximum::Real,lower,upper) index = findfirst(isequal(lastCovered), pts) + # index = findfirst(t -> abs(t - lastCovered) < 1e-7, pts) notCover = pts[index+1] + @assert(!isnan(notCover), "notCover is NaN, points are $pts and index + 1 = $(index + 1)") #verify if - if notCover - lastCovered < epsilon #|| notCover == newMax + if notCover - lastCovered < EPS #|| notCover == newMax + # println("breaking loop, notCover = $notCover, lastCovered = $lastCovered") return line + else + # println("continuing loop, notCover = $notCover, lastCovered = $lastCovered, $(notCover - lastCovered)") end @@ -115,17 +115,24 @@ function ExactPiece(start::Real,maximum::Real,lower,upper) uExtend = maximum try - lExtend = find_zeros(x-> line.fct(x) - lower(x), line.xMax,maximum)[1] + lowerDistance = x -> line.fct(x) - lower(x) + lowerDistanceRel = x -> lowerDistance(x) / max(EPS, abs(lower(x))) + lExtend = find_zeros(lowerDistanceRel, line.xMax, maximum)[1] catch y end try - uExtend = find_zeros(x-> line.fct(x) - upper(x), line.xMax,maximum)[1] + topDistance = x-> upper(x) - line.fct(x) + topDistanceRel = x -> topDistance(x) / max(EPS, abs(upper(x))) + uExtend = find_zeros(topDistanceRel, line.xMax, maximum)[1] catch y end + @assert(!isnan(uExtend), "uExtend is nan") + @assert(!isnan(lExtend), "lExtend is nan") + @assert(!isnan(notCover), "notCover is nan") furthest = min(uExtend,lExtend) push!(pts, furthest) - push!(pts, (notCover + furthest)/2 ) - push!(pts, (notCover + lastCovered)/2 ) + push!(pts, (notCover + furthest) / 2 ) + push!(pts, (notCover + lastCovered) / 2 ) diff --git a/src/linearizeDispatch.jl b/src/linearizeDispatch.jl index c9c610b..1e973a8 100644 --- a/src/linearizeDispatch.jl +++ b/src/linearizeDispatch.jl @@ -41,14 +41,15 @@ ConcavityChanges = [Inf]::Array{Float64,1}) (isfinite(x1) && isfinite(x2)) || throw(ArgumentError("Must be called on a finite interval")) - return HeuristicLin(expr_fct,x1,x2, e; bounding = bounding, ConcavityChanges = ConcavityChanges) + return ScaledLinearize(expr_fct, x1, x2, e, HeuristicLin, bounding, ConcavityChanges) end function Linearize(expr_fct::Ef,x1::Real,x2::Real, e::ErrorType,algorithm::HeuristicLin; bounding = Best() ::BoundingType, ConcavityChanges = [Inf]::Array{Float64,1}) (isfinite(x1) && isfinite(x2)) || throw(ArgumentError("Must be called on a finite interval")) - return HeuristicLin(expr_fct,x1,x2, e; bounding = bounding, ConcavityChanges = ConcavityChanges) + + return ScaledLinearize(expr_fct, x1, x2, e, HeuristicLin, bounding, ConcavityChanges) end function Linearize(expr_fct::Ef,x1::Real,x2::Real, e::ErrorType,algorithm::ExactLin; bounding = Best() ::BoundingType, @@ -56,5 +57,59 @@ function Linearize(expr_fct::Ef,x1::Real,x2::Real, e::ErrorType,algorithm::Exact (isfinite(x1) && isfinite(x2)) || throw(ArgumentError("Must be called on a finite interval")) - return ExactLin(expr_fct,x1,x2, e; bounding = bounding, ConcavityChanges = ConcavityChanges) + return ScaledLinearize(expr_fct, x1, x2, e, ExactLin, bounding, ConcavityChanges) end + +# The function ScaleLinearize will +# 1) invert a negative function to make it positive; +# 2) scale it so it is defined in the interval [0, 1] and such that max(f(x): x in [0, 1]) = 1. +function ScaledLinearize(f::Ef, x1::Real, x2::Real, e::ErrorType, LinAlg::Union{Type{ExactLin}, Type{HeuristicLin}}, bounding::BoundingType, concavity_changes)::Vector{LinearPiece} + if is_mostly_negative(f, x1, x2) + invert = -1 + g = invert_function(f) + new_bounding = bounding isa Under ? Over() : (bounding isa Over ? Under() : Best()) + else + invert = 1 + g = f + new_bounding = bounding + end + s = get_scale(g, x1, x2) + h = scale_function(g, s, x1, x2) + newe = e isa Absolute ? Absolute(e.delta / s) : e + + # find roots of f and prevent running the main alg at them + rts = IntervalRootFinding.roots(x -> h(x), interval(0, 1)) + breakpoints = [0.0, 1.0] + for z in rts + zmid = (z.region.bareinterval.lo + z.region.bareinterval.hi) / 2 + if zmid > 1e-5 + push!(breakpoints, zmid - 1e-5) + end + if zmid < 1 - 1e-5 + push!(breakpoints, zmid + 1e-5) + end + end + sort!(breakpoints) + lps = LinearPiece[] + for i in 1:length(breakpoints) - 1 + xp0, xpf = breakpoints[i], breakpoints[i + 1] + if xpf - xp0 < EPS + elseif xpf - xp0 < 1e-4 + lp = construct_constant_piece(h, xp0, xpf, new_bounding) + push!(lps, lp) + else + newlps = LinAlg(h, xp0, xpf, newe; bounding = new_bounding, ConcavityChanges = deepcopy(concavity_changes)) + # newlps = remove_infeasibilities(newlps, h, new_bounding) + res = [optimize(x -> h(x) - lp(x), lp.xMin, lp.xMax) for lp in newlps] + res = [minimum(r) for r in res] + # println("res = $(res)") + append!(lps, newlps) + end + end + newlps = [invert_linearpiece(scale_linearpiece(lp, s, x1, x2), invert) for lp in lps] + res = [optimize(x -> f(x) - lp(x), lp.xMin, lp.xMax) for lp in newlps] + res = [minimum(r) for r in res] + println("hola") + println("res = $(res)") + return newlps +end \ No newline at end of file diff --git a/src/oRourke.jl b/src/oRourke.jl index 8cf8465..37afd7a 100644 --- a/src/oRourke.jl +++ b/src/oRourke.jl @@ -6,6 +6,11 @@ function PointPlane(p::dataError) # a and b are the variables to optimize # -x*a - b < - ymin # x*a + b < ymax + # println("hola") + if p.yMin > p.yMax && abs(p.yMin - p.yMax) < 1e-6 + avg = (p.yMin + p.yMax) / 2 + p = dataError(p.x, avg, avg) + end return HalfSpace([-p.x, -1], -p.yMin) ∩ HalfSpace([p.x, 1], p.yMax) end @@ -13,11 +18,11 @@ function ORourke(pts) pts = copy(pts) poly = PointPlane(pts[1]) - temp = poly; - coveredPts = [popfirst!(pts)]; + temp = poly + coveredPts = [popfirst!(pts)] #add points until no line is feasible or all pts are covered - while !isempty(pts) && !isempty(polyhedron(poly, CDDLib.Library(:exact))) + while !isempty(pts) && !isempty(points(doubledescription(poly)))#!isempty(polyhedron(poly, CDDLib.Library(:exact))) temp = copy(poly); poly = poly ∩ PointPlane(pts[1]) push!(coveredPts,popfirst!(pts)) @@ -25,19 +30,20 @@ function ORourke(pts) end + verticesPoly = collect(points(doubledescription(poly))) - if isempty(polyhedron(poly, CDDLib.Library(:exact))) + if isempty(verticesPoly)#isempty(polyhedron(poly, CDDLib.Library(:exact))) pop!(coveredPts) poly = temp + verticesPoly = collect(points(doubledescription(poly))) end - #We take any arbitrary point in the polyhedra (here the "center") - verticesPoly = collect(points(doubledescription(poly))) + @assert(!isempty(verticesPoly), "polyhedron is $(show(IOContext(stdout, :limit => false), "text/plain", poly))") lineCoef = sum(verticesPoly)/length(verticesPoly) line = LinearPiece(coveredPts[1].x,coveredPts[end].x,lineCoef[1],lineCoef[2],x-> lineCoef[1]*x + lineCoef[2]) return line -end \ No newline at end of file +end diff --git a/src/strucDef.jl b/src/strucDef.jl index 9091ac4..412eb59 100644 --- a/src/strucDef.jl +++ b/src/strucDef.jl @@ -36,15 +36,26 @@ end #evaluate a pieceWise linear function -function (pwl::Array{LinearPiece, 1})(x::Real) +function (pwl::Array{LinearPiece, 1})(x::Real, tiebreak = Under()) - if x < pwl[1].xMin || x > pwl[end].xMax + eps = EPS + if x < pwl[1].xMin - eps || x > pwl[end].xMax + eps throw(DomainError(x, "argument must be in the domain of the function")) end - starts = getfield.(pwl,:xMin) - pieceIndex = searchsortedlast(starts,x) - return pwl[pieceIndex](x) + starts = getfield.(pwl, :xMin) + ends = getfield.(pwl, :xMax) + piece_start = max(1, searchsortedlast(starts, x - eps)) + piece_end = min(length(pwl), searchsortedfirst(ends, x + eps)) + # println("piece_start = $piece_start, piece_end = $piece_end") + if tiebreak isa Under + return minimum([pwl[i](x) for i in piece_start:piece_end if x >= pwl[i].xMin - eps && x <= pwl[i].xMax + eps]) + elseif tiebreak isa Over + return maximum([pwl[i](x) for i in piece_start:piece_end if x >= pwl[i].xMin - eps && x <= pwl[i].xMax + eps]) + else + midpiece = round(Int64, (piece_start + piece_end) / 2) + return pwl[midpiece](x) + end end @@ -69,6 +80,8 @@ struct Relative <: ErrorType percent::Real end +delta_or_percent(e::ErrorType) = e isa Relative ? e.percent : e.delta + abstract type BoundingType end struct Best <:BoundingType end @@ -112,4 +125,4 @@ Derive(expr::Expr) = Calculus.simplify(differentiate(expr, :x)) Derive(f::Function) = z->ForwardDiff.gradient(x->f(x[1]),[z])[1] #ForwardDiff.derivative(f, x::Real) -; +const EPS = 1e-7 diff --git a/src/utilities.jl b/src/utilities.jl index 5587efe..52545c9 100644 --- a/src/utilities.jl +++ b/src/utilities.jl @@ -8,7 +8,7 @@ Determine whether a pwl function is continuous up to a numerical precision of ε - `ε` : numerical precision used to detect if the end endpoints of two segments are equal (to detect discontinuities) """ -function isContinuous(pwl, ε = 1e-5) +function isContinuous(pwl, ε = EPS) for i in 1:length(pwl)-1 @@ -38,7 +38,7 @@ Outputs the breakpoints needed for several solvers (CPLEX, Gurobi,...) to native - `ε` : numerical precision used to detect if the end endpoints of two segments are equal (to detect discontinuities) """ -function breakpoints(pwl, ε = 1e-5) +function breakpoints(pwl, ε = EPS) bpx = [pwl[1].xMin] @@ -62,3 +62,93 @@ function breakpoints(pwl, ε = 1e-5) end +function get_scale(f::Ef, x1::Real, x2::Real)::Float64 + resmax = optimize(x -> -f(x), x1, x2) + resmin = optimize(x -> f(x), x1, x2) + vmax = minimum(resmax) + vmin = minimum(resmin) + return max(abs(vmax), abs(vmin)) +end + +function scale_function(f::Ef, s::Real, x1::Real, x2::Real)::Ef + if f isa Expr + return :( eval(f) * s ) + elseif f isa Function + return y -> f(x1 + y * (x2 - x1)) / s + end +end + +function invert_function(f::Ef)::Ef + if f isa Expr + return :( - eval(f) ) + elseif f isa Function + return x -> - f(x) + end +end + +function is_mostly_negative(f::Ef, x1::Real, x2::Real)::Bool + resmax = optimize(x -> -f(x), x1, x2) + maxf = - minimum(resmax) + return maxf < EPS +end + +function scale_linearpiece(lp::LinearPiece, s::Real, x1::Real, x2::Real)::LinearPiece + ymin = x1 + lp.xMin * (x2 - x1) + ymax = x1 + lp.xMax * (x2 - x1) + ap = s * lp.a / (x2 - x1) + bp = s * (lp.b - lp.a * x1 / (x2 - x1)) + return LinearPiece(ymin, ymax, ap, bp, x -> ap * x + bp) +end + +function construct_constant_piece(f::Ef, x1::Real, x2::Real, bounding::BoundingType) + if bounding == Under() + opt = optimize(x -> f(x), x1, x2) + b = minimum(opt) + elseif bounding == Over() + opt = optimize(x -> -f(x), x1, x2) + b = -minimum(opt) + else + b = f((x1 + x2) / 2) + end + return LinearPiece(x1, x2, 0.0, b, x -> b) +end + +function invert_linearpiece(lp::LinearPiece, inv::Int64) + if inv == 1 return lp + else + return LinearPiece(lp.xMin, lp.xMax, -lp.a, -lp.b, x -> -lp.fct(x)) + end +end + +function find_zeros(f::Ef, x1::Real, x2::Real)::Vector{Real} + zs = IntervalRootFinding.roots(f, interval(x1, x2)) + if isempty(zs) return Float64[] end + zmin = argmin(z -> min(abs(f(z.region.bareinterval.lo)), abs(f(z.region.bareinterval.hi))), zs) + zvec = abs(f(zmin.region.bareinterval.lo)) < abs(f(zmin.region.bareinterval.hi)) ? Float64[zmin.region.bareinterval.lo] : Float64[zmin.region.bareinterval.hi] + return zvec +end + +function find_zero(f::Ef, x1::Real, x2::Real)::Real + zeros = LinA.find_zeros(f, x1, x2) + return isempty(zeros) ? NaN : zeros[begin] +end + +function remove_infeasibilities(lps, g, bounding) + newlps = [] + for lp in lps + if bounding isa Under + res = optimize(x -> g(x) - lp(x), lp.xMin, lp.xMax) + d = minimum(res) + elseif bounding isa Over + res = optimize(x -> lp(x) - g(x), lp.xMin, lp.xMax) + d = - minimum(res) + else d = 0.0 + end + if abs(d) > EPS + push!(newlps, LinearPiece(lp.xMin, lp.xMax, lp.a, lp.b + d, x -> lp.a * x + lp.b + d)) + else + push!(newlps, lp) + end + end + return newlps +end diff --git a/test/runtests.jl b/test/runtests.jl index 028bb59..43eda69 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -25,7 +25,12 @@ function TestErrorRelative(f,pwl,eps) end - +@testset "Large Errors" begin + f(x) = log(1 + (MathConstants.e - 1) * x) + pwl = Linearize(f,0,1,Relative(50)) + return true +end + @testset "Heuristic Absolute" begin pwl = Linearize(:(x^2),-10,10,Absolute(2)) diff --git a/test/runtests2.jl b/test/runtests2.jl new file mode 100644 index 0000000..0c3f550 --- /dev/null +++ b/test/runtests2.jl @@ -0,0 +1,9 @@ +using LinA +# f(x) = log(1 + (MathConstants.e - 1) * x) +# f(x) = 84.65625859999999/3*log(1 + (MathConstants.e^3 - 1)/392*x) +# pwl = LinA.Linearize(f, 0, 1, LinA.Relative(.0), LinA.ExactLin(); bounding = Under()) +f(x) = 2.1525441506373877 * (sin(0.6666666666666666x) + 0.3333333333333333x) ^ 2 +# pwl = LinA.Linearize(f, 0.0, 51.611965507001564, LinA.Relative(6.25), LinA.HeuristicLin(); bounding = Under()) +pwl = Linearize(f, 0.45008006908541487, 15, Relative(50.0), ExactLin(); bounding = Under()) +println("number of pieces = $(length(pwl))") +println.(pwl) \ No newline at end of file