Skip to content

Instantly share code, notes, and snippets.

View abelsiqueira's full-sized avatar
🎲

Abel Soares Siqueira abelsiqueira

🎲
View GitHub Profile
### A Pluto.jl notebook ###
# v0.19.32
using Markdown
using InteractiveUtils
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
macro bind(def, element)
quote
local iv = try Base.loaded_modules[Base.PkgId(Base.UUID("6e696c72-6542-2067-7265-42206c756150"), "AbstractPlutoDingetjes")].Bonds.initial_value catch; b -> missing; end
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
beta
1000
1000
400
40
0.7
0.3
0.03
using PyCall
pd = pyimport("pandas")
url = "https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data"
data = pd.read_csv(download(url), header=nothing, names=["x1", "x2", "x3", "x4", "target"])
sns = pyimport("seaborn")
plt = pyimport("matplotlib.pyplot")
plt.figure()
[deps]
JSOSolvers = "10dff2fc-5484-5881-a0e0-c90441020f8a"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
NLPModelsJuMP = "792afdf1-32c1-5681-94e0-d7bf7a5df49e"
[compat]
JSOSolvers = "0.2.0"
JuMP = "0.18"
NLPModelsJuMP = "0.5.0"
using CUTEst, JSOFilter, NLPModelsIpopt, Plots, SolverBenchmark, SolverTools
pyplot()
function runcutest()
#ps = CUTEst.select(max_var=300, min_con=1, max_con=300, only_free_var=true, only_equ_con=true, objtype=2:6)
#ps = CUTEst.select(max_var=300, min_con=1, max_con=300, only_free_var=true, objtype=2:6)
ps = CUTEst.select(max_var=300, min_con=1, max_con=300, objtype=2:6)
#ps = CUTEst.select(max_var=2, min_con=1, max_con=2, objtype=2:6)
problems = (CUTEstModel(p) for p in ps)
using QuiverMutation
function exemplo1()
lt = Lattice(2, 4)
P = [(3,2), (2,2), (1,2), (1,1), (2,1)]
plot_lattice(lt, title="Inicial", filename="quiver-0")
for (i,p) in enumerate(P)
lt = activate(lt, p[1], p[2])
name nvar ncon status objective elapsed_time neval_obj dual_feas primal_feas
HS7 2 1 first_order -1.7e+00 1.2e-01 33 1.3e-06 7.5e-24
MARATOS 2 1 first_order -1.0e+00 2.4e+00 651 1.1e-06 1.2e-32
HS6 2 1 first_order 8.0e-19 2.3e-02 6 1.8e-09 1.2e-30
HS10 2 1 first_order -1.0e+00 6.5e-01 88 1.3e-06 2.5e-09
HS8 2 2 first_order -1.0e+00 5.1e-03 3 0.0e+00 4.7e-24
# put in file lops.jl
# LinearOperator and hcat precompilation problem
using LinearOperators
using Profile
function foo()
N = 15; n = 5
lops = [ LinearOperator(randn(n,n)) for i=1:N ]
#C = hvcat(ntuple(x -> N, N), lops...)
# put in file lops.jl
# LinearOperator and hcat precompilation problem
using LinearOperators
using Profile
function foo()
N = 15; n = 5
lops = [ LinearOperator(randn(n,n)) for i=1:N ]
#C = hvcat(ntuple(x -> N, N), lops...)
12.589108 seconds (956.13 k allocations: 46.069 MiB, 0.08% gc time)
0.000016 seconds (58 allocations: 11.453 KiB)
9669 ./client.jl:464; _start()
9669 ./client.jl:295; exec_options(::Base.JLOptions)
9669 ./Base.jl:31; include(::Module, ::String)
9669 ./loading.jl:1094; include_relative(::Module, ::St...
9669 ./boot.jl:328; include
113 ...mpiler/typeinfer.jl:599; typeinf_ext(::Core.MethodInstan...
113 ...mpiler/typeinfer.jl:568; typeinf_ext(::Core.MethodInstan...
107 ...mpiler/typeinfer.jl:12; typeinf(::Core.Compiler.Inferen...