Git Product home page Git Product logo

complementarity.jl's Introduction

Complementarity.jl

Build Status codecov

This package provides modeling language for (1) mixed complementarity problems (MCP) and (2) mathematical programs with equilibrium problems (MPEC).

NOTE @complmentarity for MCP and @complements for MPEC.

Mixed Complementarity Problems (MCP)

NOTE: Differences between PATHSolver.jl and Complementarity.jl:

  • PATHSolver.jl provides a wrapper for the C API of the PATH solver.
  • PATHSolver.jl also enables JuMP for solving MCP, but limited to linear problems.
  • Complementarity.jl provides a JuMP extension for solving MCP, both linear and nonlinear, using the C API wrapper in PATHSolver.jl.

MCP Documentation

F(x) ⟂ lb ≤ x ≤ ub

A very simple example:

(x+2) x = 0,  x ≥ 0,   x+2 ≥ 0
using Complementarity, JuMP
m = MCPModel()
@variable(m, x >= 0)
@mapping(m, F, x+2)
@complementarity(m, F, x)
status = solveMCP(m)
@show result_value(x)

Mathematical Programs with Equilibrium Constraints (MPEC)

NOTE: For solving MPEC, JuMP.jl v0.21 has started supporting complementarity constraints. At this moment, GAMS.jl and KNITRO support complementarity constraints.

MPEC Documentation

min  f(x)
s.t. g(x) ≤ 0
     F(x) ⟂ lb ≤ x ≤ ub

A very simple example:

min  x^3
s.t. (x+2) x = 0,  x ≥ 0,   x+2 ≥ 0
using JuMP, Ipopt, Complementarity
m = Model(Ipopt.Optimizer)
@variable(m, x>=0)
@NLobjective(m, Min, x^3)
@complements(m, 0 <= x+2,   x >= 0)
solve(m)
@show getvalue(x)

Installation

Pkg.add("Complementarity")

This will also install a few other packages.

complementarity.jl's People

Contributors

chkwon avatar davidanthoff avatar mitchphillipson avatar odow avatar pkofod avatar solliolli avatar staticfloat avatar tkelman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

complementarity.jl's Issues

interface of correspond()

current form:

correspond(m, lb, x, ub, F)

suggestion:

@defVar(m, lb <= x <=ub)
correspond(m, F, x)

lb and ub are handled inside of correspond(). It should allow no bound, or one-side bound cases.

complementarity condition

I have one observation and suggestion for the complementarity condition. There are numerical evidences such that inequality complementarity condition works better than the equality, particularly when solving MPEC as an NLP (e.g., please see Section 2.1 in http://www3.eng.cam.ac.uk/~dr241/Papers/Fletcher-Leyffer-Ralph-Scholtes.pdf). But, I don't know whether the inequality always outperforms or not; for example, when using pivoting-type algorithms. I wonder if this package can have option for switching the signs of the complementarity condition, between == and <=.

This is not issue. Just asking for help in specifying and solving a model.

Posted here asking for help but no response so far. I am actually now doubtful I will get any there, so I try here. Essentially, I want to solve a complementarity problem derived from a cake eating model. This link provides for examples solved in GAMS. I would like to do the same in Julia.

I paste example code here that I am working on. If someone can help me make this work, I will appreciate a lot.


using PATH, JuMP, Complementarity

function geological_constraints_MCP()

    Α = 50.0
    Β = 0.1
    δ = 0.05
    R₀ = 0.5
    T = 10
    t = 1:T
    AA = Α*(1+δ)

    gxt =MCPModel()

    @variable(gxt, q[i in 1:T]>=0)
    @variable(gxt, λ[i in 1:T]>=0)
    @variable(gxt, R[i in 1:T]>=0)

    @mapping(gxt, FOCq[i in 1:T], - (Α - Β*q[i] - λ[i]))
    @complementarity(gxt,FOCq,q)
    @mapping(gxt, FOCR[i in 1:T], - ((i<T ? λ[i+1] : AA) - (λ[i]*(1 + δ))))
    @complementarity(gxt,FOCR,λ)
    @mapping(gxt, FOCλ[i in 1:T], - (R[i] + q[i] - (i>1 ? R[i-1] :  R₀)))
    @complementarity(gxt,FOCλ,R)

    print(gxt)
    status = solveMCP(gxt)
    @show result_value.(q)
    @show result_value.(R)
    @show result_value.(λ)


end


geological_constraints_MCP()

Maintenance

Hi,

I saw the message that this package is no longer maintained, with a pointer towards newer versions of JuMP and PATHSolver as alternatives. But it seems to me that at the moment JuMP with PATHSolver does not support the non-linear problems of the kind that one can model with Complementarity, right? And at the same time I interpreted @odow's response over at chkwon/PATHSolver.jl#47 as saying that it will take quite a while (realistically 1-2 years) for a generic JuMP/PATHSolver solution to emerge.

So I'm wondering whether it would make sense to continue maintaining Complementarity.jl, until there is actually a viable alternative available? After all, things do seem to work at the moment for non-linear problems, and we (and I believe others) have a lot of use-cases where we would like to utilize the existing functionality.

As far as I can tell the only compat work that one might have to do at the moment is to update Complementarity.jl to work with PATHSolver.jl v1, right?

Problem with JuMP.fix command

Hi,

I've been working on a complementarity model and it involves fixing some variables. To do this in JuMP i've attempted to use

for i in suppliers, s in seasons, t in timeperiods JuMP.fix(s_contract["EU","UK",i,s,t],0) JuMP.fix(s_spot["EU","UK",i,s,t],0) end

However, when I run this with complementarity I get the error

"setvalue for fixed variables is no longer supported. Use JuMP.fix instead.".

setvalue(mcp_data[i].var, z[mcp_data[i].lin_idx])

So setvalue here needs to be changed to JuMP.fix to reflect the updated jump build I think.

Having trouble to solve same problem twice or more

Hello,

I'm having some trouble solve the same problem twice without rewriting the entire model

Here an example:


using Complementarity
using JuMP

m = MCPModel()

@variable(m, x>=0)
@mapping(m, F1, 2-x)
@complementarity(m, F1, x)

solveLCP(m)
solveLCP(m)


In the second solve attempt, it returns the following error message. It happens independently if I'm trying to solve each attempt with path or nlsolve.


BoundsError: attempt to access 1-element Array{Float64,1} at index [2]
eval_g(::JuMP.NLPEvaluator, ::Array{Float64,1}, ::Array{Float64,1}) at nlp.jl:557
myfunc at mcp.jl:95 [inlined]
(::FunctionWrappers.CallWrapper{Array{Float64,1}})(::Complementarity.#myfunc#4{JuMP.Model}, ::Array{Float64,1}) at FunctionWrappers.jl:49
macro expansion at FunctionWrappers.jl:100 [inlined]
do_ccall at FunctionWrappers.jl:91 [inlined]
FunctionWrapper at FunctionWrappers.jl:106 [inlined]
f_user_wrap(::Int32, ::Ptr{Float64}, ::Ptr{Float64}) at PATHSolver.jl:170
#solveLCP#8(::Bool, ::Function, ::Function, ::SparseMatrixCSC{Float64,Int64}, ::Array{Float64,1}, ::Array{Float64,1}, ::Array{String,1}, ::Array{String,1}, ::Array{Float64,1}) at PATHSolver.jl:134
#_solve_path#3(::Bool, ::Function, ::JuMP.Model) at mcp.jl:151
(::Complementarity.#kw##_solve_path)(::Array{Any,1}, ::Complementarity.#_solve_path, ::JuMP.Model) at :0
#solveMCP#1(::Symbol, ::Symbol, ::Bool, ::Function, ::JuMP.Model) at mcp.jl:66
(::Complementarity.#kw##solveMCP)(::Array{Any,1}, ::Complementarity.#solveMCP, ::JuMP.Model) at :0
solveLCP(::JuMP.Model) at mcp.jl:73
include_string(::String, ::String) at loading.jl:522
include_string(::String, ::String, ::Int64) at eval.jl:30
include_string(::Module, ::String, ::String, ::Int64, ::Vararg{Int64,N} where N) at eval.jl:34
(::Atom.##100#105{String,Int64,String})() at eval.jl:75
withpath(::Atom.##100#105{String,Int64,String}, ::Void) at utils.jl:30
withpath(::Function, ::String) at eval.jl:38
hideprompt(::Atom.##99#104{String,Int64,String}) at repl.jl:65
macro expansion at eval.jl:73 [inlined]
(::Atom.##98#103{Dict{String,Any}})() at task.jl:80


TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

Determining multiple indexes of mapping equation that are conditional on a variable having a non-zero value

Here I face a problem which seems as below, and I am curious about how to solve the problem.

When there are multiple indexes for mapping equations, we have use the code below to model them, for example,

@mapping(m, eq_var[i in Index1, j in Index2], var[i, j] - var_exg[i, j] ^ 2)
@complementarity(m, eq_var, var)

In some indexes, var_exg[i, j] = 0, which may cause many problems when the mapping equations are nonlinear, therefore, I want to treat the problem similar to Pyomo or GAMS, as the logic of below

for i in Index1, j in Index2
    if var_exg[i, j] == 0
        eq_var[i, j] = var[i, j]
    else
        eq_var[i, j] = var[i, j] - var_exg[i, j] ^ 2
    end
end

I have tried many methods, for example, I firstly found all indexes of non-zero value by using findall(x -> x !=0, var_exg), and used the indexes of non-zero value to map the equations, and for the indexes of zero value, the variables are kept to zero.

idx_non_zero = findall(x ->  x !=0, var_exg) # which defined a CartesianIndex
idx_non_zero_2 = [(k[1], k[2]) for k in idx_non_zero]

idx_zero = findall(x ->  x ==0, var_exg)
idx_zero_2 = [(k[1], k[2]) for k in idx_zero]

@mapping(m, eq_var_non_zero[(i, j) in idx_non_zero_2], var[i, j] - var_exg[i, j] ^ 2)
@complementarity(m, eq_var_non_zero, var[idx_non_zero])

@mapping(m, eq_var_zero[(i, j) in idx_zero_2 ], var[i, j] - 0)
@complementarity(m, eq_var_zero, var[idx_zero])

However, it failed and the possible reason is that mapping cannot recognize the multi-index [(i, j) in idx_non_zero_2], but only [i in Index1, j in Index2]. Is there any other possible solutions for this problem.

Thank you all!

The complementarity macro (@complementarity) does not include JuMP variables of SparseAxisArray type

I am using Julia 1.03, IJulia 1.17.0, JuMP 0.19.0. The problem is that the type SparseAxisArray has no field axes.

An example demonstrating the problem is as follow.

using Complementarity, JuMP

m = MCPModel()
@variable(m, x[i=1:4; i%2==0] >= 0)
@mapping(m, F[i=1:4; i%2==0], x[i]+2)
@complementarity(m, F, x)

Error message:

type SparseAxisArray has no field axes

Stacktrace:
[1] getproperty(::Any, ::Symbol) at ./sysimg.jl:18
[2] top-level scope at /Users/XXX/.julia/packages/Complementarity/Gag1Y/src/mcp.jl:371
[3] top-level scope at In[1]:6

Using warm start feature of PATHSolver

@AndradeTiago has developed the possibility of using a warm start for the PATHSolver and provided the code in a pull request: chkwon/PATHSolver.jl#25

Using the feature requires some changes to the Complementarity Package. I have setup a test and will put the changes here:

  • adding the start value to the type:
type ComplementarityType
    lb::Float64
    var::JuMP.Variable
    ub::Float64
    start::Float64
    F::JuMP.NonlinearExpression
    lin_idx::Int
    var_name::String
    F_name::String
end
  • initialize starting value
function add_complementarity(m::JuMP.Model, var::JuMP.Variable, F::JuMP.NonlinearExpression, F_name::String)
  lb = getlowerbound(var)
  ub = getupperbound(var)
  var_name = getname(var)
  if !isnan(getvalue(var))
      start = getvalue(var)
  else
      start = lb
  end
  new_dimension = ComplementarityType(lb, var, ub, start, F, linearindex(var), var_name, F_name)
  mcp_data = getMCPData(m)
  push!(mcp_data, new_dimension)
end
  • initialize the starting value in linear index (for now i have put in the function getBoundsLinearIndex)
function getBoundsLinearIndex(mcp_data)
    n = length(mcp_data)
    lb = zeros(n)
    ub = ones(n)
    start = zeros(n)
    for i in 1:n
        @show mcp_data[i]
        lb[linearindex(mcp_data[i].var)] = mcp_data[i].lb
        ub[linearindex(mcp_data[i].var)] = mcp_data[i].ub
        start[linearindex(mcp_data[i].var)] = mcp_data[i].start
    end
    return lb, ub, start
end
  • retrieve the value in _solve_path(m::Model; linear=false)
lb, ub, start = getBoundsLinearIndex(mcp_data)
  • include the start value when calling the PATHSolver.solveMCP/LCP
if linear==true
        J0 = myjac(zeros(size(lb)))
        Jr = myjac(100*rand(size(ub)))

        if norm(J0-Jr, 1) > 10e-8
            error("The mappings do not seem linear. Rerun 'solveMCP()' after removing 'linear=true'.")
        end

        status, z, f = PATHSolver.solveLCP(myfunc, J0, lb, ub, var_name, F_name, start)

    else
        status, z, f = PATHSolver.solveMCP(myfunc, myjac, lb, ub, var_name, F_name, start)
    end

The result of transmcp.jl seems wrong.

The model creation seems have bugs and errors.

The solution to transmcp.gms

---- VAR w  shadow price at supply node i

            LOWER     LEVEL     UPPER    MARGINAL

seattle        .         .        +INF  4.5931E-6      
san-diego      .         .        +INF     50.000      

---- VAR p  shadow price at demand node j

           LOWER     LEVEL     UPPER    MARGINAL

new-york      .        0.225     +INF  2.1987E-8      
chicago       .        0.153     +INF  6.5960E-8      
topeka        .        0.126     +INF       .         

---- VAR x  shipment quantities in cases

                     LOWER     LEVEL     UPPER    MARGINAL

seattle  .new-york      .       50.000     +INF       .         
seattle  .chicago       .      300.000     +INF       .         
seattle  .topeka        .         .        +INF      0.036      
san-diego.new-york      .      275.000     +INF       .         
san-diego.chicago       .         .        +INF      0.009      
san-diego.topeka        .      275.000     +INF       .       

The entire report:

Executed on neos-4.neos-server.org
GAMS 24.5.6  r55090 Released Nov 27, 2015 LEX-LEG x86 64bit/Linux 04/29/16 02:42:37 Page 1
Transportation model as equilibrium problem (TRANSMCP,SEQ=126)
C o m p i l a t i o n




COMPILATION TIME     =        0.000 SECONDS      3 MB  24.5.6 r55090 LEX-LEG
GAMS 24.5.6  r55090 Released Nov 27, 2015 LEX-LEG x86 64bit/Linux 04/29/16 02:42:37 Page 2
Transportation model as equilibrium problem (TRANSMCP,SEQ=126)
Model Statistics    SOLVE fixedqty Using MCP From line 84


MODEL STATISTICS

BLOCKS OF EQUATIONS           3     SINGLE EQUATIONS           11
BLOCKS OF VARIABLES           3     SINGLE VARIABLES           11
NON ZERO ELEMENTS            24     NON LINEAR N-Z              0
DERIVATIVE POOL              20     CONSTANT POOL              16
CODE LENGTH                   0


GENERATION TIME      =        0.001 SECONDS      4 MB  24.5.6 r55090 LEX-LEG


EXECUTION TIME       =        0.002 SECONDS      4 MB  24.5.6 r55090 LEX-LEG
GAMS 24.5.6  r55090 Released Nov 27, 2015 LEX-LEG x86 64bit/Linux 04/29/16 02:42:37 Page 3
Transportation model as equilibrium problem (TRANSMCP,SEQ=126)
Solution Report     SOLVE fixedqty Using MCP From line 84


              S O L V E      S U M M A R Y

    MODEL   fixedqty            
    TYPE    MCP                 
    SOLVER  PATH                FROM LINE  84

**** SOLVER STATUS     1 Normal Completion         
**** MODEL STATUS      1 Optimal                   

RESOURCE USAGE, LIMIT          0.008      1000.000
ITERATION COUNT, LIMIT        30    2000000000
EVALUATION ERRORS              0             0
11 row/cols, 24 non-zeros, 19.83% dense.

Path 4.7.03 (Fri Nov 27 05:18:03 2015)
Written by Todd Munson, Steven Dirkse, and Michael Ferris

INITIAL POINT STATISTICS
Maximum of X. . . . . . . . . .  1.0000e+00 var: (w(seattle))
Maximum of F. . . . . . . . . .  6.0000e+02 eqn: (supply(san-diego))
Maximum of Grad F . . . . . . .  1.0000e+00 eqn: (supply(seattle))
                                           var: (x(seattle,new-york))

INITIAL JACOBIAN NORM STATISTICS
Maximum Row Norm. . . . . . . .  3.0000e+00 eqn: (supply(seattle))
Minimum Row Norm. . . . . . . .  2.0000e+00 eqn: (profit(seattle,new-york))
Maximum Column Norm . . . . . .  3.0000e+00 var: (w(seattle))
Minimum Column Norm . . . . . .  2.0000e+00 var: (x(seattle,new-york))

FINAL STATISTICS
Inf-Norm of Complementarity . .  1.5198e-08 eqn: (profit(seattle,chicago))
Inf-Norm of Normal Map. . . . .  6.5960e-08 eqn: (fxdemand(chicago))
Inf-Norm of Minimum Map . . . .  6.5960e-08 eqn: (fxdemand(chicago))
Inf-Norm of Fischer Function. .  6.5960e-08 eqn: (fxdemand(chicago))
Inf-Norm of Grad Fischer Fcn. .  6.5960e-08 eqn: (profit(seattle,chicago))
Two-Norm of Grad Fischer Fcn. .  9.8327e-08

FINAL POINT STATISTICS
Maximum of X. . . . . . . . . .  3.0000e+02 var: (x(seattle,chicago))
Maximum of F. . . . . . . . . .  5.0000e+01 eqn: (supply(san-diego))
Maximum of Grad F . . . . . . .  1.0000e+00 eqn: (supply(seattle))
                                           var: (x(seattle,new-york))


---- EQU profit  zero profit conditions

                     LOWER     LEVEL     UPPER    MARGINAL

seattle  .new-york    -0.225    -0.225     +INF     50.000      
seattle  .chicago     -0.153    -0.153     +INF    300.000      
seattle  .topeka      -0.162    -0.126     +INF       .         
san-diego.new-york    -0.225    -0.225     +INF    275.000      
san-diego.chicago     -0.162    -0.153     +INF       .         
san-diego.topeka      -0.126    -0.126     +INF    275.000      

---- EQU supply  supply limit at plant i

            LOWER     LEVEL     UPPER    MARGINAL

seattle    -350.000  -350.000     +INF       .         
san-diego  -600.000  -550.000     +INF       .         

---- EQU fxdemand  fixed demand at market j

           LOWER     LEVEL     UPPER    MARGINAL

new-york   325.000   325.000     +INF      0.225      
chicago    300.000   300.000     +INF      0.153      
topeka     275.000   275.000     +INF      0.126      

---- VAR w  shadow price at supply node i

            LOWER     LEVEL     UPPER    MARGINAL

seattle        .         .        +INF  4.5931E-6      
san-diego      .         .        +INF     50.000      

---- VAR p  shadow price at demand node j

           LOWER     LEVEL     UPPER    MARGINAL

new-york      .        0.225     +INF  2.1987E-8      
chicago       .        0.153     +INF  6.5960E-8      
topeka        .        0.126     +INF       .         

---- VAR x  shipment quantities in cases

                     LOWER     LEVEL     UPPER    MARGINAL

seattle  .new-york      .       50.000     +INF       .         
seattle  .chicago       .      300.000     +INF       .         
seattle  .topeka        .         .        +INF      0.036      
san-diego.new-york      .      275.000     +INF       .         
san-diego.chicago       .         .        +INF      0.009      
san-diego.topeka        .      275.000     +INF       .         


**** REPORT SUMMARY :        0     NONOPT
                            0 INFEASIBLE
                            0  UNBOUNDED
                            0  REDEFINED
                            0     ERRORS
GAMS 24.5.6  r55090 Released Nov 27, 2015 LEX-LEG x86 64bit/Linux 04/29/16 02:42:37 Page 4
Transportation model as equilibrium problem (TRANSMCP,SEQ=126)
Model Statistics    SOLVE equilqty Using MCP From line 93


MODEL STATISTICS

BLOCKS OF EQUATIONS           3     SINGLE EQUATIONS           11
BLOCKS OF VARIABLES           3     SINGLE VARIABLES           11
NON ZERO ELEMENTS            27     NON LINEAR N-Z              3
DERIVATIVE POOL              20     CONSTANT POOL              24
CODE LENGTH                  28


GENERATION TIME      =        0.002 SECONDS      3 MB  24.5.6 r55090 LEX-LEG


EXECUTION TIME       =        0.003 SECONDS      3 MB  24.5.6 r55090 LEX-LEG
GAMS 24.5.6  r55090 Released Nov 27, 2015 LEX-LEG x86 64bit/Linux 04/29/16 02:42:37 Page 5
Transportation model as equilibrium problem (TRANSMCP,SEQ=126)
Solution Report     SOLVE equilqty Using MCP From line 93


              S O L V E      S U M M A R Y

    MODEL   equilqty            
    TYPE    MCP                 
    SOLVER  PATH                FROM LINE  93

**** SOLVER STATUS     1 Normal Completion         
**** MODEL STATUS      1 Optimal                   

RESOURCE USAGE, LIMIT          0.003      1000.000
ITERATION COUNT, LIMIT         0    2000000000
EVALUATION ERRORS              0             0
11 row/cols, 27 non-zeros, 22.31% dense.

Path 4.7.03 (Fri Nov 27 05:18:03 2015)
Written by Todd Munson, Steven Dirkse, and Michael Ferris

INITIAL POINT STATISTICS
Maximum of X. . . . . . . . . .  3.0000e+02 var: (x(seattle,chicago))
Maximum of F. . . . . . . . . .  5.0000e+01 eqn: (supply(san-diego))
Maximum of Grad F . . . . . . .  4.3651e+03 eqn: (prdemand(topeka))
                                           var: (p(topeka))

INITIAL JACOBIAN NORM STATISTICS
Maximum Row Norm. . . . . . . .  4.3671e+03 eqn: (prdemand(topeka))
Minimum Row Norm. . . . . . . .  2.0000e+00 eqn: (profit(seattle,new-york))
Maximum Column Norm . . . . . .  4.3671e+03 var: (p(topeka))
Minimum Column Norm . . . . . .  2.0000e+00 var: (x(seattle,new-york))

FINAL STATISTICS
Inf-Norm of Complementarity . .  1.5198e-08 eqn: (profit(seattle,chicago))
Inf-Norm of Normal Map. . . . .  6.5960e-08 eqn: (prdemand(chicago))
Inf-Norm of Minimum Map . . . .  6.5960e-08 eqn: (prdemand(chicago))
Inf-Norm of Fischer Function. .  6.5960e-08 eqn: (prdemand(chicago))
Inf-Norm of Grad Fischer Fcn. .  1.5520e-04 eqn: (prdemand(chicago))
Two-Norm of Grad Fischer Fcn. .  1.6235e-04

FINAL POINT STATISTICS
Maximum of X. . . . . . . . . .  3.0000e+02 var: (x(seattle,chicago))
Maximum of F. . . . . . . . . .  5.0000e+01 eqn: (supply(san-diego))
Maximum of Grad F . . . . . . .  4.3651e+03 eqn: (prdemand(topeka))
                                           var: (p(topeka))


---- EQU profit  zero profit conditions

                     LOWER     LEVEL     UPPER    MARGINAL

seattle  .new-york    -0.225    -0.225     +INF     50.000      
seattle  .chicago     -0.153    -0.153     +INF    300.000      
seattle  .topeka      -0.162    -0.126     +INF       .         
san-diego.new-york    -0.225    -0.225     +INF    275.000      
san-diego.chicago     -0.162    -0.153     +INF       .         
san-diego.topeka      -0.126    -0.126     +INF    275.000      

---- EQU supply  supply limit at plant i

            LOWER     LEVEL     UPPER    MARGINAL

seattle    -350.000  -350.000     +INF       .         
san-diego  -600.000  -550.000     +INF       .         

---- EQU prdemand  price-responsive demand at market j

           LOWER     LEVEL     UPPER    MARGINAL

new-york      .    2.1987E-8     +INF      0.225      
chicago       .    6.5960E-8     +INF      0.153      
topeka        .         .        +INF      0.126      

---- VAR w  shadow price at supply node i

            LOWER     LEVEL     UPPER    MARGINAL

seattle        .         .        +INF  4.5931E-6      
san-diego      .         .        +INF     50.000      

---- VAR p  shadow price at demand node j

           LOWER     LEVEL     UPPER    MARGINAL

new-york      .        0.225     +INF  2.1987E-8      
chicago       .        0.153     +INF  6.5960E-8      
topeka        .        0.126     +INF       .         

---- VAR x  shipment quantities in cases

                     LOWER     LEVEL     UPPER    MARGINAL

seattle  .new-york      .       50.000     +INF       .         
seattle  .chicago       .      300.000     +INF       .         
seattle  .topeka        .         .        +INF      0.036      
san-diego.new-york      .      275.000     +INF       .         
san-diego.chicago       .         .        +INF      0.009      
san-diego.topeka        .      275.000     +INF       .         


**** REPORT SUMMARY :        0     NONOPT
                            0 INFEASIBLE
                            0  UNBOUNDED
                            0  REDEFINED
                            0     ERRORS
GAMS 24.5.6  r55090 Released Nov 27, 2015 LEX-LEG x86 64bit/Linux 04/29/16 02:42:37 Page 6
Transportation model as equilibrium problem (TRANSMCP,SEQ=126)
Model Statistics    SOLVE fixedqty Using MCP From line 100


MODEL STATISTICS

BLOCKS OF EQUATIONS           3     SINGLE EQUATIONS           11
BLOCKS OF VARIABLES           3     SINGLE VARIABLES           11
NON ZERO ELEMENTS            24     NON LINEAR N-Z              0
DERIVATIVE POOL              20     CONSTANT POOL              16
CODE LENGTH                   0


GENERATION TIME      =        0.002 SECONDS      3 MB  24.5.6 r55090 LEX-LEG


EXECUTION TIME       =        0.003 SECONDS      3 MB  24.5.6 r55090 LEX-LEG
GAMS 24.5.6  r55090 Released Nov 27, 2015 LEX-LEG x86 64bit/Linux 04/29/16 02:42:37 Page 7
Transportation model as equilibrium problem (TRANSMCP,SEQ=126)
Solution Report     SOLVE fixedqty Using MCP From line 100


              S O L V E      S U M M A R Y

    MODEL   fixedqty            
    TYPE    MCP                 
    SOLVER  PATH                FROM LINE  100

**** SOLVER STATUS     1 Normal Completion         
**** MODEL STATUS      1 Optimal                   

RESOURCE USAGE, LIMIT          0.003      1000.000
ITERATION COUNT, LIMIT         1    2000000000
EVALUATION ERRORS              0             0
11 row/cols, 24 non-zeros, 19.83% dense.

Path 4.7.03 (Fri Nov 27 05:18:03 2015)
Written by Todd Munson, Steven Dirkse, and Michael Ferris

INITIAL POINT STATISTICS
Maximum of X. . . . . . . . . .  3.0000e+02 var: (x(seattle,chicago))
Maximum of F. . . . . . . . . .  5.0000e+01 eqn: (supply(san-diego))
Maximum of Grad F . . . . . . .  1.0000e+00 eqn: (supply(seattle))
                                           var: (x(seattle,new-york))

INITIAL JACOBIAN NORM STATISTICS
Maximum Row Norm. . . . . . . .  3.0000e+00 eqn: (supply(seattle))
Minimum Row Norm. . . . . . . .  2.0000e+00 eqn: (profit(seattle,new-york))
Maximum Column Norm . . . . . .  3.0000e+00 var: (w(seattle))
Minimum Column Norm . . . . . .  2.0000e+00 var: (x(seattle,new-york))

FINAL STATISTICS
Inf-Norm of Complementarity . .  8.6098e-09 eqn: (profit(seattle,chicago))
Inf-Norm of Normal Map. . . . .  2.8699e-11 eqn: (profit(seattle,chicago))
Inf-Norm of Minimum Map . . . .  2.8706e-11 eqn: (profit(seattle,chicago))
Inf-Norm of Fischer Function. .  2.8699e-11 eqn: (profit(seattle,chicago))
Inf-Norm of Grad Fischer Fcn. .  2.8699e-11 eqn: (supply(seattle))
Two-Norm of Grad Fischer Fcn. .  4.0587e-11

FINAL POINT STATISTICS
Maximum of X. . . . . . . . . .  3.0000e+02 var: (x(seattle,chicago))
Maximum of F. . . . . . . . . .  5.0000e+01 eqn: (supply(san-diego))
Maximum of Grad F . . . . . . .  1.0000e+00 eqn: (supply(seattle))
                                           var: (x(seattle,new-york))


---- EQU profit  zero profit conditions

                     LOWER     LEVEL     UPPER    MARGINAL

seattle  .new-york    -0.225    -0.225     +INF     50.000      
seattle  .chicago     -0.077    -0.077     +INF    300.000      
seattle  .topeka      -0.162    -0.126     +INF       .         
san-diego.new-york    -0.225    -0.225     +INF    275.000      
san-diego.chicago     -0.162    -0.076     +INF       .         
san-diego.topeka      -0.126    -0.126     +INF    275.000      

---- EQU supply  supply limit at plant i

            LOWER     LEVEL     UPPER    MARGINAL

seattle    -350.000  -350.000     +INF       .         
san-diego  -600.000  -550.000     +INF       .         

---- EQU fxdemand  fixed demand at market j

           LOWER     LEVEL     UPPER    MARGINAL

new-york   325.000   325.000     +INF      0.225      
chicago    300.000   300.000     +INF      0.076      
topeka     275.000   275.000     +INF      0.126      

---- VAR w  shadow price at supply node i

            LOWER     LEVEL     UPPER    MARGINAL

seattle        .         .        +INF  4.6700E-6      
san-diego      .         .        +INF     50.000      

---- VAR p  shadow price at demand node j

           LOWER     LEVEL     UPPER    MARGINAL

new-york      .        0.225     +INF       .         
chicago       .        0.076     +INF       .         
topeka        .        0.126     +INF       .         

---- VAR x  shipment quantities in cases

                     LOWER     LEVEL     UPPER    MARGINAL

seattle  .new-york      .       50.000     +INF       .         
seattle  .chicago       .      300.000     +INF       .         
seattle  .topeka        .         .        +INF      0.036      
san-diego.new-york      .      275.000     +INF       .         
san-diego.chicago       .         .        +INF      0.086      
san-diego.topeka        .      275.000     +INF       .         


**** REPORT SUMMARY :        0     NONOPT
                            0 INFEASIBLE
                            0  UNBOUNDED
                            0  REDEFINED
                            0     ERRORS
GAMS 24.5.6  r55090 Released Nov 27, 2015 LEX-LEG x86 64bit/Linux 04/29/16 02:42:37 Page 8
Transportation model as equilibrium problem (TRANSMCP,SEQ=126)
Model Statistics    SOLVE equilqty Using MCP From line 106


MODEL STATISTICS

BLOCKS OF EQUATIONS           3     SINGLE EQUATIONS           11
BLOCKS OF VARIABLES           3     SINGLE VARIABLES           11
NON ZERO ELEMENTS            27     NON LINEAR N-Z              3
DERIVATIVE POOL              20     CONSTANT POOL              24
CODE LENGTH                  28


GENERATION TIME      =        0.002 SECONDS      3 MB  24.5.6 r55090 LEX-LEG


EXECUTION TIME       =        0.002 SECONDS      3 MB  24.5.6 r55090 LEX-LEG
GAMS 24.5.6  r55090 Released Nov 27, 2015 LEX-LEG x86 64bit/Linux 04/29/16 02:42:37 Page 9
Transportation model as equilibrium problem (TRANSMCP,SEQ=126)
Solution Report     SOLVE equilqty Using MCP From line 106


              S O L V E      S U M M A R Y

    MODEL   equilqty            
    TYPE    MCP                 
    SOLVER  PATH                FROM LINE  106

**** SOLVER STATUS     1 Normal Completion         
**** MODEL STATUS      1 Optimal                   

RESOURCE USAGE, LIMIT          0.006      1000.000
ITERATION COUNT, LIMIT        16    2000000000
EVALUATION ERRORS              0             0
11 row/cols, 27 non-zeros, 22.31% dense.

Path 4.7.03 (Fri Nov 27 05:18:03 2015)
Written by Todd Munson, Steven Dirkse, and Michael Ferris

INITIAL POINT STATISTICS
Maximum of X. . . . . . . . . .  3.0000e+02 var: (x(seattle,chicago))
Maximum of F. . . . . . . . . .  3.8922e+02 eqn: (prdemand(chicago))
Maximum of Grad F . . . . . . .  1.0811e+04 eqn: (prdemand(chicago))
                                           var: (p(chicago))

INITIAL JACOBIAN NORM STATISTICS
Maximum Row Norm. . . . . . . .  1.0813e+04 eqn: (prdemand(chicago))
Minimum Row Norm. . . . . . . .  2.0000e+00 eqn: (profit(seattle,new-york))
Maximum Column Norm . . . . . .  1.0813e+04 var: (p(chicago))
Minimum Column Norm . . . . . .  2.0000e+00 var: (x(seattle,new-york))

FINAL STATISTICS
Inf-Norm of Complementarity . .  1.0311e-11 eqn: (profit(san-diego,new-york))
Inf-Norm of Normal Map. . . . .  1.1369e-13 eqn: (prdemand(new-york))
Inf-Norm of Minimum Map . . . .  1.1369e-13 eqn: (prdemand(new-york))
Inf-Norm of Fischer Function. .  1.1369e-13 eqn: (prdemand(new-york))
Inf-Norm of Grad Fischer Fcn. .  2.4809e-10 eqn: (prdemand(topeka))
Two-Norm of Grad Fischer Fcn. .  3.4958e-10

FINAL POINT STATISTICS
Maximum of X. . . . . . . . . .  3.5000e+02 var: (x(seattle,chicago))
Maximum of F. . . . . . . . . .  9.4056e-02 eqn: (profit(seattle,topeka))
Maximum of Grad F . . . . . . .  4.3651e+03 eqn: (prdemand(topeka))
                                           var: (p(topeka))


---- EQU profit  zero profit conditions

                     LOWER     LEVEL     UPPER    MARGINAL

seattle  .new-york    -0.225    -0.167     +INF       .         
seattle  .chicago     -0.077    -0.077     +INF    350.000      
seattle  .topeka      -0.162    -0.068     +INF       .         
san-diego.new-york    -0.225    -0.225     +INF    325.000      
san-diego.chicago     -0.162    -0.135     +INF       .         
san-diego.topeka      -0.126    -0.126     +INF    275.000      

---- EQU supply  supply limit at plant i

            LOWER     LEVEL     UPPER    MARGINAL

seattle    -350.000  -350.000     +INF      0.058      
san-diego  -600.000  -600.000     +INF       .         

---- EQU prdemand  price-responsive demand at market j

           LOWER     LEVEL     UPPER    MARGINAL

new-york      .         .        +INF      0.225      
chicago       .         .        +INF      0.135      
topeka        .         .        +INF      0.126      

---- VAR w  shadow price at supply node i

            LOWER     LEVEL     UPPER    MARGINAL

seattle        .        0.058     +INF       .         
san-diego      .         .        +INF       .         

---- VAR p  shadow price at demand node j

           LOWER     LEVEL     UPPER    MARGINAL

new-york      .        0.225     +INF       .         
chicago       .        0.135     +INF       .         
topeka        .        0.126     +INF       .         

---- VAR x  shipment quantities in cases

                     LOWER     LEVEL     UPPER    MARGINAL

seattle  .new-york      .         .        +INF      0.058      
seattle  .chicago       .      350.000     +INF       .         
seattle  .topeka        .         .        +INF      0.094      
san-diego.new-york      .      325.000     +INF       .         
san-diego.chicago       .         .        +INF      0.027      
san-diego.topeka        .      275.000     +INF       .         


**** REPORT SUMMARY :        0     NONOPT
                            0 INFEASIBLE
                            0  UNBOUNDED
                            0  REDEFINED
                            0     ERRORS
GAMS 24.5.6  r55090 Released Nov 27, 2015 LEX-LEG x86 64bit/Linux 04/29/16 02:42:37 Page 10
Transportation model as equilibrium problem (TRANSMCP,SEQ=126)
E x e c u t i o n


----    112 PARAMETER report  summary report

                        fixed        flex    fixed CF     flex CF

seattle  .new-york      50.000      50.000      50.000
seattle  .chicago      300.000     300.000     300.000     350.000
seattle  .price                                              0.058
san-diego.new-york     275.000     275.000     275.000     325.000
san-diego.topeka       275.000     275.000     275.000     275.000
price    .new-york       0.225       0.225       0.225       0.225
price    .chicago        0.153       0.153       0.076       0.135
price    .topeka         0.126       0.126       0.126       0.126



EXECUTION TIME       =        0.002 SECONDS      3 MB  24.5.6 r55090 LEX-LEG


USER: Computer Sciences Dept.                        G151218:1517AO-LNX
     University of Wisconsin-Madison                            DC8499
     License for teaching and research at degree granting institutions


**** FILE SUMMARY

Input      /var/lib/condor/execute/dir_1900406/MODEL.gms
Output     /var/lib/condor/execute/dir_1900406/solve.out

Failure to Precompile PATHSolver

Building PATHSolver → C:\Users\KitchenComputer\.julia\packages\PATHSolver\lRj12\deps\build.log
┌ Error: Error building PATHSolver:
│ [ Info: Attempting to create directory C:\Users\KitchenComputer.julia\packages\PATHSolver\lRj12\deps\usr\lib
│ [ Info: Attempting to create directory C:\Users\KitchenComputer.julia\packages\PATHSolver\lRj12\deps\src
│ [ Info: Changing directory to C:\Users\KitchenComputer.julia\packages\PATHSolver\lRj12\deps\src
│ [ Info: Attempting to create directory C:\Users\KitchenComputer.julia\packages\PATHSolver\lRj12\deps\downloads
│ [ Info: Changing directory to C:\Users\KitchenComputer.julia\packages\PATHSolver\lRj12\deps\src
│ [ Info: Downloading file https://github.com/ampl/pathlib/archive/4.7.03.zip
│ [ Info: Changing directory to C:\Users\KitchenComputer.julia\packages\PATHSolver\lRj12\deps\src
│ [ Info: Changing directory to C:\Users\KitchenComputer.julia\packages\PATHSolver\lRj12\deps\src
│ [ Info: Done downloading file https://github.com/ampl/pathlib/archive/4.7.03.zip
│ [ Info: Changing directory to C:\Users\KitchenComputer.julia\packages\PATHSolver\lRj12\deps\src
│ [ Info: Attempting to create directory C:\Users\KitchenComputer.julia\packages\PATHSolver\lRj12\deps
│ [ Info: Directory C:\Users\KitchenComputer.julia\packages\PATHSolver\lRj12\deps already exists
│ [ Info: Changing directory to C:\Users\KitchenComputer.julia\packages\PATHSolver\lRj12\deps\src
│ ERROR: LoadError: IOError: could not spawn 'C:\Users\KitchenComputer\AppData\Local\Julia-1.3.1\bin\7z.exe' x 'C:\Users\KitchenComputer\.julia\packages\PATHSolver\lRj12\deps\downloads\pathlib.zip' -y '-oC:\Users\KitchenComputer\.julia\packages\PATHSolver\lRj12\deps\src': no such file or directory (ENOENT)
│ Stacktrace:
│ [1] _spawn_primitive(::String, ::Cmd, ::Array{Any,1}) at .\process.jl:99
│ [2] setup_stdios(::Base.var"#554#555"{Cmd}, ::Array{Any,1}) at .\process.jl:112
│ [3] _spawn at .\process.jl:111 [inlined]
│ [4] #run#565(::Bool, ::typeof(run), ::Cmd) at .\process.jl:439
│ [5] run(::Cmd) at .\process.jl:438
│ [6] run(::BinDeps.PathRule) at C:\Users\KitchenComputer.julia\packages\BinDeps\ZEval\src\BinDeps.jl:503
│ [7] run(::BinDeps.SynchronousStepCollection) at C:\Users\KitchenComputer.julia\packages\BinDeps\ZEval\src\BinDeps.jl:521 (repeats 2 times)
│ [8] satisfy!(::BinDeps.LibraryDependency, ::Array{DataType,1}) at C:\Users\KitchenComputer.julia\packages\BinDeps\ZEval\src\dependencies.jl:944
│ [9] satisfy!(::BinDeps.LibraryDependency) at C:\Users\KitchenComputer.julia\packages\BinDeps\ZEval\src\dependencies.jl:922
│ [10] top-level scope at C:\Users\KitchenComputer.julia\packages\BinDeps\ZEval\src\dependencies.jl:977
│ [11] include at .\boot.jl:328 [inlined]
│ [12] include_relative(::Module, ::String) at .\loading.jl:1105
│ [13] include(::Module, ::String) at .\Base.jl:31
│ [14] include(::String) at .\client.jl:424
│ [15] top-level scope at none:5
│ in expression starting at C:\Users\KitchenComputer.julia\packages\PATHSolver\lRj12\deps\build.jl:96
└ @ Pkg.Operations D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.3\Pkg\src\backwards_compatible_isolation.jl:649
Building CodecZlib ─→ C:\Users\KitchenComputer\.julia\packages\CodecZlib\5t9zO\deps\build.log
Building MbedTLS ───→ C:\Users\KitchenComputer\.julia\packages\MbedTLS\a1JFn\deps\build.log
Building CodecBzip2 → C:\Users\KitchenComputer\.julia\packages\CodecBzip2\T5yr7\deps\build.log
[ Info: Precompiling JuMP [4076af6c-e467-56ae-b986-b466b2749572]
[ Info: Precompiling Complementarity [a9b2a840-c9d5-5181-a245-8df664c2d6e7]
ERROR: LoadError: PATHSolver not properly installed. Please re-build PATHSolver.
Stacktrace:
[1] error(::String) at .\error.jl:33
[2] top-level scope at C:\Users\KitchenComputer.julia\packages\PATHSolver\lRj12\src\PATHSolver.jl:15
[3] include at .\boot.jl:328 [inlined]
[4] include_relative(::Module, ::String) at .\loading.jl:1105
[5] include(::Module, ::String) at .\Base.jl:31
[6] top-level scope at none:2
[7] eval at .\boot.jl:330 [inlined]
[8] eval(::Expr) at .\client.jl:425
[9] top-level scope at .\none:3
in expression starting at C:\Users\KitchenComputer.julia\packages\PATHSolver\lRj12\src\PATHSolver.jl:12
ERROR: LoadError: Failed to precompile PATHSolver [f5f7c340-0bb3-5c69-969a-41884d311d1b] to C:\Users\KitchenComputer.julia\compiled\v1.3\PATHSolver\xyGrF_jwUCN.ji.
Stacktrace:
[1] error(::String) at .\error.jl:33
[2] compilecache(::Base.PkgId, ::String) at .\loading.jl:1283
[3] _require(::Base.PkgId) at .\loading.jl:1024
[4] require(::Base.PkgId) at .\loading.jl:922
[5] require(::Module, ::Symbol) at .\loading.jl:917
[6] include at .\boot.jl:328 [inlined]
[7] include_relative(::Module, ::String) at .\loading.jl:1105
[8] include(::Module, ::String) at .\Base.jl:31
[9] top-level scope at none:2
[10] eval at .\boot.jl:330 [inlined]
[11] eval(::Expr) at .\client.jl:425
[12] top-level scope at .\none:3
in expression starting at C:\Users\KitchenComputer.julia\packages\Complementarity\Gag1Y\src\Complementarity.jl:18
julia>

Fixed variable isn't fixed

I am trying to fix a model variable to run a base case scenario, but the value still varies. The variable I am fixing is M at parameter m0. Is there a different way I should be fixing the variable? Thank you.

The following gives:

julia> m0
Dict{String,Float64} with 2 entries:
"ercot" => 0.4
"ferc" => 0.8

julia> is_fixed.(M["ercot"])
true

julia> is_fixed.(M["ferc"])
true

I use the following code to fix:

for r in regions
fix(M[r], m0[r]; force = true)
end

After running I get:

julia> @show result_value.(M)
result_value.(M) = 1-dimensional DenseAxisArray{Float64,1,...} with index sets:
Dimension 1, ["ercot", "ferc"]
And data, a 2-element Array{Float64,1}:
133.48558627710796
76.66676884788406
1-dimensional DenseAxisArray{Float64,1,...} with index sets:
Dimension 1, ["ercot", "ferc"]
And data, a 2-element Array{Float64,1}:
133.48558627710796
76.66676884788406

julia> @show status
status = :StationaryPointFound
:StationaryPointFound

Here is the full code:

using Complementarity, JuMP

############# Parameters ####################
regions = ["ercot", "ferc"]
states = ["summer", "winter", "vortex"] # states of nature

σ = 0.25 # degree of relative risk aversion
esub = 0.25 # elasticity of subsitution between electricity and other goods
c0 = 31 # reference aggregate expenditures - electricity plus other goods

days = [300, 64, 1] # state occurance - days per year
πs = Dict(zip(states, days./365)) # state probabilities

maint = [0.4 0.8] # benchmark maintenance level
m0 = Dict(zip(regions, maint))

θ = 1/c0 # energy value share

scale_factor = [0 0] # maintenance cost scale factor
α = Dict(zip(regions, scale_factor))
γ = 0

###################### Shock Parameters ######################
d_shock = [ 1.0 1.2 1.2 ; # electricity demand shocks
1.0 1.0 1.5 ]

λ = Dict()
for i in 1:length(regions), j in 1:length(states) # demand shock table
λ[regions[i], states[j]] = d_shock[i,j]
end

w_shock = [ 0.0 0.2 0.25 ; # weather shocks
0.0 0.0 0.25 ]

w = Dict()
for i in 1:length(regions), j in 1:length(states) # weather shock table
w[regions[i], states[j]] = w_shock[i,j]
end
################### The Model ##########################

network = MCPModel() # declare model

################# Variables #################
@variable(network, K[r in regions] >= 0) # capacity
@variable(network, M[r in regions] >= 0) # maintenance

@variable(network, PE[r in regions, s in states] >= 0) # wholesale price
@variable(network, PR[r in regions] >= 0) # electricity generation resource

@variable(network, X[r in regions, s in states] >= 0) # sales to other regions
@variable(network, PX[s in states]) # traded electricity price

#################### Expressions #############################
@NLexpression(network, PC[r in regions, s in states], # state-contingent price
(θ * (PE[r,s] * λ[r,s])^(1-esub) + 1-θ)^(1/(1-esub)))
@NLexpression(network, PEU[r in regions], #
sum(πs[s] * PC[r,s]^(1-σ) for s in states)^(1/(1-σ)))
@NLexpression(network, EU[r in regions],
1/PEU[r])
@NLexpression(network, C[r in regions, s in states],
EU[r] * (PEU[r]/PC[r,s])^σ)
@NLexpression(network, CM[r in regions],
K[r] * α[r]/(1-γ) * (1-(1-M[r])^(1-γ)))

#################### Equations #############################
@mapping(network, profit_K[r in regions],
sqrt(PR[r]) - sum(πs[s] * PE[r,s] * (1-w[r,s](1-M[r])) for s in states))
@mapping(network, profit_M[r in regions],
α[r]/(1-M[r])^γ - sum(πs[s] * PE[r,s] * w[r,s] for s in states))
@mapping(network, profit_X[r in regions, s in states],
PE[r,s] - PX[s])
@mapping(network, market_PE[r in regions, s in states],
K[r] * (1-w[r,s]
(1-M[r])) -
C[r,s] * λ[r,s] * (PC[r,s]/(PE[r,s]*λ[r,s]))^esub + X[r,s])
@mapping(network, market_PR[r in regions],
0.5 * (1 - K[r]/sqrt(PR[r])))
@mapping(network, market_PX[s in states],
sum(X[r,s] for r in regions))

############## Assign Complementarity #################
@complementarity(network, profit_K, K)
@complementarity(network, profit_M, M)
@complementarity(network, profit_X, X)
@complementarity(network, market_PE, PE)
@complementarity(network, market_PR, PR)
@complementarity(network, market_PX, PX)

############## Starting Variable Values######################
for r in regions
set_start_value(K[r], 1.0)
set_start_value(PR[r], 1.0)
fix(M[r], m0[r]; force = true)
for s in states
set_start_value(PE[r,s], 1.0)
end
end

status = solveMCP(network; convergence_tolerance=1e-8, output="yes", time_limit=3600)

Equality constraints

Hallo,

I wonder if there is a default way to implement equality constraints.
F(x) = 0 , x \in \mathbb{R}

At the moment, I create two positive variables and a nonlinear expression to design a free variable in combination with an equality constraint:

@variable(model, lambda1 >= 0)
@variable(model, lambda2 >= 0)
@NLexpression(model, lambda,
    lambda1 - lambda2)

@mapping(model, market_lambda1,
    + sum(xname[s] for s in scenarios)
    + sum(ynoname[s] for s in scenarios if INDEX[s] > 0)
    - 10)
@complementarity(model, market_lambda1, lambda1)
                
@mapping(model, market_lambda2,
    - sum(xname[s] for s in scenarios)
    - sum(ynoname[s] for s in scenarios if INDEX[s] > 0)
    + 10)
@complementarity(model, market_lambda2, lambda2)

or is this simply the same as:

@variable(model, lambda)

@mapping(model, market_lambda,
    + sum(xname[s] for s in scenarios)
    + sum(ynoname[s] for s in scenarios if INDEX[s] > 0)
    - 10)
@complementarity(model, market_lambda, lambda)

maybe we could improve the documentation accordingly?

Regards, Hanspeter

Complementarity.jl in Julia 1.5.3

I am trying to run MCP in Julia. I started with example 1 in the documentation. I cannot get it running in Julia 1.5.3. I had to change a bit of syntax to run in 1.5.3. (No curly bracket syntax and needed result_value.(x)). Here's the code:

using Complementarity, JuMP

m = MCPModel()

M = [0  0 -1 -1 ;
     0  0  1 -2 ;
     1 -1  2 -2 ;
     1  2 -2  4 ]

q = [2; 2; -2; -6]

lb = zeros(4)
ub = Inf*ones(4)

items = 1:4

# @variable(m, lb[i] <= x[i in items] <= ub[i])
@variable(m, x[i in items] >= 0)
@mapping(m, F[i in items], sum(M[i,j]*x[j] for j in items) + q[i])
@complementarity(m, F, x)


status = solveMCP(m, solver=:PATHSolver; convergence_tolerance=1e-8,
    output="yes", time_limit=3600)

z = result_value.(x)

Here's the output:

Stacktrace:
 [1] top-level scope at /Users/G/Desktop/School/AAE706/Classwork/MCP_example.jl:25
 [2] include_string(::Function, ::Module, ::String, ::String) at ./loading.jl:1088
in expression starting at /Users/G/Desktop/School/AAE706/Classwork/MCP_example.jl:25
┌ Warning: Assignment to `#136#F_name` in soft scope is ambiguous because a global variable by the same name exists: `#136#F_name` will be treated as a new local. Disambiguate by using `local #136#F_name` to suppress this warning or `global #136#F_name` to assign to the existing global variable.
└ @ ~/.julia/packages/Complementarity/oQSd5/src/mcp.jl:411
┌ Warning: Assignment to `#136#F_name` in soft scope is ambiguous because a global variable by the same name exists: `#136#F_name` will be treated as a new local. Disambiguate by using `local #136#F_name` to suppress this warning or `global #136#F_name` to assign to the existing global variable.
└ @ ~/.julia/packages/Complementarity/oQSd5/src/mcp.jl:427
┌ Warning: Assignment to `#163#F_name` in soft scope is ambiguous because a global variable by the same name exists: `#163#F_name` will be treated as a new local. Disambiguate by using `local #163#F_name` to suppress this warning or `global #163#F_name` to assign to the existing global variable.
└ @ ~/.julia/packages/Complementarity/oQSd5/src/mcp.jl:411
┌ Warning: Assignment to `#163#F_name` in soft scope is ambiguous because a global variable by the same name exists: `#163#F_name` will be treated as a new local. Disambiguate by using `local #163#F_name` to suppress this warning or `global #163#F_name` to assign to the existing global variable.
└ @ ~/.julia/packages/Complementarity/oQSd5/src/mcp.jl:427
┌ Warning: Assignment to `#190#F_name` in soft scope is ambiguous because a global variable by the same name exists: `#190#F_name` will be treated as a new local. Disambiguate by using `local #190#F_name` to suppress this warning or `global #190#F_name` to assign to the existing global variable.
└ @ ~/.julia/packages/Complementarity/oQSd5/src/mcp.jl:411
┌ Warning: Assignment to `#190#F_name` in soft scope is ambiguous because a global variable by the same name exists: `#190#F_name` will be treated as a new local. Disambiguate by using `local #190#F_name` to suppress this warning or `global #190#F_name` to assign to the existing global variable.
└ @ ~/.julia/packages/Complementarity/oQSd5/src/mcp.jl:427

julia> z
1-dimensional DenseAxisArray{Float64,1,...} with index sets:
    Dimension 1, 1:4
And data, a 4-element Array{Float64,1}:
 NaN
 NaN
 NaN
 NaN

Printing of MCPModel

Hi all,

I discovered that the printing of a MCPModel did not provide the complementarity constraints. Here is a first test to fix that:

function printMCP(m)
    mcp_data  = Complementarity.get_MCP_data(m)
    res = "$(m)Complementarity constraints\n"

    # replace all subexpression
    dict_s = Dict{Int,String}(
        i => nl_expr_string(m, REPLMode , expr)
        for (i,expr) in enumerate(m.nlp_data.nlexpr)
    )

    sub_reg = r"subexpression\[(?<id>[0-9]+)\]"
    for (i,expr) in dict_s
        m = match(sub_reg, expr)
        try
            dict_s[i] = replace(expr, m.match => dict_s[parse(Int, m[:id])])
        catch
        end
    end
    for c in mcp_data
        expr_id = parse(Int,split("$(c.F)", "#")[end][1:end-1])
        res = res * " $(c.lb)$(c.var) \n$(dict_s[expr_id]) ≧ 0.0\n"
    end
    return res
end

For the example on the start page, this is the outcome of println(printMCP(m)):

Feasibility
Subject to
 x >= 0.0
Complementarity constraints
 0.0 ≦ x
   ⟂ x + 2.0 ≧ 0.0

Failure to precompile in Julia 1.5:

There is a load error that leads to a failure to precompile in Julia 1.5. See below, at "LoadError: could not load symbol "jl_function_ptr":"

┌ Info: Precompiling Complementarity [a9b2a840-c9d5-5181-a245-8df664c2d6e7]
└ @ Base loading.jl:1278
┌ Warning: Package Complementarity does not have LinearAlgebra in its dependencies:
│ - If you have Complementarity checked out for development and have
│   added LinearAlgebra as a dependency but haven't updated your primary
│   environment's manifest file, try `Pkg.resolve()`.
│ - Otherwise you may need to report an issue with Complementarity
└ Loading LinearAlgebra into Complementarity from project dependency, future warnings for Complementarity are suppressed.
ERROR: LoadError: LoadError: could not load symbol "jl_function_ptr":
The specified procedure could not be found. 
Stacktrace:
[1] PATHSolver.FunctionWrappersQuickFix.FunctionWrapper{Any,Tuple{Any}}(::typeof(identity)) at C:\Users\KitchenComputer\.julia\packages\PATHSolver\tJVDr\src\FunctionWrappersQuickFix.jl:89
[2] top-level scope at C:\Users\KitchenComputer\.julia\packages\PATHSolver\tJVDr\src\FunctionWrappersQuickFix.jl:132
[3] include(::Function, ::Module, ::String) at .\Base.jl:380
[4] include at .\Base.jl:368 [inlined]
[5] include(::String) at C:\Users\KitchenComputer\.julia\packages\PATHSolver\tJVDr\src\PATHSolver.jl:1
[6] top-level scope at C:\Users\KitchenComputer\.julia\packages\PATHSolver\tJVDr\src\PATHSolver.jl:3
[7] include(::Function, ::Module, ::String) at .\Base.jl:380
[8] include(::Module, ::String) at .\Base.jl:368
[9] top-level scope at none:2
[10] eval at .\boot.jl:331 [inlined]
[11] eval(::Expr) at .\client.jl:467
[12] top-level scope at .\none:3
in expression starting at C:\Users\KitchenComputer\.julia\packages\PATHSolver\tJVDr\src\FunctionWrappersQuickFix.jl:132
in expression starting at C:\Users\KitchenComputer\.julia\packages\PATHSolver\tJVDr\src\PATHSolver.jl:3
ERROR: LoadError: Failed to precompile PATHSolver [f5f7c340-0bb3-5c69-969a-41884d311d1b] to C:\Users\KitchenComputer\.julia\compiled\v1.5\PATHSolver\xyGrF_7TF5F.ji.
Stacktrace:
[1] error(::String) at .\error.jl:33
[2] compilecache(::Base.PkgId, ::String) at .\loading.jl:1290
[3] _require(::Base.PkgId) at .\loading.jl:1030
[4] require(::Base.PkgId) at .\loading.jl:928
[5] require(::Module, ::Symbol) at .\loading.jl:923
[6] include(::Function, ::Module, ::String) at .\Base.jl:380
[7] include(::Module, ::String) at .\Base.jl:368
[8] top-level scope at none:2
[9] eval at .\boot.jl:331 [inlined]
[10] eval(::Expr) at .\client.jl:467
[11] top-level scope at .\none:3
in expression starting at C:\Users\KitchenComputer\.julia\packages\Complementarity\jpfgn\src\Complementarity.jl:18
Failed to precompile Complementarity [a9b2a840-c9d5-5181-a245-8df664c2d6e7] to C:\Users\KitchenComputer\.julia\compiled\v1.5\Complementarity\ORstz_7TF5F.ji.

Stacktrace:
[1] error(::String) at .\error.jl:33
[2] compilecache(::Base.PkgId, ::String) at .\loading.jl:1290
[3] _require(::Base.PkgId) at .\loading.jl:1030
[4] require(::Base.PkgId) at .\loading.jl:928
[5] require(::Module, ::Symbol) at .\loading.jl:923
[6] include_string(::Function, ::Module, ::String, ::String) at .\loading.jl:1091

UndefRefError: access to undefined reference

Where may this error come from? I run the code to solve a MCP on M1 MacBook using rosetta. Could it be the reason?

UndefRefError: access to undefined reference

Stacktrace:
[1] getindex
@ ./array.jl:924 [inlined]
[2] getindex
@ ./abstractarray.jl:1244 [inlined]
[3] _c_constraint_name(id_ptr::Ptr{Nothing}, i::Int32, buf_ptr::Ptr{UInt8}, buf_size::Int32)
@ PATHSolver ~/.julia/packages/PATHSolver/SXBNU/src/C_API.jl:231
[4] c_api_Path_Solve
@ ~/.julia/packages/PATHSolver/SXBNU/src/C_API.jl:512 [inlined]
[5] solve_mcp(F::Complementarity.var"#function_callback#5"{NLPEvaluator}, J::Complementarity.var"#jacobian_callback#7"{Complementarity.var"#j_eval#6"{NLPEvaluator}}, lb::Vector{Float64}, ub::Vector{Float64}, z::Vector{Float64}; nnz::Int64, variable_names::Vector{String}, constraint_names::Vector{String}, silent::Bool, generate_output::Int64, use_start::Bool, use_basics::Bool, kwargs::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:convergence_tolerance, :output, :time_limit), Tuple{Float64, String, Int64}}})
@ PATHSolver ~/.julia/packages/PATHSolver/SXBNU/src/C_API.jl:626
[6] _solve_path!(m::Model; kwargs::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:convergence_tolerance, :output, :time_limit), Tuple{Float64, String, Int64}}})
@ Complementarity ~/.julia/packages/Complementarity/a6hjV/src/mcp.jl:217
[7] solveMCP(m::Model; solver::Symbol, method::Symbol, linear::Bool, kwargs::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:convergence_tolerance, :output, :time_limit), Tuple{Float64, String, Int64}}})
@ Complementarity ~/.julia/packages/Complementarity/a6hjV/src/mcp.jl:101
[8] top-level scope
@ ~/Mygithub/julia_helloworld/mcp.ipynb:68

Upcoming refactoring of JuMP's nonlinear API

The upcoming release of JuMP v1.2 will break Complementarity. Read more here: https://discourse.julialang.org/t/ann-upcoming-refactoring-of-jumps-nonlinear-api/83052

The breakage looks pretty minor, and is mostly hacks that were added to delete nonlinear constraints:

# Cleanup. Remove all dummy @NLconstraints added,
# so that the model can be re-used for multiple runs
m.nlp_data.nlconstr = []

x-ref: jump-dev/JuMP.jl#2955

Please ping me if you have questions.

Return value of JuMP.VariableRef

Hallo,

I would like to use the same script to evaluate my model results obtained by an MCP reformulation and a constraint optimization. Unfortunately, I would need to swap between JuMP.value and Complementarity.result_value.

I did the following to overcome this:

import JuMP
import Complementarity
value(x::JuMP.VariableRef) = haskey(owner_model(x).ext,:MCP) ? Complementarity.result_value(x) : JuMP.value(x)
value(x::Number) = x
value(x::JuMP.NonlinearExpression) = JuMP.value(x::JuMP.NonlinearExpression, value) # use function `value` to evaluate JuMP.VariableRef in expressions
value(x) = JuMP.value(x) # Fall back on default for rest

using JuMP

using Complementarity
m = MCPModel()
@variable(m, x >= 0)
a = @NLexpression(m, x+2)
@mapping(m, F, a)
@complementarity(m, F, x)
status = solveMCP(m)
@show value(a)
@show value(x)


using Clp

m2 = Model()
@variable(m2, y>=0)
b = @expression(m2, y+1)
@constraint(m2, b <= 2)
@objective(m2, Max, y)
optimize!(m2, with_optimizer(Clp.Optimizer))
@show value(y)
@show value(b)

Maybe it can be integrated somehow.

Greetings,
Hanspeter

Setting start values for Array Variables

I want to set starting values for Array variables. Can I do this in one line, or does it need to happen individually? Below is the code and the Error report. I noted where the first error is. If I should post this issue differently please let me know.

I am also wondering if I can set starting value for expressions. See lines 101-105.

############ The File #####################
using Complementarity, JuMP

############# Parameters ####################
regions = ["ercot", "ferc"]
states = ["summer", "winter", "vortex"]   # states of nature

σ = 0.25        # degree of relative risk aversion
esub = 0.25     # elasticity of subsitution between electricity and other goods
c0 = 31         # reference aggregate expenditures - electricity plus other goods

days = [300, 64, 1]               # state occurance - days per year
πs = Dict(zip(states, days./365))  # state probabilities

maint = [0.4 0.8]                 # benchmark maintenance level
m0 = Dict(zip(regions, maint))

θ = 1/c0                          # energy value share

scale_factor = [0 0]              # maintenance cost scale factor
α = Dict(zip(regions, scale_factor))
γ = 0

###################### Shock Parameters ######################
d_shock = [ 1.0 1.2 1.2 ;   # electricity demand shocks
            1.0 1.0 1.5 ]

d_shock1 = [ 1.0 1.0 1.0 ;   # no electricity demand shocks - base case
            1.0 1.0 1.0 ]

λ = Dict()
for i in 1:length(regions), j in 1:length(states) # demand shock table
    λ[regions[i], states[j]] = d_shock1[i,j]
end

w_shock = [ 0.0 0.2 0.25 ;   # weather shocks
            0.0 0.0 0.25 ]

w_shock0 = [ 0.0 0.0 0.0 ;   # no weather shocks - base case
            0.0 0.0 0.0 ]
w = Dict()
for i in 1:length(regions), j in 1:length(states) # weather shock table
    w[regions[i], states[j]] = w_shock0[i,j]
end
################### The Model ##########################

m = MCPModel()               # declare model

################# Variables #################
@variable(m, K[r in regions] >= 0)                # capacity
@variable(m, M[r in regions] >= 0)                # maintenance

@variable(m, PE[r in regions, s in states] >= 0)  # wholesale price
@variable(m, PR[r in regions] >= 0)               # electricity generation resource

@variable(m, X[r in regions, s in states] >= 0)   # sales to other regions
@variable(m, PX[s in states])                     # traded electricity price

#################### Equations #############################
@NLexpression(m, PC[r in regions, s in states],
            (θ * (PE[r,s] * λ[r,s])^(1-esub) + 1-θ)^(1/(1-esub)))
@NLexpression(m, PEU[r in regions],
            sum(πs[s] * PC[r,s]^(1-σ) for s in states)^(1/(1-σ)))
@NLexpression(m, EU[r in regions],
            1/PEU[r])
@NLexpression(m, C[r in regions, s in states],
            EU[r] * (PEU[r]/PC[r,s])^σ)
@NLexpression(m, CM[r in regions],
            K[r] * α[r]/(1-γ) * (1-(1-M[r])^(1-γ)))
#################################################
@mapping(m, profit_K[r in regions],
            sqrt(PR[r]) - sum(πs[s] * PE[r,s] * (1-w[r,s]*(1-M[r])) for s in states))
@mapping(m, profit_M[r in regions],
            α[r]/(1-M[r])^γ - sum(πs[s] * PE[r,s] * w[r,s] for s in states))
@mapping(m, profit_X[r in regions, s in states],
            PE[r,s] - PX[s])
@mapping(m, market_PE[r in regions, s in states],
            K[r] * (1-w[r,s]*(1-M[r])) -
            C[r,s] * λ[r,s] * (PC[r,s]/(PE[r,s]*λ[r,s]))^esub + X[r,s])
@mapping(m, market_PR[r in regions],
            0.5 * (1 - K[r]/sqrt(PR[r])))
@mapping(m, market_PX[s in states],
            sum(X[r,s] for r in regions))

############## Assign Complementarity #################
@complementarity(m, profit_K, K)
@complementarity(m, profit_M, M)
@complementarity(m, profit_X, X)
@complementarity(m, market_PE, PE)
@complementarity(m, market_PR, PR)
@complementarity(m, market_PX, PX)

############## Starting Variable Values ######################
set_start_value.(K, [1.0 1.0])                        #<============== THIS IS WHERE THE ERROR IS
set_start_value.(PE, [1.0 1.0 1.0; 1.0 1.0 1.0])
set_start_value.(PR, [1.0 1.0])
fix.(M, [0.0 0.0]; force = true)
fix.(X, [0.0 0.0 0.0; 0.0 0.0 0.0]; force = true)
fix.(PX, [1.0 1.0 1.0]; force = true)

############## Starting Expression Values ###################
set_start_value.(PEU, [1.0 1.0])                           #<============== CAN I DO THIS
set_start_value.(PC, [1.0 1.0 1.0; 1.0 1.0 1.0])
set_start_value.(EU, [1.0 1.0])
set_start_value.(C, [1.0 1.0 1.0; 1.0 1.0 1.0])
set_start_value.(CM, [1.0 1.0])


status = solveMCP(m; convergence_tolerance=1e-8, output="yes", time_limit=3600)

Here is the Error:

ERROR: LoadError: MethodError: no method matching UnitRange{Int64}(::Array{String,1})
Closest candidates are:
  UnitRange{Int64}(::Any, ::ArrayInterface.StaticInt) where T<:Real at /Users/G/.julia/packages/ArrayInterface/gMtB5/src/static.jl:139
  UnitRange{Int64}(::Any, ::Any) where T<:Real at range.jl:280
  UnitRange{Int64}(::UnitRange{T}) where T<:Real at range.jl:918

@constraints bug

Hi again. I posted this on the discourse JULIA forum and was told it could be a bug with this package.

I am trying to set some constraints on some of my variables and get an error message.

using Complementarity
nodes =             ["n1", "n2"]
m=MCPModel()
@variable(m, q_extract[n in nodes] >=0)
@variable(m, q_inject[n in nodes] >=0)

@mapping(m, KKT_q_extract[n in nodes],    q_inject[n])
@mapping(m, KKT_q_inject[n in nodes],     q_extract[n])

@complementarity(m, KKT_q_extract,                      q_extract)
@complementarity(m, KKT_q_inject,                       q_inject)

for n in nodes
    @constraints(m, begin
    q_extract[n] == 0
    q_inject[n] == 0
    end)
end

solveMCP(m))

This is a highly reduced version of the code to only one variable (doesnt make physical sense but gives same error message).

Without this constraints loop, the model solves.

Including the loop setting the constraints, causes this error message:
BoundsError: attempt to access 4-element Array{Float64,1} at index [5] in solveMCP at Complementarity\src\mcp.jl:52 in #solveMCP#1 at Complementarity\src\mcp.jl:53 in at base\<missing> in #_solve_path#3 at Complementarity\src\mcp.jl:138 in solveMCP at PATHSolver\src\PATHSolver.jl:56 in f_user_wrap at PATHSolver\src\PATHSolver.jl:124 in FunctionWrapper at FunctionWrappers\src\FunctionWrappers.jl:106 in do_ccall at FunctionWrappers\src\FunctionWrappers.jl:91 in macro expansion at FunctionWrappers\src\FunctionWrappers.jl:100 in at FunctionWrappers\src\FunctionWrappers.jl:49 in myfunc at Complementarity\src\mcp.jl:82 in eval_g at JuMP\src\nlp.jl:557

Here's the post I made on discourse: https://discourse.julialang.org/t/newbie-looking-for-help-with-constraints-in-jump/12200

Question on return type :StationaryPointFound

Hi,
I am getting back the :StationaryPointFound message every time I try to solve a particular MCP model with :PATH but I cannot make sense of what this exactly means, and why it is different than a :Solved status for example. Providing a MWE for this issue is going to be relatively complicated but I will try to provide some details.

The problem is an energy dispatch problem from firms to markets, with constraints on supply and market-clearing given a demand function and Cournot competition. A previous iteration of that model was solving when using a 1st-order Taylor approximation on a nonlinear part of the model. We are now trying to solve the model without relying on that approximation. At the stationary point, the residual is greater than the convergence tolerance although not large (~2.5-3.5), the FOCs of the problem are all relatively close to 0 (between ~1e-5 and 0.5) and the variables of interest are believable, but hard to say if optimal. When I try to use :NLsolve instead, I get back three errors:

  • ** On entry to DLASCLS parameter number 4 had an illegal value
  • LoadError: LinearAlgebra.LAPACKException(19)
  • caused by: LinearAlgebra.SingularException(1)

Again, looking for details on these messages was unfruitful.
I have tried to make firms price-taking, remove shipping costs, make all firms identical, use a larger tolerance, etc. but nothing gets me out of the :StationaryPointFound message.

Let me know if I can provide more details, or if you have an idea of what's going on here. Thanks!

norm(matrix) -> opnorm(matrix) in Julia 0.7

It looks like may be using norm(matrix). In Julia 0.7, this will compute the Frobenius norm (vecnorm in Julia 0.6), due to JuliaLang/julia#27401. If you want the induced/operator norm as in Julia 0.6, use opnorm(matrix) instead, or Compat.opnorm(matrix) to work in 0.6 and 0.7 (JuliaLang/Compat.jl#577).

Note that, for testing purposes, rather than @test norm(A - B) ≤ tol, it is usually preferred to do @test A ≈ B or @test A ≈ B rtol=... (which uses isapprox).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.