-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Initial Function #2
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Os default aqui devem ser Int[]
, isto é, vazio.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generalizar o conjunto
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.