[WIP] Initial Function#2
Conversation
abelsiqueira
left a comment
There was a problem hiding this comment.
Obrigado pelo trabalho. Seguem alguns comentários, e outros no corpo do pull request.
Comentários gerais:
- Usar inglês em tudo
- Tudo que for fora da função deve ficar em algum arquivo para exemplo. Tipo
example/dmat.jl. - Seguir os seguintes padrões: (se não souber fazer fácil me avisa)
nome_de_variavel, e.g., (professor)FacultyAssign->faculty_assignment.
| @@ -0,0 +1,159 @@ | |||
| using CSV: DataFrames | |||
There was a problem hiding this comment.
Isso é algum bug do VSCode.
| using CSV: DataFrames |
| @@ -0,0 +1,159 @@ | |||
| using CSV: DataFrames | |||
| using JuMP, CSV, DataFrames, Gurobi, LinearAlgebra, Random, XLSX, StatsBase | |||
There was a problem hiding this comment.
Colocar os using todos no EncarDida.jl.
| using CSV: DataFrames | ||
| using JuMP, CSV, DataFrames, Gurobi, LinearAlgebra, Random, XLSX, StatsBase | ||
|
|
||
| StatsBase.rand |
There was a problem hiding this comment.
| StatsBase.rand |
Isso faz algo?
| lista_materias = DataFrame(XLSX.readtable("MateriasFinais.xlsx", "materiasFinais")...) | ||
|
|
||
| lista_professores = DataFrame(XLSX.readtable("preferenciasFinais.xlsx", "preferenciasFinais")...) | ||
|
|
||
| lista_restricoes = DataFrame(XLSX.readtable("RestricoesFinais.xlsx", "RestricoesFinais")...) |
There was a problem hiding this comment.
Se a gente puder colocar esse exemplo online, subir os xlsx também.
Preferencialmente mudar para .csv, pra que seja visível ao git.
| ListaProfesPos = [6, 49, 4, 0, 38, 22, 19, 44, 45, 40, 0, 27, 0], | ||
| ListaMateriasPos = 93:105, | ||
| ListaProfesComCargos = [52, 20, 30, 46], | ||
| ListaProfesSubs = [42, 53, 54], |
There was a problem hiding this comment.
Os default aqui devem ser Int[], isto é, vazio.
There was a problem hiding this comment.
Os valores específicos vão pra chamada no arquivo de exemplo
| preferencias[sorteioProfePos[1],96] = 5 | ||
| preferencias[sorteioProfePos[2],103] = 5 | ||
| preferencias[sorteioProfePos[3],105] = 5 | ||
|
|
There was a problem hiding this comment.
Tudo acima é específico do exemplo também.
| @constraint(model, [t=1:M], sum(x[p,t] for p=1:P) == 1) | ||
|
|
||
| # Professores "comuns" | ||
| @constraint(model, [p in setdiff(1:P, hcat(ListaProfesComCargos', ListaProfesSubs'))], sum(DU[d, h, t]*x[p,t] for t=1:M, d=1:D, h=1:H) ≥ CargaHorariaComumMin) |
There was a problem hiding this comment.
Definir o conjunto desse setdiff para que o modelo fique mais limpo.
| @constraint(model, [p in setdiff(1:P, hcat(ListaProfesComCargos', ListaProfesSubs'))], sum(DU[d, h, t]*x[p,t] for t=1:M, d=1:D, h=1:H) ≤ CargaHorariaComumMax) | ||
|
|
||
| # Professores com cargos | ||
| @constraint(model, [p in ListaProfesComCargos'], sum(DU[d, h, t]*x[p,t] for t=1:M, d=1:D, h=1:H) ≥ CargaHorariaCargoMin) |
There was a problem hiding this comment.
| @constraint(model, [p in ListaProfesComCargos'], sum(DU[d, h, t]*x[p,t] for t=1:M, d=1:D, h=1:H) ≥ CargaHorariaCargoMin) | |
| @constraint(model, [p in ListaProfesComCargos], sum(DU[d, h, t]*x[p,t] for t=1:M, d=1:D, h=1:H) ≥ CargaHorariaCargoMin) |
Não é pra ser necessário esse '.
|
|
||
| @constraint(model, [p=1:P, t=1:M], x[p,t] * sum(HT[d, h, t] * restricoes[d, h, p] for h=1:H, d=1:D) == 0) | ||
|
|
||
| for t=setdiff(1:M, [24,85,86]) |
| @objective(model, Max, sum(preferencias[p,t]*x[p,t] for p=1:P, t=1:M)); | ||
|
|
||
| optimize!(model) #resolver | ||
|
|
There was a problem hiding this comment.
Retonar aqui as coisas relevantes (só x?). O resto é específico pro exemplo, ou pra uma função nova de análise
No description provided.