Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

[WIP] Initial Function #2

wants to merge 1 commit into from

Conversation

RogerioOMDS
Copy link
Collaborator

No description provided.

Copy link
Member

@abelsiqueira abelsiqueira left a 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
Copy link
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

@@ -0,0 +1,159 @@
using CSV: DataFrames
using JuMP, CSV, DataFrames, Gurobi, LinearAlgebra, Random, XLSX, StatsBase
Copy link
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.

using CSV: DataFrames
using JuMP, CSV, DataFrames, Gurobi, LinearAlgebra, Random, XLSX, StatsBase

StatsBase.rand
Copy link
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 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
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 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
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
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

preferencias[sorteioProfePos[1],96] = 5
preferencias[sorteioProfePos[2],103] = 5
preferencias[sorteioProfePos[3],105] = 5

Copy link
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.

@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
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.

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


@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
Member

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

Copy link
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