text:
# This file was generated by the Julia Swagger Code Generator
# Do not modify this file directly. Modify the swagger specification instead.

@doc raw"""ObjectReference contains enough information to let you inspect or modify the referred object.

    IoK8sApiCoreV1ObjectReference(;
        apiVersion=nothing,
        fieldPath=nothing,
        kind=nothing,
        name=nothing,
        namespace=nothing,
        resourceVersion=nothing,
        uid=nothing,
    )

    - apiVersion::String : API version of the referent.
    - fieldPath::String : If referring to a piece of an object instead of an entire object, this string should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. For example, if the object reference is to a container within a pod, this would take on a value like: \"spec.containers{name}\" (where \"name\" refers to the name of the container that triggered the event) or if no container name is specified \"spec.containers[2]\" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object.
    - kind::String : Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
    - name::String : Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
    - namespace::String : Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/
    - resourceVersion::String : Specific resourceVersion to which this reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency
    - uid::String : UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids
"""
mutable struct IoK8sApiCoreV1ObjectReference <: SwaggerModel
    apiVersion::Any # spec type: Union{ Nothing, String } # spec name: apiVersion
    fieldPath::Any # spec type: Union{ Nothing, String } # spec name: fieldPath
    kind::Any # spec type: Union{ Nothing, String } # spec name: kind
    name::Any # spec type: Union{ Nothing, String } # spec name: name
    namespace::Any # spec type: Union{ Nothing, String } # spec name: namespace
    resourceVersion::Any # spec type: Union{ Nothing, String } # spec name: resourceVersion
    uid::Any # spec type: Union{ Nothing, String } # spec name: uid

    function IoK8sApiCoreV1ObjectReference(;apiVersion=nothing, fieldPath=nothing, kind=nothing, name=nothing, namespace=nothing, resourceVersion=nothing, uid=nothing)
        o = new()
        validate_property(IoK8sApiCoreV1ObjectReference, Symbol("apiVersion"), apiVersion)
        setfield!(o, Symbol("apiVersion"), apiVersion)
        validate_property(IoK8sApiCoreV1ObjectReference, Symbol("fieldPath"), fieldPath)
        setfield!(o, Symbol("fieldPath"), fieldPath)
        validate_property(IoK8sApiCoreV1ObjectReference, Symbol("kind"), kind)
        setfield!(o, Symbol("kind"), kind)
        validate_property(IoK8sApiCoreV1ObjectReference, Symbol("name"), name)
        setfield!(o, Symbol("name"), name)
        validate_property(IoK8sApiCoreV1ObjectReference, Symbol("namespace"), namespace)
        setfield!(o, Symbol("namespace"), namespace)
        validate_property(IoK8sApiCoreV1ObjectReference, Symbol("resourceVersion"), resourceVersion)
        setfield!(o, Symbol("resourceVersion"), resourceVersion)
        validate_property(IoK8sApiCoreV1ObjectReference, Symbol("uid"), uid)
        setfield!(o, Symbol("uid"), uid)
        o
    end
end # type IoK8sApiCoreV1ObjectReference

const _property_map_IoK8sApiCoreV1ObjectReference = Dict{Symbol,Symbol}(Symbol("apiVersion")=>Symbol("apiVersion"), Symbol("fieldPath")=>Symbol("fieldPath"), Symbol("kind")=>Symbol("kind"), Symbol("name")=>Symbol("name"), Symbol("namespace")=>Symbol("namespace"), Symbol("resourceVersion")=>Symbol("resourceVersion"), Symbol("uid")=>Symbol("uid"))
const _property_types_IoK8sApiCoreV1ObjectReference = Dict{Symbol,String}(Symbol("apiVersion")=>"String", Symbol("fieldPath")=>"String", Symbol("kind")=>"String", Symbol("name")=>"String", Symbol("namespace")=>"String", Symbol("resourceVersion")=>"String", Symbol("uid")=>"String")
Base.propertynames(::Type{ IoK8sApiCoreV1ObjectReference }) = collect(keys(_property_map_IoK8sApiCoreV1ObjectReference))
Swagger.property_type(::Type{ IoK8sApiCoreV1ObjectReference }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_IoK8sApiCoreV1ObjectReference[name]))}
Swagger.field_name(::Type{ IoK8sApiCoreV1ObjectReference }, property_name::Symbol) =  _property_map_IoK8sApiCoreV1ObjectReference[property_name]

function check_required(o::IoK8sApiCoreV1ObjectReference)
    true
end

function validate_property(::Type{ IoK8sApiCoreV1ObjectReference }, name::Symbol, val)
end


text:
export encode_emoji,
    get_channel,
    modify_channel,
    delete_channel,
    get_channel_messages,
    get_channel_message,
    create_message,
    create_reaction,
    delete_own_reaction,
    delete_user_reaction,
    get_reactions,
    delete_all_reactions,
    edit_message,
    delete_message,
    bulk_delete_messages,
    edit_channel_permissions,
    get_channel_invites,
    create_channel_invite,
    delete_channel_permission,
    trigger_typing_indicator,
    get_pinned_messages,
    add_pinned_channel_message,
    delete_pinned_channel_message

encode_emoji(emoji::AbstractString) = HTTP.escapeuri(emoji)
encode_emoji(emoji::AbstractChar) = encode_emoji(string(emoji))

"""
    get_channel(c::Client, channel::Integer) -> DiscordChannel

Get a [`DiscordChannel`](@ref).
"""
function get_channel(c::Client, channel::Integer)
    return Response{DiscordChannel}(c, :GET, "/channels/$channel")
end

"""
    modify_channel(c::Client, channel::Integer; kwargs...) -> DiscordChannel

Modify a [`DiscordChannel`](@ref).
More details [here](https://discordapp.com/developers/docs/resources/channel#modify-channel).
"""
function modify_channel(c::Client, channel::Integer; kwargs...)
    return Response{DiscordChannel}(c, :PATCH, "/channels/$channel"; body=kwargs)
end

"""
    delete_channel(c::Client, channel::Integer) -> DiscordChannel

Delete a [`DiscordChannel`](@ref).
"""
function delete_channel(c::Client, channel::Integer)
    return Response{DiscordChannel}(c, :DELETE, "/channels/$channel")
end

"""
    get_channel_messages(c::Client, channel::Integer; kwargs...) -> Vector{Message}

Get a list of [`Message`](@ref)s from a [`DiscordChannel`](@ref).
More details [here](https://discordapp.com/developers/docs/resources/channel#get-channel-messages).
"""
function get_channel_messages(c::Client, channel::Integer; kwargs...)
    return Response{Vector{Message}}(c, :GET, "/channels/$channel/messages"; kwargs...)
end

"""
    get_channel_message(c::Client, channel::Integer, message::Integer) -> Message

Get a [`Message`](@ref) from a [`DiscordChannel`](@ref).
"""
function get_channel_message(c::Client, channel::Integer, message::Integer)
    return Response{Message}(c, :GET, "/channels/$channel/messages/$message")
end

"""
    create_message(c::Client, channel::Integer; kwargs...) -> Message

Send a [`Message`](@ref) to a [`DiscordChannel`](@ref).
More details [here](https://discordapp.com/developers/docs/resources/channel#create-message).
"""
function create_message(c::Client, channel::Integer; kwargs...)
    endpoint = "/channels/$channel/messages"
    return if haskey(kwargs, :file)  # We have to use multipart/form-data for file uploads.
        d = Dict(pairs(kwargs))
        file = pop!(d, :file)
        form = HTTP.Form(Dict("file" => file, "payload_json" => jsonify(d)))
        headers = Dict(HTTP.content_type(form))
        Response{Message}(c, :POST, endpoint; headers=headers, body=form)
    else
        Response{Message}(c, :POST, endpoint; body=kwargs)
    end
end

"""
    create_reaction(c::Client, channel::Integer, message::Integer, emoji::StringOrChar)

React to a [`Message`](@ref). If `emoji` is a custom [`Emoji`](@ref), it should be
formatted "name:id".
"""
function create_reaction(c::Client, channel::Integer, message::Integer, emoji::StringOrChar)
    return Response(
        c,
        :PUT,
        "/channels/$channel/messages/$message/reactions/$(encode_emoji(emoji))/@me",
    )
end

"""
    delete_own_reaction(c::Client, channel::Integer, message::Integer, emoji::StringOrChar)

Delete the [`Client`](@ref) user's reaction to a [`Message`](@ref).
"""
function delete_own_reaction(
    c::Client,
    channel::Integer,
    message::Integer,
    emoji::StringOrChar,
)
    return Response(
        c,
        :DELETE,
        "/channels/$channel/messages/$message/reactions/$(encode_emoji(emoji))/@me",
    )
end

"""
    delete_user_reaction(
        c::Client,
        channel::Integer,
        message::Integer,
        emoji::StringOrChar,
        user::Integer,
    )

Delete a [`User`](@ref)'s reaction to a [`Message`](@ref).
"""
function delete_user_reaction(
    c::Client,
    channel::Integer,
    message::Integer,
    emoji::StringOrChar,
    user::Integer,
)
    return Response(
        c,
        :DELETE,
        "/channels/$channel/messages/$message/reactions/$(encode_emoji(emoji))/$user",
    )
end

"""
    get_reactions(
        c::Client,
        channel::Integer,
        message::Integer,
        emoji::StringOrChar,
    ) -> Vector{User}

Get the [`User`](@ref)s who reacted to a [`Message`](@ref) with an [`Emoji`](@ref).
"""
function get_reactions(c::Client, channel::Integer, message::Integer, emoji::StringOrChar)
    return Response{Vector{User}}(
        c,
        :GET,
        "/channels/$channel/messages/$message/reactions/$(encode_emoji(emoji))",
    )
end

"""
    delete_all_reactions(c::Client, channel::Integer, message::Integer)

Delete all reactions from a [`Message`](@ref).
"""
function delete_all_reactions(c::Client, channel::Integer, message::Integer)
    return Response(c, :DELETE, "/channels/$channel/messages/$message/reactions")
end

"""
    edit_message(c::Client, channel::Integer, message::Integer; kwargs...) -> Message

Edit a [`Message`](@ref).
More details [here](https://discordapp.com/developers/docs/resources/channel#edit-message).
"""
function edit_message(c::Client, channel::Integer, message::Integer; kwargs...)
    return Response{Message}(c, :PATCH, "/channels/$channel/messages/$message"; body=kwargs)
end

"""
    delete_message(c::Client, channel::Integer, message::Integer)

Delete a [`Message`](@ref).
"""
function delete_message(c::Client, channel::Integer, message::Integer)
    return Response(c, :DELETE, "/channels/$channel/messages/$message")
end

"""
    bulk_delete_messages(c::Client, channel::Integer; kwargs...)

Delete multiple [`Message`](@ref)s.
More details [here](https://discordapp.com/developers/docs/resources/channel#bulk-delete-messages).
"""
function bulk_delete_messages(c::Client, channel::Integer; kwargs...)
    return Response(c, :POST, "/channels/$channel/messages/bulk-delete"; body=kwargs)
end

"""
    edit_channel_permissions(
        c::Client,
        channel::Integer,
        overwrite::Integer;
        kwargs...,
    )

Edit permissions for a [`DiscordChannel`](@ref).
More details [here](https://discordapp.com/developers/docs/resources/channel#edit-channel-permissions).
"""
function edit_channel_permissions(
    c::Client,
    channel::Integer,
    overwrite::Integer;
    kwargs...,
)
    return Response(c, :PUT, "/channels/$channel/permissions/$overwrite"; body=kwargs)
end

"""
    get_channel_invites(c::Client, channel::Integer) -> Vector{Invite}

Get the [`Invite`](@ref)s for a [`DiscordChannel`](@ref).
"""
function get_channel_invites(c::Client, channel::Integer)
    return Response{Vector{Invite}}(c, :GET, "/channels/$channel/invites")
end

"""
    create_channel_invite(c::Client, channel::Integer; kwargs...) -> Invite

Create an [`Invite`](@ref) to a [`DiscordChannel`](@ref).
More details [here](https://discordapp.com/developers/docs/resources/channel#create-channel-invite).
"""
function create_channel_invite(c::Client, channel::Integer, kwargs...)
    return Response{Invite}(c, :POST, "/channels/$channel/invites"; body=kwargs)
end

"""
    delete_channel_permission(c::Client, channel::Integer, overwrite::Integer)

Delete an [`Overwrite`](@ref) from a [`DiscordChannel`](@ref).
"""
function delete_channel_permission(c::Client, channel::Integer, overwrite::Integer)
    return Response(c, :DELETE, "/channels/$channel/permissions/$overwrite")
end

"""
    trigger_typing_indicator(c::Client, channel::Integer)

Trigger the typing indicator in a [`DiscordChannel`](@ref).
"""
function trigger_typing_indicator(c::Client, channel::Integer)
    return Response(c, :POST, "/channels/$channel/typing")
end

"""
    get_pinned_messages(c::Client, channel::Integer) -> Vector{Message}

Get the pinned [`Message`](@ref)s in a [`DiscordChannel`](@ref).
"""
function get_pinned_messages(c::Client, channel::Integer)
    return Response{Vector{Message}}(c, :GET, "/channels/$channel/pins")
end

"""
    add_pinned_channel_message(c::Client, channel::Integer, message::Integer)

Pin a [`Message`](@ref) in a [`DiscordChannel`](@ref).
"""
function add_pinned_channel_message(c::Client, channel::Integer, message::Integer)
    return Response(c, :PUT, "/channels/$channel/pins/$message")
end

"""
    delete_pinned_channel_message(c::Client, channel::Integer, message::Integer)

Unpin a [`Message`](@ref) from a [`DiscordChannel`](@ref).
"""
function delete_pinned_channel_message(c::Client, channel::Integer, message::Integer)
    return Response(c, :DELETE, "/channels/$channel/pins/$message")
end

ext: jl


text:
module EmpiricalBayes

using Pkg
using DelimitedFiles

export
  discretize_test_statistics,
  fit_null_distribution,
  fit_mixture_distribution,
  calculate_posterior,
  empirical_bayes

include("empirical_bayes.jl")

end # module


text:
"""
    rollout!(solver, α)

Simulate the system forward using the local affine control policy stored in the
[`iLQRSolver`](@ref). The line search paramter `α` (typically less than 1.0) is
used to scale the feedforward control term:

```math
u = ū + K(x - x̄) + α d
```
Note the sign is positive due to our convention of computing the feedback gains
``K``.
"""
function rollout!(solver::iLQRSolver, α)
    N = solver.N
    Z = solver.Z; Z̄ = solver.Z̄
    K = solver.K; d = solver.d;
    δx = solver.dx; δu = solver.du

    RD.setstate!(Z̄[1], solver.x0)
    sig = dynamics_signature(solver)
    for k = 1:N-1
        RD.state_diff!(solver.model[k], δx[k], state(Z̄[k]), state(Z[k]))
        δu[k] .= d[k] .* α
        matmul!(δu[k], K[k], δx[k], 1.0, 1.0)

        δu[k] .+= control(Z[k])
        RD.setcontrol!(Z̄[k], δu[k])
        RD.propagate_dynamics!(sig, solver.model[k], Z̄[k+1], Z̄[k])

        max_x = norm(state(Z̄[k+1]),Inf)
        if max_x > solver.opts.max_state_value || isnan(max_x)
            solver.stats.status = STATE_LIMIT
            return false
        end
        max_u = norm(control(Z̄[k]),Inf)
        if max_u > solver.opts.max_control_value || isnan(max_u)
            solver.stats.status = CONTROL_LIMIT
            return false
        end
    end
    solver.stats.status = UNSOLVED
    return true
end

"""
    forwardpass!(solver, J_prev)

The "line search" of the iLQR algorithm. The system is simulated forward using the
local affine feedback control policy computed by the backward pass, scaling the
feedforward terms until satisfactory progress is made.

Returns the new cost after finding a line search step size that makes sufficient progress.
The new trajectories are stored in `solver.Z̄`, and are copied in the main solve
step.
"""
function forwardpass!(solver::iLQRSolver, J_prev)
    Z = solver.Z; Z̄ = solver.Z̄
    ΔV = solver.ΔV
    ϕ = solver.opts.line_search_decrease_factor
    z_lb = solver.opts.line_search_lower_bound
    z_ub = solver.opts.line_search_upper_bound
    lg = solver.logger
    verbose = solver.opts.verbose

    α = 1.0
    J = Inf
    z = Inf
    expected = Inf

    # J_ = TO.get_J(solver.obj)
    solver.stats.ls_failed = false
    max_iters = solver.opts.iterations_linesearch
    exit_linesearch = false
    for i = 1:max_iters
        # Forward simulate with the current line search length
        isrolloutgood = rollout!(solver, α)

        # Check if forward simulation fails
        if !isrolloutgood
            α *= ϕ
            continue
        end

        # Calculate the cost for the new trajectory
        J = TO.cost(solver.obj, Z̄)
        # J = sum(J_)

        expected = -α*(ΔV[1] + α*ΔV[2])

        # Finish if the expected decrease is super small
        if 0.0 < expected < solver.opts.expected_decrease_tolerance
            # Don't take a step at all, since it's likely to have
            # numerical issues if the expected decrease is infinitessimal
            α = 0.0
            z = Inf
            copyto!(Z̄, Z)
            J = J_prev
            @log lg "info" "No step. Expected decrease too small"

            # Increase regularization
            increaseregularization!(solver)
            exit_linesearch = true
        elseif expected > 0.0
            z = (J_prev - J) / expected
        else
            z = -1.0
        end

        # Log line search iterations
        if verbose >= 5
            @log lg expected
            @log lg z
            @log lg α
            @log lg "ls_iter" i
            @log lg "cost" J
            @log lg "dJ" J_prev - J
            printlog(lg)
        end

        # Check for acceptance criteria
        if (z_lb ≤ z ≤ z_ub)
            exit_linesearch = true
            break
        end

        # Check max iterations
        if i == max_iters
            # Don't take a step
            α = 0.0
            copyto!(Z̄, Z)
            J = J_prev

            # TODO: Add log message
            solver.opts.verbose >= 3 && @log lg "info" "Max linesearch iters" :append
            increaseregularization!(solver)
            solver.reg.ρ += solver.opts.bp_reg_fp
            solver.stats.ls_failed = true
            exit_linesearch = true
        end

        # Exit line search
        exit_linesearch && break

        # Decrease line search parameter
        α *= ϕ
    end

    # Log final values
    @log lg expected
    @log lg z
    @log lg α

    if J > J_prev
        # TODO: Add log messge
        solver.stats.status = COST_INCREASE
        return NaN
    end
    return J
end


text:
"""
   input(prompt::AbstractString="")::String

Read a string from STDIN. The trailing newline is stripped.

The prompt string, if given, is printed to standard output without a
trailing newline before reading input.
"""
function input(prompt::AbstractString="")
   print(prompt)
   chomp(readline())
end

"""
   overlap(x1, x2,..., xn) -> i1, i2,..., in

Return the (first) indices of the common elements in the vectors
`x1, x2 ,..., xn` so that `x1[i1] = x2[i2] = x3[i3] = ... = xn[in]`.
"""
function overlap(X::Vararg{AbstractVector})
   I = intersect(X...)
   (indexin(I,x) for x in X)
end


text:
# ensure each cell is valid type of column detected type
# ensure each row has exactly as many values as expected from detection

text(state::P) = state[] == Delimiter ? "delimiter" : state[] == Newline ? "newline" : "end-of-file (EOF)"

struct ExpectedMoreColumnsError <: Exception
    msg::String
end

struct TooManyColumnsError <: Exception
    msg::String
end

"""
`CSV.validate(fullpath::Union{AbstractString,IO}, sink::Type{T}=DataFrame, args...; kwargs...)` => `typeof(sink)`

`CSV.validate(fullpath::Union{AbstractString,IO}, sink::Data.Sink; kwargs...)` => `Data.Sink`

Takes the same positional & keyword arguments as [`CSV.read`](@ref), but provides detailed information as to why reading a csv file failed. Useful for cases where reading fails and it's not clear whether it's due to a row havign too many columns, or wrong types, or what have you.

"""
function validate end

function validate(s::CSV.Source)
    sch = Data.schema(s) # size, header, types
    rows, cols = size(sch)
    types = Data.types(sch)
    state = P()
    for row = 1:rows
        rowstr = ""
        for col = 1:cols
            v = CSV.parsefield(s.io, types[col], s.options, row, col, state)
            rowstr *= "$(col == 1 ? "" : Char(s.options.delim))$v"
            if col < cols
                if state[] != Delimiter
                    throw(ExpectedMoreColumnsError("row=$row, col=$col: expected $cols columns, parsed $col, but parsing encountered unexpected $(text(state)); parsed row: '$rowstr'"))
                end
            else
                if state[] != Newline && state[] != EOF
                    throw(TooManyColumnsError("row=$row, col=$col: expected $cols columns then a newline or EOF, but parsing encountered another $(text(state)): '$(Char(s.options.delim))'; parsed row: '$rowstr'"))
                end
            end
        end
    end
end

function validate(fullpath::Union{AbstractString,IO}, sink::Type=DataFrame, args...; append::Bool=false, transforms::Dict=Dict{Int,Function}(), kwargs...)
    validate(Source(fullpath; kwargs...))
    return
end

function validate(fullpath::Union{AbstractString,IO}, sink::T; append::Bool=false, transforms::Dict=Dict{Int,Function}(), kwargs...) where {T}
    validate(Source(fullpath; kwargs...))
    return
end


text:
include("differencial.jl")
include("RungeKutta.jl")
"""
`dynamics(q::SatelliteToolbox.Quaternion,ω::Vector,T::Vector,I::Matrix,dt)`
トルク`T`を与えられた剛体の回転を刻み時間`dt`秒ぶん計算する関数
## Arguments
- `q::SatelliteToolbox.Quaternion` :`t`秒時点の姿勢を表す単位クォータニオン 衛星軌道面座標系の基底をボディ座標系の基底に変換する
- `ω::Vector`     :`t`秒時点の角速度ベクトル　ボディ座標系基準
- `T::Vector`     :剛体に与えられるトルク　ボディ座標系基準
- `I::Matrix`     :慣性テンソル
- `dt::Number`          :刻み時間

## Returns
- `(qk/norm(qk), ωk)::Tuple{SatelliteToolbox.Quaternion,Vector}` :`(t+dt)`秒時点の姿勢を表す単位クォータニオンと角速度ベクトルの組

## Example
`qk,ωk=dynamics(q,ω,T,I,dt)`
"""
function dynamics(q::SatelliteToolbox.Quaternion,ω::Vector,T::Vector,I::Matrix,dt::Number)
    qk,ωk=RK4((q,ω),(T,I),dt)
    return qk/norm(qk),ωk
end

max_stars_repo_name: yui-project/ACSim

max_issues_repo_name: yui-project/ACSim

max_forks_repo_name: yui-project/ACSim


text:
using Test;
using julia;

@testset "Sample Test" begin
    @test topplebyforce(".L.R....L") == "LL.RRRLLL"
    @test topplebyforce("L.......R") == "L.......R"
    @test topplebyforce("R........") == "RRRRRRRRR"
    @test topplebyforce("........L") == "LLLLLLLLL"
    @test topplebyforce("RLRLRLRLR") == "RLRLRLRLR"
    @test topplebyforce("R..L.R..L") == "RRLL.RRLL"
    @test topplebyforce("...L.R...") == "LLLL.RRRR"
    @test topplebyforce("R.......L") == "RRRR.LLLL"

    @test topplebyboundary(".L.R....L") == "LL.RRRLLL"
    @test topplebyboundary("L.......R") == "L.......R"
    @test topplebyboundary("R........") == "RRRRRRRRR"
    @test topplebyboundary("........L") == "LLLLLLLLL"
    @test topplebyboundary("RLRLRLRLR") == "RLRLRLRLR"
    @test topplebyboundary("R..L.R..L") == "RRLL.RRLL"
    @test topplebyboundary("...L.R...") == "LLLL.RRRR"
    @test topplebyboundary("R.......L") == "RRRR.LLLL"
end

max_stars_repo_name: JenniferToops/CodingDojo

max_issues_repo_name: JenniferToops/CodingDojo

max_forks_repo_name: JenniferToops/CodingDojo


text:
# Autogenerated wrapper script for Xorg_xcb_util_renderutil_jll for armv7l-linux-gnueabihf
export libxcb_render_util

using Xorg_xcb_util_jll
JLLWrappers.@generate_wrapper_header("Xorg_xcb_util_renderutil")
JLLWrappers.@declare_library_product(libxcb_render_util, "libxcb-render-util.so.0")
function __init__()
    JLLWrappers.@generate_init_header(Xorg_xcb_util_jll)
    JLLWrappers.@init_library_product(
        libxcb_render_util,
        "lib/libxcb-render-util.so",
        RTLD_LAZY | RTLD_DEEPBIND,
    )

    JLLWrappers.@generate_init_footer()
end  # __init__()


text:
module Fontconfig

using Printf
using Fontconfig_jll

export format, match, list

function __init__()
    ENV["FONTCONFIG_FILE"] = fonts_conf
    ccall((:FcInit, libfontconfig), UInt8, ())

    # By default fontconfig on OSX does not include user fonts.
    @static if Sys.isapple()
        ccall((:FcConfigAppFontAddDir, libfontconfig),
               UInt8, (Ptr{Nothing}, Ptr{UInt8}),
               C_NULL, b"~/Library/Fonts")
    end
end

const FcMatchPattern = UInt32(0)
const FcMatchFont    = UInt32(1)
const FcMatchScan    = UInt32(2)

const string_attrs = Set([:family, :style, :foundry, :file, :lang,
                          :fullname, :familylang, :stylelang, :fullnamelang,
                          :compatibility, :fontformat, :fontfeatures, :namelang,
                          :prgname, :hash, :postscriptname])

const double_attrs = Set([:size, :aspect, :pixelsize, :scale, :dpi])

const integer_attrs =  Set([:slant, :weight, :spacing, :hintstyle, :width, :index,
                            :rgba, :fontversion, :lcdfilter])

const bool_attrs = Set([:antialias, :histing, :verticallayout, :autohint, :outline,
                        :scalable, :minspace, :embolden, :embeddedbitmap,
                        :decorative])

mutable struct Pattern
    ptr::Ptr{Nothing}

    function Pattern(; args...)
        ptr = ccall((:FcPatternCreate, libfontconfig), Ptr{Nothing}, ())

        for (attr, value) in args
            if attr in string_attrs
                ccall((:FcPatternAddString, libfontconfig), Cint,
                      (Ptr{Nothing}, Ptr{UInt8}, Ptr{UInt8}),
                      ptr, string(attr), value)
            elseif attr in double_attrs
                ccall((:FcPatternAddDouble, libfontconfig), Cint,
                      (Ptr{Nothing}, Ptr{UInt8}, Cdouble),
                      ptr, string(attr), value)
            elseif attr in integer_attrs
                ccall((:FcPatternAddInteger, libfontconfig), Cint,
                      (Ptr{Nothing}, Ptr{UInt8}, Cint),
                      ptr, string(attr), value)
            elseif attr in bool_attrs
                ccall((:FcPatternAddBool, libfontconfig), Cint,
                      (Ptr{Nothing}, Ptr{UInt8}, Cint),
                      ptr, string(attr), value)
            end
        end

        pat = new(ptr)
        finalizer(pat -> ccall((:FcPatternDestroy, libfontconfig), Nothing,
                                    (Ptr{Nothing},), pat.ptr), pat)
        return pat
    end

    function Pattern(ptr::Ptr{Nothing})
        return new(ptr)
    end

    function Pattern(name::AbstractString)
        ptr = ccall((:FcNameParse, libfontconfig), Ptr{Nothing}, (Ptr{UInt8},), name)
        pat = new(ptr)
        finalizer(pat -> ccall((:FcPatternDestroy, libfontconfig), Nothing,
                                    (Ptr{Nothing},), pat.ptr), pat)
        return pat
    end
end

function Base.show(io::IO, pat::Pattern)
    desc = ccall((:FcNameUnparse, libfontconfig), Ptr{UInt8},
                 (Ptr{Nothing},), pat.ptr)
    @printf(io, "Fontconfig.Pattern(\"%s\")", unsafe_string(desc))
    Libc.free(desc)
end

function Base.match(pat::Pattern, default_substitute::Bool=true)
    ccall((:FcConfigSubstitute, libfontconfig),
          UInt8, (Ptr{Nothing}, Ptr{Nothing}, Int32),
          C_NULL, pat.ptr, FcMatchPattern)

    if default_substitute
        ccall((:FcDefaultSubstitute, libfontconfig),
              Nothing, (Ptr{Nothing},), pat.ptr)
    end

    result = Int32[0]
    mat = ccall((:FcFontMatch, libfontconfig),
                Ptr{Nothing}, (Ptr{Nothing}, Ptr{Nothing}, Ptr{Int32}),
                C_NULL, pat.ptr, result)

    if result[1] != 0
        error(string("Fontconfig was unable to match font ", pat))
    end

    return Pattern(mat)
end

function format(pat::Pattern, fmt::AbstractString="%{=fclist}")
    desc = ccall((:FcPatternFormat, libfontconfig), Ptr{UInt8},
                 (Ptr{Nothing}, Ptr{UInt8}), pat.ptr, fmt)
    if desc == C_NULL
        error("Invalid fontconfig format.")
    end
    descstr = unsafe_string(desc)
    Libc.free(desc)
    return descstr
end

struct FcFontSet
    nfont::Cint
    sfont::Cint
    fonts::Ptr{Ptr{Nothing}}
end

function list(pat::Pattern=Pattern())
    os = ccall((:FcObjectSetCreate, libfontconfig), Ptr{Nothing}, ())
    ccall((:FcObjectSetAdd, libfontconfig), Cint, (Ptr{Nothing}, Ptr{UInt8}),
          os, "family")
    ccall((:FcObjectSetAdd, libfontconfig), Cint, (Ptr{Nothing}, Ptr{UInt8}),
          os, "style")
    ccall((:FcObjectSetAdd, libfontconfig), Cint, (Ptr{Nothing}, Ptr{UInt8}),
          os, "file")

    fs_ptr = ccall((:FcFontList, libfontconfig), Ptr{FcFontSet},
                   (Ptr{Nothing}, Ptr{Nothing}, Ptr{Nothing}), C_NULL, pat.ptr, os)
    fs = unsafe_load(fs_ptr)

    patterns = Pattern[]
    for i in 1:fs.nfont
        push!(patterns, Pattern(unsafe_load(fs.fonts, i)))
    end

    ccall((:FcObjectSetDestroy, libfontconfig), Nothing, (Ptr{Nothing},), os)

    return patterns
end

end # module


text:
using JuMP, EAGO

                     m = Model()

                     EAGO.register_eago_operators!(m)

                     @variable(m, -1 <= x[i=1:5] <= 1)

                     @variable(m, -3.1544947018849654 <= q <= 4.066926790342683)

                     add_NL_constraint(m, :((-0.7544717811096784 + -0.6289249660430758*(-0.401848603561894 + 0.9879850116297502*(0.7471741672319268 + 0.1562161389212755*$(x[1]) + -0.06104000939937393*$(x[2]) + -0.24396039580062512*$(x[3]) + -0.35002310972719863*$(x[4]) + -0.47890036372503086*$(x[5]))*(1 + erf((0.7471741672319268 + 0.1562161389212755*$(x[1]) + -0.06104000939937393*$(x[2]) + -0.24396039580062512*$(x[3]) + -0.35002310972719863*$(x[4]) + -0.47890036372503086*$(x[5]))/sqrt(2)))/2 + -0.6833595346541679*(0.07659783311726898 + 0.1400377608602934*$(x[1]) + -0.5920144548543678*$(x[2]) + -0.3715997206073691*$(x[3]) + -0.08423829417739581*$(x[4]) + -0.48744433011047184*$(x[5]))*(1 + erf((0.07659783311726898 + 0.1400377608602934*$(x[1]) + -0.5920144548543678*$(x[2]) + -0.3715997206073691*$(x[3]) + -0.08423829417739581*$(x[4]) + -0.48744433011047184*$(x[5]))/sqrt(2)))/2)*(1 + erf((-0.401848603561894 + 0.9879850116297502*(0.7471741672319268 + 0.1562161389212755*$(x[1]) + -0.06104000939937393*$(x[2]) + -0.24396039580062512*$(x[3]) + -0.35002310972719863*$(x[4]) + -0.47890036372503086*$(x[5]))*(1 + erf((0.7471741672319268 + 0.1562161389212755*$(x[1]) + -0.06104000939937393*$(x[2]) + -0.24396039580062512*$(x[3]) + -0.35002310972719863*$(x[4]) + -0.47890036372503086*$(x[5]))/sqrt(2)))/2 + -0.6833595346541679*(0.07659783311726898 + 0.1400377608602934*$(x[1]) + -0.5920144548543678*$(x[2]) + -0.3715997206073691*$(x[3]) + -0.08423829417739581*$(x[4]) + -0.48744433011047184*$(x[5]))*(1 + erf((0.07659783311726898 + 0.1400377608602934*$(x[1]) + -0.5920144548543678*$(x[2]) + -0.3715997206073691*$(x[3]) + -0.08423829417739581*$(x[4]) + -0.48744433011047184*$(x[5]))/sqrt(2)))/2)/sqrt(2)))/2 + -0.656030629474813*(-0.9665555719654946 + 0.014645656858022438*(0.7471741672319268 + 0.1562161389212755*$(x[1]) + -0.06104000939937393*$(x[2]) + -0.24396039580062512*$(x[3]) + -0.35002310972719863*$(x[4]) + -0.47890036372503086*$(x[5]))*(1 + erf((0.7471741672319268 + 0.1562161389212755*$(x[1]) + -0.06104000939937393*$(x[2]) + -0.24396039580062512*$(x[3]) + -0.35002310972719863*$(x[4]) + -0.47890036372503086*$(x[5]))/sqrt(2)))/2 + -0.5583055948877655*(0.07659783311726898 + 0.1400377608602934*$(x[1]) + -0.5920144548543678*$(x[2]) + -0.3715997206073691*$(x[3]) + -0.08423829417739581*$(x[4]) + -0.48744433011047184*$(x[5]))*(1 + erf((0.07659783311726898 + 0.1400377608602934*$(x[1]) + -0.5920144548543678*$(x[2]) + -0.3715997206073691*$(x[3]) + -0.08423829417739581*$(x[4]) + -0.48744433011047184*$(x[5]))/sqrt(2)))/2)*(1 + erf((-0.9665555719654946 + 0.014645656858022438*(0.7471741672319268 + 0.1562161389212755*$(x[1]) + -0.06104000939937393*$(x[2]) + -0.24396039580062512*$(x[3]) + -0.35002310972719863*$(x[4]) + -0.47890036372503086*$(x[5]))*(1 + erf((0.7471741672319268 + 0.1562161389212755*$(x[1]) + -0.06104000939937393*$(x[2]) + -0.24396039580062512*$(x[3]) + -0.35002310972719863*$(x[4]) + -0.47890036372503086*$(x[5]))/sqrt(2)))/2 + -0.5583055948877655*(0.07659783311726898 + 0.1400377608602934*$(x[1]) + -0.5920144548543678*$(x[2]) + -0.3715997206073691*$(x[3]) + -0.08423829417739581*$(x[4]) + -0.48744433011047184*$(x[5]))*(1 + erf((0.07659783311726898 + 0.1400377608602934*$(x[1]) + -0.5920144548543678*$(x[2]) + -0.3715997206073691*$(x[3]) + -0.08423829417739581*$(x[4]) + -0.48744433011047184*$(x[5]))/sqrt(2)))/2)/sqrt(2)))/2)*(1 + erf((-0.7544717811096784 + -0.6289249660430758*(-0.401848603561894 + 0.9879850116297502*(0.7471741672319268 + 0.1562161389212755*$(x[1]) + -0.06104000939937393*$(x[2]) + -0.24396039580062512*$(x[3]) + -0.35002310972719863*$(x[4]) + -0.47890036372503086*$(x[5]))*(1 + erf((0.7471741672319268 + 0.1562161389212755*$(x[1]) + -0.06104000939937393*$(x[2]) + -0.24396039580062512*$(x[3]) + -0.35002310972719863*$(x[4]) + -0.47890036372503086*$(x[5]))/sqrt(2)))/2 + -0.6833595346541679*(0.07659783311726898 + 0.1400377608602934*$(x[1]) + -0.5920144548543678*$(x[2]) + -0.3715997206073691*$(x[3]) + -0.08423829417739581*$(x[4]) + -0.48744433011047184*$(x[5]))*(1 + erf((0.07659783311726898 + 0.1400377608602934*$(x[1]) + -0.5920144548543678*$(x[2]) + -0.3715997206073691*$(x[3]) + -0.08423829417739581*$(x[4]) + -0.48744433011047184*$(x[5]))/sqrt(2)))/2)*(1 + erf((-0.401848603561894 + 0.9879850116297502*(0.7471741672319268 + 0.1562161389212755*$(x[1]) + -0.06104000939937393*$(x[2]) + -0.24396039580062512*$(x[3]) + -0.35002310972719863*$(x[4]) + -0.47890036372503086*$(x[5]))*(1 + erf((0.7471741672319268 + 0.1562161389212755*$(x[1]) + -0.06104000939937393*$(x[2]) + -0.24396039580062512*$(x[3]) + -0.35002310972719863*$(x[4]) + -0.47890036372503086*$(x[5]))/sqrt(2)))/2 + -0.6833595346541679*(0.07659783311726898 + 0.1400377608602934*$(x[1]) + -0.5920144548543678*$(x[2]) + -0.3715997206073691*$(x[3]) + -0.08423829417739581*$(x[4]) + -0.48744433011047184*$(x[5]))*(1 + erf((0.07659783311726898 + 0.1400377608602934*$(x[1]) + -0.5920144548543678*$(x[2]) + -0.3715997206073691*$(x[3]) + -0.08423829417739581*$(x[4]) + -0.48744433011047184*$(x[5]))/sqrt(2)))/2)/sqrt(2)))/2 + -0.656030629474813*(-0.9665555719654946 + 0.014645656858022438*(0.7471741672319268 + 0.1562161389212755*$(x[1]) + -0.06104000939937393*$(x[2]) + -0.24396039580062512*$(x[3]) + -0.35002310972719863*$(x[4]) + -0.47890036372503086*$(x[5]))*(1 + erf((0.7471741672319268 + 0.1562161389212755*$(x[1]) + -0.06104000939937393*$(x[2]) + -0.24396039580062512*$(x[3]) + -0.35002310972719863*$(x[4]) + -0.47890036372503086*$(x[5]))/sqrt(2)))/2 + -0.5583055948877655*(0.07659783311726898 + 0.1400377608602934*$(x[1]) + -0.5920144548543678*$(x[2]) + -0.3715997206073691*$(x[3]) + -0.08423829417739581*$(x[4]) + -0.48744433011047184*$(x[5]))*(1 + erf((0.07659783311726898 + 0.1400377608602934*$(x[1]) + -0.5920144548543678*$(x[2]) + -0.3715997206073691*$(x[3]) + -0.08423829417739581*$(x[4]) + -0.48744433011047184*$(x[5]))/sqrt(2)))/2)*(1 + erf((-0.9665555719654946 + 0.014645656858022438*(0.7471741672319268 + 0.1562161389212755*$(x[1]) + -0.06104000939937393*$(x[2]) + -0.24396039580062512*$(x[3]) + -0.35002310972719863*$(x[4]) + -0.47890036372503086*$(x[5]))*(1 + erf((0.7471741672319268 + 0.1562161389212755*$(x[1]) + -0.06104000939937393*$(x[2]) + -0.24396039580062512*$(x[3]) + -0.35002310972719863*$(x[4]) + -0.47890036372503086*$(x[5]))/sqrt(2)))/2 + -0.5583055948877655*(0.07659783311726898 + 0.1400377608602934*$(x[1]) + -0.5920144548543678*$(x[2]) + -0.3715997206073691*$(x[3]) + -0.08423829417739581*$(x[4]) + -0.48744433011047184*$(x[5]))*(1 + erf((0.07659783311726898 + 0.1400377608602934*$(x[1]) + -0.5920144548543678*$(x[2]) + -0.3715997206073691*$(x[3]) + -0.08423829417739581*$(x[4]) + -0.48744433011047184*$(x[5]))/sqrt(2)))/2)/sqrt(2)))/2)/sqrt(2)))/2 + (-0.3137145052115069 + -0.6627216812930383*(-0.401848603561894 + 0.9879850116297502*(0.7471741672319268 + 0.1562161389212755*$(x[1]) + -0.06104000939937393*$(x[2]) + -0.24396039580062512*$(x[3]) + -0.35002310972719863*$(x[4]) + -0.47890036372503086*$(x[5]))*(1 + erf((0.7471741672319268 + 0.1562161389212755*$(x[1]) + -0.06104000939937393*$(x[2]) + -0.24396039580062512*$(x[3]) + -0.35002310972719863*$(x[4]) + -0.47890036372503086*$(x[5]))/sqrt(2)))/2 + -0.6833595346541679*(0.07659783311726898 + 0.1400377608602934*$(x[1]) + -0.5920144548543678*$(x[2]) + -0.3715997206073691*$(x[3]) + -0.08423829417739581*$(x[4]) + -0.48744433011047184*$(x[5]))*(1 + erf((0.07659783311726898 + 0.1400377608602934*$(x[1]) + -0.5920144548543678*$(x[2]) + -0.3715997206073691*$(x[3]) + -0.08423829417739581*$(x[4]) + -0.48744433011047184*$(x[5]))/sqrt(2)))/2)*(1 + erf((-0.401848603561894 + 0.9879850116297502*(0.7471741672319268 + 0.1562161389212755*$(x[1]) + -0.06104000939937393*$(x[2]) + -0.24396039580062512*$(x[3]) + -0.35002310972719863*$(x[4]) + -0.47890036372503086*$(x[5]))*(1 + erf((0.7471741672319268 + 0.1562161389212755*$(x[1]) + -0.06104000939937393*$(x[2]) + -0.24396039580062512*$(x[3]) + -0.35002310972719863*$(x[4]) + -0.47890036372503086*$(x[5]))/sqrt(2)))/2 + -0.6833595346541679*(0.07659783311726898 + 0.1400377608602934*$(x[1]) + -0.5920144548543678*$(x[2]) + -0.3715997206073691*$(x[3]) + -0.08423829417739581*$(x[4]) + -0.48744433011047184*$(x[5]))*(1 + erf((0.07659783311726898 + 0.1400377608602934*$(x[1]) + -0.5920144548543678*$(x[2]) + -0.3715997206073691*$(x[3]) + -0.08423829417739581*$(x[4]) + -0.48744433011047184*$(x[5]))/sqrt(2)))/2)/sqrt(2)))/2 + -0.39516873731093893*(-0.9665555719654946 + 0.014645656858022438*(0.7471741672319268 + 0.1562161389212755*$(x[1]) + -0.06104000939937393*$(x[2]) + -0.24396039580062512*$(x[3]) + -0.35002310972719863*$(x[4]) + -0.47890036372503086*$(x[5]))*(1 + erf((0.7471741672319268 + 0.1562161389212755*$(x[1]) + -0.06104000939937393*$(x[2]) + -0.24396039580062512*$(x[3]) + -0.35002310972719863*$(x[4]) + -0.47890036372503086*$(x[5]))/sqrt(2)))/2 + -0.5583055948877655*(0.07659783311726898 + 0.1400377608602934*$(x[1]) + -0.5920144548543678*$(x[2]) + -0.3715997206073691*$(x[3]) + -0.08423829417739581*$(x[4]) + -0.48744433011047184*$(x[5]))*(1 + erf((0.07659783311726898 + 0.1400377608602934*$(x[1]) + -0.5920144548543678*$(x[2]) + -0.3715997206073691*$(x[3]) + -0.08423829417739581*$(x[4]) + -0.48744433011047184*$(x[5]))/sqrt(2)))/2)*(1 + erf((-0.9665555719654946 + 0.014645656858022438*(0.7471741672319268 + 0.1562161389212755*$(x[1]) + -0.06104000939937393*$(x[2]) + -0.24396039580062512*$(x[3]) + -0.35002310972719863*$(x[4]) + -0.47890036372503086*$(x[5]))*(1 + erf((0.7471741672319268 + 0.1562161389212755*$(x[1]) + -0.06104000939937393*$(x[2]) + -0.24396039580062512*$(x[3]) + -0.35002310972719863*$(x[4]) + -0.47890036372503086*$(x[5]))/sqrt(2)))/2 + -0.5583055948877655*(0.07659783311726898 + 0.1400377608602934*$(x[1]) + -0.5920144548543678*$(x[2]) + -0.3715997206073691*$(x[3]) + -0.08423829417739581*$(x[4]) + -0.48744433011047184*$(x[5]))*(1 + erf((0.07659783311726898 + 0.1400377608602934*$(x[1]) + -0.5920144548543678*$(x[2]) + -0.3715997206073691*$(x[3]) + -0.08423829417739581*$(x[4]) + -0.48744433011047184*$(x[5]))/sqrt(2)))/2)/sqrt(2)))/2)*(1 + erf((-0.3137145052115069 + -0.6627216812930383*(-0.401848603561894 + 0.9879850116297502*(0.7471741672319268 + 0.1562161389212755*$(x[1]) + -0.06104000939937393*$(x[2]) + -0.24396039580062512*$(x[3]) + -0.35002310972719863*$(x[4]) + -0.47890036372503086*$(x[5]))*(1 + erf((0.7471741672319268 + 0.1562161389212755*$(x[1]) + -0.06104000939937393*$(x[2]) + -0.24396039580062512*$(x[3]) + -0.35002310972719863*$(x[4]) + -0.47890036372503086*$(x[5]))/sqrt(2)))/2 + -0.6833595346541679*(0.07659783311726898 + 0.1400377608602934*$(x[1]) + -0.5920144548543678*$(x[2]) + -0.3715997206073691*$(x[3]) + -0.08423829417739581*$(x[4]) + -0.48744433011047184*$(x[5]))*(1 + erf((0.07659783311726898 + 0.1400377608602934*$(x[1]) + -0.5920144548543678*$(x[2]) + -0.3715997206073691*$(x[3]) + -0.08423829417739581*$(x[4]) + -0.48744433011047184*$(x[5]))/sqrt(2)))/2)*(1 + erf((-0.401848603561894 + 0.9879850116297502*(0.7471741672319268 + 0.1562161389212755*$(x[1]) + -0.06104000939937393*$(x[2]) + -0.24396039580062512*$(x[3]) + -0.35002310972719863*$(x[4]) + -0.47890036372503086*$(x[5]))*(1 + erf((0.7471741672319268 + 0.1562161389212755*$(x[1]) + -0.06104000939937393*$(x[2]) + -0.24396039580062512*$(x[3]) + -0.35002310972719863*$(x[4]) + -0.47890036372503086*$(x[5]))/sqrt(2)))/2 + -0.6833595346541679*(0.07659783311726898 + 0.1400377608602934*$(x[1]) + -0.5920144548543678*$(x[2]) + -0.3715997206073691*$(x[3]) + -0.08423829417739581*$(x[4]) + -0.48744433011047184*$(x[5]))*(1 + erf((0.07659783311726898 + 0.1400377608602934*$(x[1]) + -0.5920144548543678*$(x[2]) + -0.3715997206073691*$(x[3]) + -0.08423829417739581*$(x[4]) + -0.48744433011047184*$(x[5]))/sqrt(2)))/2)/sqrt(2)))/2 + -0.39516873731093893*(-0.9665555719654946 + 0.014645656858022438*(0.7471741672319268 + 0.1562161389212755*$(x[1]) + -0.06104000939937393*$(x[2]) + -0.24396039580062512*$(x[3]) + -0.35002310972719863*$(x[4]) + -0.47890036372503086*$(x[5]))*(1 + erf((0.7471741672319268 + 0.1562161389212755*$(x[1]) + -0.06104000939937393*$(x[2]) + -0.24396039580062512*$(x[3]) + -0.35002310972719863*$(x[4]) + -0.47890036372503086*$(x[5]))/sqrt(2)))/2 + -0.5583055948877655*(0.07659783311726898 + 0.1400377608602934*$(x[1]) + -0.5920144548543678*$(x[2]) + -0.3715997206073691*$(x[3]) + -0.08423829417739581*$(x[4]) + -0.48744433011047184*$(x[5]))*(1 + erf((0.07659783311726898 + 0.1400377608602934*$(x[1]) + -0.5920144548543678*$(x[2]) + -0.3715997206073691*$(x[3]) + -0.08423829417739581*$(x[4]) + -0.48744433011047184*$(x[5]))/sqrt(2)))/2)*(1 + erf((-0.9665555719654946 + 0.014645656858022438*(0.7471741672319268 + 0.1562161389212755*$(x[1]) + -0.06104000939937393*$(x[2]) + -0.24396039580062512*$(x[3]) + -0.35002310972719863*$(x[4]) + -0.47890036372503086*$(x[5]))*(1 + erf((0.7471741672319268 + 0.1562161389212755*$(x[1]) + -0.06104000939937393*$(x[2]) + -0.24396039580062512*$(x[3]) + -0.35002310972719863*$(x[4]) + -0.47890036372503086*$(x[5]))/sqrt(2)))/2 + -0.5583055948877655*(0.07659783311726898 + 0.1400377608602934*$(x[1]) + -0.5920144548543678*$(x[2]) + -0.3715997206073691*$(x[3]) + -0.08423829417739581*$(x[4]) + -0.48744433011047184*$(x[5]))*(1 + erf((0.07659783311726898 + 0.1400377608602934*$(x[1]) + -0.5920144548543678*$(x[2]) + -0.3715997206073691*$(x[3]) + -0.08423829417739581*$(x[4]) + -0.48744433011047184*$(x[5]))/sqrt(2)))/2)/sqrt(2)))/2)/sqrt(2)))/2 - $q <= 0.0))

                     @objective(m, Min, q)

                     return m

max_stars_repo_name: PSORLab/RSActivationFunctions

max_issues_repo_name: PSORLab/RSActivationFunctions

max_forks_repo_name: PSORLab/RSActivationFunctions


text:
# Note that this script can accept some limited command-line arguments, run
# `julia build_tarballs.jl --help` to see a usage message.
using BinaryBuilder

name = "SassC"
version = v"3.6.2"

# Collection of sources required to build SassBuilder
sources = [
    GitSource("https://github.com/sass/sassc.git", "66f0ef37e7f0ad3a65d2f481eff09d09408f42d0"),
]

# Bash recipe for building across all platforms
script = raw"""
cd $WORKSPACE/srcdir/sassc*
export CPPFLAGS="-I${includedir}"
autoreconf --force --install
./configure --prefix=${prefix} --host=${target} --build=${MACHTYPE}
make -j${nproc}
make install
"""

# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = supported_platforms()

# The products that we will ensure are always built
products = [
    ExecutableProduct("sassc", :sassc),
]

# Dependencies that must be installed before this package can be built
dependencies = [
    Dependency("libsass_jll"; compat="3.6.4"),
]

# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; julia_compat="1.6", preferred_gcc_version=v"5")

max_stars_repo_name: jakebolewski/Yggdrasil

max_issues_repo_name: jakebolewski/Yggdrasil

max_forks_repo_name: jakebolewski/Yggdrasil


text:
#ДАНО: Робот - в произвольной клетке ограниченного прямоугольного поля,
#на котором могут находиться также внутренние прямоугольные перегородки
#(все перегородки изолированы друг от друга, прямоугольники могут вырождаться в отрезки)

#РЕЗУЛЬТАТ: Робот - в исходном положении, и в 4-х приграничных клетках, две из которых имеют ту же широту,
#а две - ту же долготу, что и Робот, стоят маркеры.

function moves!(r,side) #возвращает число шагов
    num=0
    while isborder(r,side) == false
        move!(r,side)
        num += 1
    end
    return num
end

function moves!(r, side, num) #перемещает на число шагов
    for i in 1:num
        if !isborder(r,side)
            move!(r, side)
        end
    end
end

function next_side(side)
    for i=0:3
        if side == HorizonSide(i)
            return HorizonSide(mod(i+3,4))
        end
    end
end

function mark_cord(r, side, num)
    moves!(r,side,num)
    putmarker!(r)
    num = moves!(r,side)
    return num
end

function reverse(i)
    if isodd(i) == true
        side = Ost
    else
        side = Nord
    end
    return side
end

function back(r,a)
    global num   #размер массива
    for i = 1:num
        moves!(r,reverse(num-i+1),a[num-i+1])
    end
end

function f(r)
    a = Int64[]
    global num = 0
    while !isborder(r,Sud) || !isborder(r,West)
        push!(a, moves!(r,West))
        push!(a, moves!(r,Sud))
        num += 2
    end
    x = 0
    y = 0
    for i in 1:num
        if isodd(i) == true
            y += a[i]
        else
            x += a[i]
        end
    end
    side = Nord
    for _ in 1:2
        x = mark_cord(r,side,x)
        side = next_side(side)
        y = mark_cord(r,side,y)
        side = next_side(side)
    end
    back(r, a)
end

max_stars_repo_name: gardend/mirea-progs

max_issues_repo_name: gardend/mirea-progs

max_forks_repo_name: gardend/mirea-progs


text:
import NodeModule.Node

function read_nodes(path::String)::Array{Node}
    """Reading nodes from giving file path.
    """
    nodes = Node[]
    open(path) do f
        is_coords = false
        for line in eachline(f)
            if line == "EOF"
                break
            end
            if line[1] == '1'
                is_coords = true
            end
            if is_coords
                line_vals = split(line)
                id = parse(Int16, line_vals[1])
                x_coord = parse(Float32, line_vals[2])
                y_coord = parse(Float32, line_vals[3])
                push!(nodes, Node(id, x_coord, y_coord))
            end
        end
    end
    return nodes
end

max_stars_repo_name: zahidkizmaz/firefly-algorithm-tsp

max_issues_repo_name: zahidkizmaz/firefly-algorithm-tsp

max_forks_repo_name: zahidkizmaz/firefly-algorithm-tsp


text:
include("adder.jl")
include("divider.jl")

a = adder(2, 5)
println("a is $a")

d = divider(10, 3.5)
println("d is $d")

max_stars_repo_name: wigging/julia-computing

max_issues_repo_name: wigging/julia-computing

max_forks_repo_name: wigging/julia-computing


text:
export ExplicitSolver, NewmarkSolver, AdaptiveSolver, SolverInitial!, StaticSolver, EigenModeHelper, EigenMode, SolverInitial

@doc raw"""
compuate largest eigenvalue lambda, lambda M x = stiff*x
"""->
function EigenModeHelper(M, stiff, eps0 = 1.0e-12, maxite = 100)
    #compuate largest eigenvalue lambda, lambda M x = Kx
    x_old = ones(size(stiff)[1])
    x_new = ones(size(stiff)[1])
    lambda_old = lambda_new = 0.0
    converge = false
    ite = 0
    while ite < maxite && converge == false
        #solve M x_new = stiff x_old
        x_new[:] = M \ (stiff * x_old)
        x_new[:] = x_new/sqrt(x_new' * M * x_new)
        lambda_new = (x_new' * stiff * x_new)
        if (lambda_new - lambda_old)/lambda_new < eps0 #converge
            converge = true
        else
            x_old[:] = x_new
            lambda_old = lambda_new
            ite += 1
        end
    end
    if converge == false
        @warn("Eigen iteration does not converge in EigenModeHelper")
    end
    return lambda_new, x_new
end

@doc raw"""
Compute eigenmodel using globdat.state (and domain.Dstate, Δt for path/rate-dependent
stiffness matrix

find largest eigenvalue λ for
 λM x= K x
 ω^2 = λ
"""->
function EigenMode(Δt, globdat, domain, eps0 = 1.0e-6, maxite = 100)
    assembleMassMatrix!(globdat, domain)
    u = globdat.state[:]  #uⁿ

    M = globdat.M
    domain.state[domain.eq_to_dof] = u
    _, stiff = assembleStiffAndForce(globdat, domain, 0.0)

    lambda, _ = EigenModeHelper(M, stiff, eps0, maxite)

    omega = sqrt(lambda)

    return omega
end

@doc raw"""
    SolverInitial!(Δt::Float64, globdat::GlobalData, domain::Domain)

You need to call SolverInitial! before the first time step, if $f^{ext}_0 \neq 0$

```math
a_0 = M^{-1}(- f^{int}(u_0) + f^{ext}_0)
```
"""
function SolverInitial!(Δt::Float64, globdat::GlobalData, domain::Domain)
    fext = getExternalForce(domain, globdat)
    domain.state[domain.eq_to_dof] = globdat.state[:]
    fint  = assembleInternalForce( globdat, domain, Δt)
    globdat.acce[:] = globdat.M\(fext - fint)
end

"""
    SolverInitial(Δt::Float64, globdat::GlobalData, domain::Domain)

Similar to [`SolverInitial!`](@ref), but returns the (displacement, velocity, acceleartion) tuple.
"""
function SolverInitial(Δt::Float64, globdat::GlobalData, domain::Domain)
    SolverInitial!(Δt, globdat, domain)
    u0 = domain.state
    v0 = zeros(length(u0))
    v0[domain.eq_to_dof] = globdat.velo[:]
    a0 = zeros(length(u0))
    a0[domain.eq_to_dof] = globdat.acce[:]
    u0, v0, a0
end

function ExplicitSolver(Δt::Float64, globdat::GlobalData, domain::Domain)

    if length(globdat.M)==0
        error("globalDat is not initialized,
            call `assembleMassMatrix!(globaldat, domain)`")
    end

    u = globdat.state[:]
    ∂u  = globdat.velo[:]
    ∂∂u = globdat.acce[:]

    globdat.time  += Δt
    #get fext at t + Δt
    updateTimeDependentEssentialBoundaryCondition!(domain, globdat)
    fext = getExternalForce(domain, globdat)

    u += Δt*∂u + 0.5*Δt*Δt*∂∂u
    ∂u += 0.5*Δt * ∂∂u

    domain.state[domain.eq_to_dof] = u[:]
    fint  = assembleInternalForce( globdat, domain, Δt)
    ∂∂up = globdat.M\(fext - fint)

    ∂u += 0.5 * Δt * ∂∂up

    globdat.Dstate = globdat.state[:]
    globdat.state = u[:]
    globdat.velo = ∂u[:]
    globdat.acce = ∂∂up[:]

    commitHistory(domain)
    updateStates!(domain, globdat)

    # (optional) for visualization, update fint and fext history
    if options.save_history>=2
        fint = assembleInternalForce( globdat, domain, Δt)
        push!(domain.history["fint"], fint)
        push!(domain.history["fext"], fext)
    end
end

@doc raw"""
    NewmarkSolver (Generalized-alpha) implicit solver

- 'Δt': Float64,  time step size
- 'globdat', GlobalData
- 'domain', Domain
- 'αm', Float64
- 'αf', Float64
- 'ε', Float64, absolute error for Newton convergence
- 'ε0', Float64, relative error for Newton convergence
-  'maxiterstep', Int64, maximum iteration number for Newton convergence
-  'η', Float64, Newton step size at the first iteration
- 'failsafe', Bool, if failsafe is true, when the Newton fails to converge,
              revert back, and return false

Implicit solver for ``Ma  + fint(u) = fext``
``a``, ``v``, ``u`` are acceleration, velocity and displacement respectively.
```math
u_{n+1} = u_n + dtv_n + dt^2/2 ((1 - 2\beta)a_n + 2\beta a_{n+1})
v_{n+1} = v_n + dt((1 - \gamma)a_n + \gamma a_{n+1})
2\beta = 0.5*(1 - αm + αf)^2
\gamma = 0.5 - \alpha_m + \alpha_f

```

```math
a_{n+1-\alpha_m} = (1-\alpha_m)a_{n+1} + \alpha_m a_{n}
v_{n+1-\alpha_f} = (1-\alpha_f)v_{n+1} + \alpha_f v_{n}
u_{n+1-\alpha_f} = (1-\alpha_f)u_{n+1} + \alpha_f u_{n}
M a_{n+1-\alpha_m} + f^{int}(u_{n+1-\alpha_f}) = f^{ext}_{n+1-\alpha_f}
```

'a_{n+1}' is solved by

```math
M ((1-\alpha_m)a_{n+1} + \alpha_m a_{n})
+ f^{int}((1-\alpha_f)(u_n + dtv_n + dt^2/2 ((1 - 2\beta)a_n + 2\beta a_{n+1}))) + \alpha_f u_{n})
= f^{ext}_{n+1-\alpha_f}
```

As for '\alpha_m' and '\alpha_f'
```math
\alpha_m = (2\rho_{\infty} - 1)/(\rho_{\infty} + 1)
\alpha_f = \rho_{\infty}/(\rho_{\infty} + 1)
```

use the current states `a`, `v`, `u`, `time` in globdat, and update these stetes to next time step
update domain history, when failsafe is true, and Newton's solver fails, nothing will be changed.

You need to call SolverInitial! before the first time step, if $f^{ext}_0 \neq 0$.
`SolverInitial!` updates `a_0` in the `globdat.acce`

$$a_0 = M^{-1}(- f^{int}(u_0) + f^{ext}_0)$$

We assume `globdat.acce[:] = a_0` and so far initialized to 0
We also assume the external force is conservative (it does not depend on the current deformation)
"""->
function NewmarkSolver(Δt, globdat, domain, αm = -1.0, αf = 0.0, ε = 1e-8, ε0 = 1e-8, maxiterstep=100, η = 1.0, failsafe = false)
    local res0

    β2 = 0.5*(1 - αm + αf)^2
    γ = 0.5 - αm + αf

    # compute solution at uⁿ⁺¹
    failsafe_time = copy(globdat.time)
    globdat.time  += (1 - αf)*Δt

    # domain.Dstate = uⁿ
    failsafe_Dstate = copy(domain.Dstate)
    failsafe_state = copy(domain.state)
    domain.Dstate = domain.state[:]

    updateTimeDependentEssentialBoundaryCondition!(domain, globdat)
    M = globdat.M

    ∂∂u = globdat.acce[:] #∂∂uⁿ
    u = globdat.state[:]  #uⁿ
    ∂u  = globdat.velo[:] #∂uⁿ

    fext = getExternalForce(domain, globdat)

    ∂∂up = ∂∂u[:]

    Newtoniterstep, Newtonconverge = 0, false

    norm0 = Inf

    while !Newtonconverge

        Newtoniterstep += 1

        domain.state[domain.eq_to_dof] = (1 - αf)*(u + Δt*∂u + 0.5 * Δt * Δt * ((1 - β2)*∂∂u + β2*∂∂up)) + αf*u
        fint, stiff = assembleStiffAndForce( globdat, domain, Δt)
        res = M * (∂∂up *(1 - αm) + αm*∂∂u)  + fint - fext
        if Newtoniterstep==1
            res0 = res
        end
        A = M*(1 - αm) + (1 - αf) * 0.5 * β2 * Δt^2 * stiff
        Δ∂∂u = A\res

        while η * norm(Δ∂∂u) > norm0
            η /= 2.0
            @info "η", η
        end
        ∂∂up -= η*Δ∂∂u

        println("$Newtoniterstep/$maxiterstep, $(norm(res))")
        if (norm(res)< ε || norm(res)< ε0*norm(res0) ||Newtoniterstep > maxiterstep)
            if Newtoniterstep > maxiterstep
                # Newton method does not converge
                if failsafe
                    globdat.time = failsafe_time
                    domain.state = failsafe_state[:]
                    domain.Dstate = failsafe_Dstate[:]
                    return false
                end
                # When failsafe is not on, test the gradient
                function f(∂∂up)
                    domain.state[domain.eq_to_dof] = (1 - αf)*(u + Δt*∂u + 0.5 * Δt * Δt * ((1 - β2)*∂∂u + β2*∂∂up)) + αf*u
                    fint, stiff = assembleStiffAndForce( globdat, domain )
                    fint, (1 - αf) * 0.5 * β2 * Δt^2 * stiff
                end
                gradtest(f, ∂∂up)
                @warn("Newton iteration cannot converge $(norm(res))"); Newtonconverge = true
            else
                Newtonconverge = true
                printstyled("[Newmark] Newton converged $Newtoniterstep\n", color=:green)
            end
        end

        η = min(1.0, 2η)
        norm0 = norm(Δ∂∂u)
    end

    #update globdat to the next time step
    globdat.Dstate = globdat.state[:]
    globdat.state += Δt * ∂u + Δt^2/2 * ((1 - β2) * ∂∂u + β2 * ∂∂up)
    globdat.velo += Δt * ((1 - γ) * ∂∂u + γ * ∂∂up)
    globdat.acce = ∂∂up[:]
    globdat.time  += αf*Δt

    #commit history in domain
    commitHistory(domain)
    updateStates!(domain, globdat)
    if options.save_history>=2
        fint, stiff = assembleStiffAndForce( globdat, domain, Δt)
        push!(domain.history["fint"], fint)
        push!(domain.history["fext"], fext)
    end
    if options.save_history>=1
        push!(domain.history["time"], [globdat.time])
    end

    return true

end

@doc raw"""
Static implicit solver
- 'globdat', GlobalData
- 'domain', Domain
- 'loaditerstep', Int64, load stepping steps
- 'ε', Float64, absolute error for Newton convergence
-  'maxiterstep', Int64, maximum iteration number for Newton convergence

Solver for ``fint(u) = fext`` with load stepping, ``u`` is the displacement.
Iteratively solve u_{i}
```math
f^{int}(u_i) = i/loaditerstep f^{ext}
```

todo
We assume the external force is conservative (it does not depend on the current deformation)

"""
function StaticSolver(globdat, domain, loaditerstep = 10, ε = 1.e-8, maxiterstep=100)

    fext = domain.fext
    globdat.Dstate = copy(globdat.state)
    for iterstep = 1:loaditerstep

        # Newton's method
        Newtoniterstep, Newtonconverge = 0, false

        while  !Newtonconverge

            Newtoniterstep += 1

            fint, stiff = assembleStiffAndForce( globdat, domain )

            res = fint - iterstep/loaditerstep * fext

            Δstate = stiff\res

            globdat.state -= Δstate
            #@show Newtoniterstep, norm(res)
            if (norm(res) < ε  || Newtoniterstep > maxiterstep)
                if Newtoniterstep > maxiterstep
                    @error "$Newtoniterstep Newton iteration cannot converge"
                end
                Newtonconverge = true
            end
            updateStates!(domain, globdat)
        end
        commitHistory(domain)
        globdat.Dstate = copy(globdat.state)
    end
end

@doc raw"""
    Adaptive Solver, solve the whole process, if this step fails, redo the step with half of
    the time step size, when there are continuing 5 successful steps, double the step size when dt < T/NT

    - 'solvername': String,  so far only NewmarkSolver is supported
    - 'globdat', GlobalData
    - 'domain', Domain
    - 'T', Float64, total simulation time
    - 'NT', Int64, planned time steps
    - 'args', Dict{String, Value}, arguments for the solver

    return globdat, domain, ts, here ts is Float64[nteps+1]

You need to call SolverInitial! before the first time step, if f^{ext}_0 != 0.
SolverInitial! updates a_0 in the globdat.acce
a_0 = M^{-1}(- f^{int}(u_0) + f^{ext}_0)

We assume globdat.acce[:] = a_0 and so far initialized to 0
"""->
function AdaptiveSolver(solvername, globdat, domain, T, NT, args)

    failsafe = true
    ts = Float64[]

    Δt = T/NT #specified(maximum) time step
    dt = T/NT #current time step
    t = 0.0   #current time
    push!(ts, t)

    SolverInitial!(Δt, globdat, domain)

    if solvername == "NewmarkSolver"
        ρ_oo = args["Newmark_rho"]
        η = args["damped_Newton_eta"]
        maxiterstep = args["Newton_maxiter"]
        ε = args["Newton_Abs_Err"]
        ε0 = args["Newton_Rel_Err"]

        αm = (2*ρ_oo - 1)/(ρ_oo + 1)
        αf = ρ_oo/(ρ_oo + 1)

        convergeCounter = 0
        while t < T
            if t + dt > T
                dt = T - t
            end
            printstyled("dt = $dt, t = $t, T=$T\n", color=:cyan)

            convergeOrNot = NewmarkSolver(dt, globdat, domain, αm, αf, ε, ε0, maxiterstep, η, failsafe)

            if convergeOrNot
                convergeCounter += 1
                t += dt
                push!(ts, t)
                @assert globdat.time ≈ t
                #todo hardcode it to be 5
                if dt < 0.8*Δt  && convergeCounter >=5
                    dt = 2*dt
                end

            else
                @assert globdat.time ≈ t
                convergeCounter = 0
                dt /= 2.0

                @warn("Repeat time step with dt = ", dt)
            end
        end

    else
        @error("AdaptiveSolve has not implemented for ", solvername)
    end

    return globdat, domain, ts

end


text:
using Documenter
using TranscodingStreams

makedocs(
    format=:html,
    sitename="TranscodingStreams.jl",
    modules=[TranscodingStreams],
    pages=["index.md", "examples.md", "reference.md", "devnotes.md"],
    assets=["assets/custom.css"])

deploydocs(
    repo="github.com/bicycle1885/TranscodingStreams.jl.git",
    julia="0.7",
    target="build",
    deps=nothing,
    make=nothing)


text:
module SimpleContainerGenerator

import PackageCompiler
import Pkg
import UUIDs

include("types_config.jl")
include("types.jl")

include("public.jl")
include("public_create_dockerfile.jl")

include("assert.jl")
include("backups_of_simplecontainergenerator.jl")
include("config_to_template.jl")
include("default_values.jl")
include("docker.jl")
include("generate_helper_files.jl")
include("generate_install_packages.jl")
include("generate_packagecompiler_install.jl")
include("generate_packagecompiler_run.jl")
include("generate_precompile_execution.jl")
include("julia.jl")
include("pkg_dir.jl")
include("utils.jl")

end # module


text:
module Interop

using ..LLVM
import ..LLVM: API

const jlctx = Ref{LLVM.Context}()

include("interop/base.jl")
include("interop/asmcall.jl")
include("interop/passes.jl")
if VERSION >= v"1.5-"
include("interop/pointer.jl")
end
include("interop/utils.jl")

end


text:
##################################################################################
#
#  					fichier d'utilisation en cours de développement, doit disparaître de la version finale
#
##################################################################################
import Pkg
# Pkg.add("Revise") ; using Revise

monpk = Pkg.PackageSpec(name="multiobjectiveGraphs", path="/Users/robbes-d/Nextcloud/Robberies/Recherche/gitHubMOGraphs/multiobjectiveGraphs", mode=Pkg.PKGMODE_MANIFEST)
Pkg.add(monpk)
 import multiobjectiveGraphs
# multiobjectiveGraphs.greet()   ### premier essai ####
using multiobjectiveGraphs
greet()									   ### second essai ####
println("+++++++++++++++++++",Squares(5))

#################### execution des tests #######################
include("runtests.jl")

################## exemples simples d'utilisation ######################
include("examples.jl")

max_stars_repo_name: DRobbes/multiobjectiveGraphs

max_issues_repo_name: DRobbes/multiobjectiveGraphs

max_forks_repo_name: DRobbes/multiobjectiveGraphs


text:
using GR

srand(37)
y = randn(20, 500)

setviewport(0.1, 0.95, 0.1, 0.95)
setcharheight(0.020)
settextcolorind(82)
setfillcolorind(90)
setfillintstyle(1)

for x in 1:5000
  clearws()
  setwindow(x, x+500, -200, 200)
  fillrect(x, x+500, -200, 200)
  setlinecolorind(0);  grid(50, 50, 0, -200, 2, 2)
  setlinecolorind(82); axes(50, 50, x, -200, 2, 2, -0.005)
  y = hcat(y, randn(20))
  for i in 1:20
    setlinecolorind(980 + i)
    s = cumsum(reshape(y[i,:], x+500))
    polyline([x:x+500;], s[x:x+500])
  end
  updatews()
end