Skip to content

Instantly share code, notes, and snippets.

View abelsiqueira's full-sized avatar
🎲

Abel Soares Siqueira abelsiqueira

🎲
View GitHub Profile
@abelsiqueira
abelsiqueira / All
Created October 17, 2016 20:34
Equality CUTEst problems with no bounds on variables
DIXMAANI
LIARWHD
SCHMVETT
VAREIGVL
MSS1
AUG2D
HS79
LUKVLE8
DIXMAANJ
SBRYBND
include("src/CUTEst.jl")
using CUTEst
macro dlsym(func, lib)
z, zlocal = gensym(string(func)), gensym()
eval(current_module(), :(global $z = C_NULL))
z = esc(z)
quote
let $zlocal::Ptr{Void} = $z::Ptr{Void}
@abelsiqueira
abelsiqueira / mwe_nlp_noeval.jl
Created November 5, 2015 18:57
Examples showing that @eval is bad
include("src/CUTEst.jl")
using CUTEst
function test(nlp; N = 100)
n = Cint[nlp.meta.nvar]
m = Cint[nlp.meta.ncon]
x = zeros(nlp.meta.nvar)
c = zeros(nlp.meta.ncon)
io_err = Cint[0]
@abelsiqueira
abelsiqueira / mwe2
Created November 4, 2015 19:24
Using ccall
include("src/CUTEst.jl")
using CUTEst
io_err = Cint[0]
function foo!(nlp, goth, x, v)
result = Array(Cdouble, nlp.meta.nvar)
@eval ccall(("cutest_uhprod_", $(nlp.libname)), Void,
(Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cdouble}),
include("src/CUTEst.jl")
using CUTEst
io_err = Cint[0]
n = Cint[2]
#goth = Cint[0]
#libname = "libLOGHAIRY"
function bar!(Hv, x, v)
"1st foo: x::Int->x+1"
function foo(x::Int)
return x+1
end
"2nd foo: x::Float64->x/2"
function foo(x::Float64)
return x/2
end

Instruções

Faça as rodadas dos times, com forças em cada e fora de cada descritas na tabela de esntrada, e crie a tabela de pontos do primeiro e do segundo turno, separadamente. Depois crie o somatório dos pontos, e ordene a saída.

Como rodar

Para rodar no terminal, implemente o seu programa de modo a receber test1.in como entrada, e jogue a saída para test1.out

$ python meu_codigo.py < test1.in > test1.out

@abelsiqueira
abelsiqueira / test.jl
Created June 19, 2015 16:32
Testing Interface with MathProgBase
using CUTEst
using Ipopt
using CUTEst.MathProgBaseInterface
if length(ARGS) != 1
error("Usage: julia test.jl PROBLEM")
end
nlp = CUTEstModel(ascii(ARGS[1]))
Problem name: BYRDSPHR
Double precision version will be formed
The objective function uses 1 linear group
There are 2 nonlinear equality constraints
There are 3 free variables