Skip to content

[WIP] Initial Function#2

Open
RogerioOMDS wants to merge 1 commit into
mainfrom
InitialFunction
Open

[WIP] Initial Function#2
RogerioOMDS wants to merge 1 commit into
mainfrom
InitialFunction

Conversation

@RogerioOMDS

Copy link
Copy Markdown
Collaborator

No description provided.

@abelsiqueira abelsiqueira left a comment

Copy link
Copy Markdown
Member

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.

Comment thread src/modelo.jl
@@ -0,0 +1,159 @@
using CSV: DataFrames

Copy link
Copy Markdown
Member

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.

Suggested change
using CSV: DataFrames

Comment thread src/modelo.jl
@@ -0,0 +1,159 @@
using CSV: DataFrames
using JuMP, CSV, DataFrames, Gurobi, LinearAlgebra, Random, XLSX, StatsBase

Copy link
Copy Markdown
Member

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.

Comment thread src/modelo.jl
using CSV: DataFrames
using JuMP, CSV, DataFrames, Gurobi, LinearAlgebra, Random, XLSX, StatsBase

StatsBase.rand

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
StatsBase.rand

Isso faz algo?

Comment thread src/modelo.jl
Comment on lines +8 to +12
lista_materias = DataFrame(XLSX.readtable("MateriasFinais.xlsx", "materiasFinais")...)

lista_professores = DataFrame(XLSX.readtable("preferenciasFinais.xlsx", "preferenciasFinais")...)

lista_restricoes = DataFrame(XLSX.readtable("RestricoesFinais.xlsx", "RestricoesFinais")...)

Copy link
Copy Markdown
Member

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.

Comment thread src/modelo.jl
Comment on lines +17 to +20
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],

Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Member

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

Comment thread src/modelo.jl
preferencias[sorteioProfePos[1],96] = 5
preferencias[sorteioProfePos[2],103] = 5
preferencias[sorteioProfePos[3],105] = 5

Copy link
Copy Markdown
Member

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.

Comment thread src/modelo.jl
@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)

Copy link
Copy Markdown
Member

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.

Comment thread src/modelo.jl
@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)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@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 '.

Comment thread src/modelo.jl

@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])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generalizar o conjunto

Comment thread src/modelo.jl
@objective(model, Max, sum(preferencias[p,t]*x[p,t] for p=1:P, t=1:M));

optimize!(model) #resolver

Copy link
Copy Markdown
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants