[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-glpk] subspace problem
From: |
Benson |
Subject: |
[Help-glpk] subspace problem |
Date: |
Sat, 9 Feb 2008 01:29:51 +0300 |
Hello,
I want to understand the use of "max" in MathProg and how to specify
"coordinates" in MathProg. I have written a small example to try this out.
# author: Benson I.P. Hoi
# date: Tuesday 05 Feb 2008
# motivations:
# 1. to test max works in MathProg and to check the syntax
# 2. to test whether the Pre-assignment set PRA works.
/* SETS */
set TUTORS; # a list of tutors
set TUTEES; # a list of tutees
set ROOMS; # a list of rooms
set PRA := {tutor in TUTORS, tutee in TUTEES, r in ROOMS}; # a list of
pre-assignments of (tutor, tutee, r), is this syntax correct?
### sample assignment
/* VARIABLES */
var x {tutor in TUTORS, tutee in TUTEES, r in ROOMS}, binary >= 0; # binary
variables, 1 if the combination is assigned, 0 otherwise
/* OBJECTIVE FUNCTION */
maximize z: sum{tutor in TUTORS, tutee in TUTEES, r in ROOMS} x[tutor,
tutee,r] ; # arbritary
/* CONSTRAINTS */
### all tutees have at most one tutor
s.t. uniqueTutor{tutee in TUTEES}: sum{tutor in TUTORS} (max{r in ROOMS}
x[tutor, tutee, r])<=1;
# what I want to say is to ignore whatever room has been assigned, subspace as
x[tutor, tutee] is what I want.. how I express that? Does "max" do the trick?
GLPK is complaining about syntax. Is there any other to express this?
### pre-assignments to be taken into account
s.t. preassignment{(tutor, tutee,r) in PRA} x[tutor, tutee, r] =1;
data;
set TUTORS := ar3 su2 mrc;
set TUTEES := iph04 sr104;
set ROOMS := ra rb rc;
set PRA := (ar3, iph04, ra) (su2, iph04, rb) (mrc, sr104, rc);
# GLPK is complaining that PRA does not need data,why?
# iph04 has 2 tutors, I want the MathProg to detect and report this.
end;
Hello,
I want to understand the use of "max" in MathProg and how to specify "coordinates" in MathProg. I have written a small example to try this out.
# author: Benson I.P. Hoi
# date: Tuesday 05 Feb 2008
# motivations:
# 1. to test max works in MathProg and to check the syntax
# 2. to test whether the Pre-assignment set PRA works.
/* SETS */
set TUTORS; # a list of tutors
set TUTEES; # a list of tutees
set ROOMS; # a list of rooms
set PRA := {tutor in TUTORS, tutee in TUTEES, r in ROOMS}; # a list of pre-assignments of (tutor, tutee, r), is this syntax correct?
### sample assignment
/* VARIABLES */
var x {tutor in TUTORS, tutee in TUTEES, r in ROOMS}, binary >= 0; # binary variables, 1 if the combination is assigned, 0 otherwise
/* OBJECTIVE FUNCTION */
maximize z: sum{tutor in TUTORS, tutee in TUTEES, r in ROOMS} x[tutor, tutee,r] ; # arbritary
/* CONSTRAINTS */
### all tutees have at most one tutor
s.t. uniqueTutor{tutee in TUTEES}: sum{tutor in TUTORS} (max{r in ROOMS} x[tutor, tutee, r])<=1;
# what I want to say is to ignore whatever room has been assigned, subspace as x[tutor, tutee] is what I want.. how I express that? Does "max" do the trick? GLPK is complaining about syntax. Is there any other to express this?
### pre-assignments to be taken into account
s.t. preassignment{(tutor, tutee,r) in PRA} x[tutor, tutee, r] =1;
data;
set TUTORS := ar3 su2 mrc;
set TUTEES := iph04 sr104;
set ROOMS := ra rb rc;
set PRA := (ar3, iph04, ra) (su2, iph04, rb) (mrc, sr104, rc);
# GLPK is complaining that PRA does not need data,why?
# iph04 has 2 tutors, I want the MathProg to detect and report this.
end;
- [Help-glpk] subspace problem,
Benson <=