Hello folks,
As I think for now FET is the best time-tabling open-source software out there. So I want to implement it in Java EE or ASP.NET.
Since the project is in Qt, the only option I am having is either using QtJambi or Qt4DotNet. But this approach will still demand converting C++ syntax code into Java (or C#) syntax code.
Since I am developing it for web, I won't be using its user interface anyway.
Is there any better way to do that?
I suggest:
- to use only the 'engine' directory and interface/fet.cpp & fet.h.
- to get the necessary classes code from Qt code, or to implement fake code for classes, for instance for QString or QList or QSet. The first approach is the best, because you maintain the identical algorithm behavior for the same random seed, for instance when inserting into QSet and when removing from QSet (QList and QString have identical behavior with string and vector classes from STL, probably). You will only implement these classes once, and keep FET code with QString and QList and QSet.
First of all thank you for replying me that early, @Liviu Lalescu.
I may convert engine of FET into Java Class Library by using the Qt Jambi Generator. But QString, QList and QSet won't be mapped into any Java (or C#) classes. I was planning on using java.lang.String for QString, java.util.List for QList and java.util.HashSet for QSet (or respective C# libraries)
@Liviu Lalescu, you are suggesting that I should stick with classes QString, QList and QSet of Qt Framework.
Since you are the author, you know FET much better. Will the earlier one will appear to be costly (performance wise)?
Thanks,
Prakhar Mishra
No, I wasn't saying that you should stick with the Qt Framework - I was just suggesting the easiest (maybe) way to get rid of Qt Framework.
You may replace QList with Java list class, and QString and QSet. The only thing about QSet is that two implementations may make FET behave differently. If you want identical behavior for the same random seed (which is very good for you as a checking measure), you need to copy the exact behavior of QSet into your program.
There is no big problem of speed of execution, all list and set and string implementation should be good, I think.
Why convert it to Java or C#? Qt is available on all desktop OS's, and it's not suitable for running on
If you want to give it a web front-end may I suggest Wt (http://www.webtoolkit.eu/wt), it has a very Qt style interface, and is C++ so should be easy to port to.
Regards,
Soyeb
@Soyeb, If I take your advice, then there will be some problems:-
Although we are using Liviu's creation, we may extend it on our own. If it is written in C++, company won't be able to hire people (developers) to works on it, as Wt seems pretty new to me.
There are not that good C++ developers here. So, even if I arrange proper training of C++ as well as Wt for them, they won't be able to cope up with it. Besides, the developers here use ASP.NET and Java EE for web development, they are more comfortable with it.
So, I don't think its going to work, in my case.
Anyways, thank you for suggesting me, @Soyeb
Regards,
Prakhar Mishra
In case you change your mind, I know a very good C++ currently looking for work.
Soyeb
Hello everyone,
I am getting problems while porting LongTextMessageBox (I think it (and a lot of things besides that like MessageBoxes) should not be used in engine because it is making engine GUI dependent). Why it contains three buttons and as this code suggests
if(button0Text==QString() || button1Text==QString() || button2Text!=QString()){
QMessageBox::critical(parent, tr("FET critical"), tr("You have met a FET bug. The problem is in file"
" %1 line %2, the reason is that a confirmation dialog box does not get exactly 2 arguments. Please report bug. FET will now continue."
" You probably don't have any problems with your data file - you can save it.").arg(__FILE__).arg(__LINE__));
}
that button2Text is expected to be kept null (or empty string). I am not getting why? And just what is the need of third button in confirmation? (If I am asking something pretty naive then please forgive me).
Regards,
Prakhar Mishra
Don't worry about this, it is just that I wanted to convert faster from QMessageBox to my custom LongTextMessageBox. You can also get rid of GUI dependence very easily in this way.
Hello CPP folks,
I am having a problem in using TimeTable class.
The only instantiation of TimeTable class (named as gt) is in fet.cpp and thats what written in comments:
/**
The one and only instantiation of the main class.
*/
Timetable gt;
I am re-developing it keeping in mind that it should be accessible simultaneously by any no. of users. Now I am afraid after reading that comment. Is the TimeTable class is designed to be used as a singleton class??
Regards,
Prakhar Mishra
See timetable.h, Timetable contains the Rules for a single timetable data file.
Hey @Liviu, thanks for the reply.
There is one more thing I am not getting.
There are 27 classes inheriting SpaceConstraint.
But while reading through Rules::read(), you are checking for 42 kind of space constraints.
Why that difference?
Let me put here those 42 space constraints for you:-
a. Constraint Basic Compulsory Space
b. Constraint Room Not Available
c. Constraint Room Not Available Times
d. Constraint Room Type Not Allowed Subjects
e. Constraint Subject Requires Equipments
f. Constraint Subject Subject Tag Require Equipments
g. Constraint Teacher Requires Room
h. Constraint Teacher Subject Require Room
i. Constraint Minimize Number Of Rooms For Students
j. Constraint Minimize Number Of Rooms For Teachers
k. Constraint Activity Preferred Room
l. Constraint Activity Preferred Rooms
m. Constraint Activities Same Room
n. Constraint Subject Preferred Room
o. Constraint Subject Preferred Rooms
p. Constraint Subject Subject Tag Preferred Room
q. Constraint Subject Subject Tag Preferred Rooms
r. Constraint Subject Activity Tag Preferred Room
s. Constraint Subject Activity Tag Preferred Rooms
t. Constraint Activity Tag Preferred Room
u. Constraint Activity Tag Preferred Rooms
v. Constraint Students Set Home Room
w. Constraint Students Set Home Rooms
x. Constraint Teacher Home Room
y. Constraint Teacher Home Rooms
z. Constraint Max Building Changes Per Day For Teachers
aa. Constraint Max Building Changes Per Day For Students
bb. Constraint Max Room Changes Per Day For Teachers
cc. Constraint Max Room Changes Per Day For Students
dd. Constraint Teacher Max Building Changes Per Day
ee. Constraint Teachers Max Building Changes Per Day
ff. Constraint Teacher Max Building Changes Per Week
gg. Constraint Teachers Max Building Changes Per Week
hh. Constraint Teacher Min Gaps Between Building Changes
ii. Constraint Teachers Min Gaps Between Building Changes
jj. Constraint Students Set Max Building Changes Per Day
kk. Constraint Students Max Building Changes Per Day
ll. Constraint Students Set Max Building Changes Per Week
mm. Constraint Students Max Building Changes Per Week
nn. Constraint Students Set Min Gaps Between Building Changes
oo. Constraint Students Min Gaps Between Building Changes
pp. Constraint Activities Occupy Max Different Rooms
There are some obsolete constraints or which were transformed into a more general constraint. Obsolete is "room type not allowed subjects" and transformed is "room not available". You can ignore these and use only the 27 ones.
Thank you for your reply @Liviu.
It saved my time.
I guess I have to do similar thing in case of TimeConstraint.
Thanks
Quote from: Liviu Lalescu on October 31, 2012, 06:46:21 AM
See timetable.h, Timetable contains the Rules for a single timetable data file.
First: it is very good program from Genius programmer
Second: QT is very good framework for cross_platform application but it is not wide used in open source community
----------
if one provide us with wrapper for main core , or main function become external and documented provide for it , this will help .net programmers,java p and all to develop program and add new functions
_________
external main function table will help all programmers to work in this project.
in C# and all related .net language (for example)
in C++ source code :extern void addActivity(teachers,subject,groups);
can be used in C# as:
[DllImport("fet.dll")]
private static extern void addActivity(teachers,subject,groups);
in JAVA it work also in another way
_________
or type liberary file (tlb) for Interoperability
Thank you for appreciation!
Yes, an external interface as a shared library would be nice. Unfortunately, I did not think of this from the start.
Maybe you can use the command-line program.
To use FET as a shared library would need somebody to make accessible the variables from generate_pre.h & .cpp and generate.h & .cpp.
appreciation for perfect work and Perseverance again
---------------
inside wrapper (deal with program core) :o
yes it will be hard work , I think more then i find that if I made a .net outside wrapper for xml file creation and manpulation it may better than external functions(inside wrapper),it is very easy for me to create wrapper if i have completed xml elements file ,then I take largest file in examples directory ("Econ-Timisoara.fet" since it may contain all xml attributes) and using XSD.exe Microsoft tool to create wrapper automatically,but it may not contain all elements since
all <Time_Constraints_List> attributes may not presented in this file
also same for <Space_Constraints_List>
File that XSD.exe generate in attachments
----------
after making a wrapper for XML file creation i will add generate_table() function that use command line,now you may ask what this add for development extensibility?, this will enable .net programmers to modify interface of the program by using WPF technology for example,imagine that connect (teacher,group,subject) that you call activity will be like this image in attachment
To have all constraints, use the file fet-v.v.v/translations/test-all-constraints.fet (this file is not solvable).
thanks ,this I want
Hello everybody,
Hey @Liviu, since I have ported it to C#.NET, I am having some problems. When I try to add some conflicting constraints, one with weight 100% and the other with weight less than 100%, then it is not generating the time table. Its getting stuck at n no. of activities. Could you please suggest, where the problem may be?
I used same structure of classes in .net as you did in FET.
Thanks.
Regards,
Prakhar Mishra
Please attach the .fet file.
You converted generate.cpp and generate_pre.cpp? That was a lot of work.
In the latest version, 5.19.0, there are some small but important changes, so that any implementation of set class gives the same behavior. Maybe you could check these changes and implement them into your C#.NET program. Then you can try on the example files if the random seed you get is the same as official FET. (To implement the changes, compare old FET 5.18.2 or whatever version you used with the new FET 5.19.0).
@Liviu, I don't have a .fet file because it is not supposed to generate it.
But I do have a log file (similar to FET I guess).
I am providing it here.
Any help will be appreciated.
Thanks.
Regards,
Prakhar Mishra
There seems to be something wrong with your log file. I suggest you to compare side-by-side FET and your code, 5.19.0, for a solvable file compare the final random seed, should be identical. Increase the search through solvable files by using more and more constraints, one at a time, then you will see on which constraint you made an error.
Edited to add: With the random seed you can compare also the behavior on files which are impossible for your executable. Add portions of code to output the random seed in parts of your code and in official FET. Should be identical random seeds (using FET 5.19.0).
Hey @Liviu, Thanks for the reply.
If by random seeds, you mean the values of MM, AA, QQ, RR, MMM, AAA, QQQ, RRR then here are those values which I have copied from FET source only.
public static int MM=2147483647;
public static int AA=48271;
public static int QQ=44488;
public static int RR=3399;
public static int MMM=2147483399;
public static int AAA=40692;
public static int QQQ=52774;
public static int RRR=3791;
If you mean XX and YY, they are Time dependent, i.e. their values will change every second (if I am not wrong).
//unsigned tt=unsigned(time(NULL));
double tt = (DateTime.Now - new DateTime(1970, 1, 1)).TotalSeconds;
//XX is the current time
//XX = 1 + ( (unsigned(tt)) % (unsigned(MM-1)) );
XX = 1 + (int)tt % (MM - 1);
//YY is the next random, after initializing YY with the current time
//YY = 1 + ( (unsigned(tt)) % (unsigned(MMM-1)) );
YY = 1 + (int)tt % (MMM - 1);
Or if random seed is a whole another thing then could you please quote it for me?
Thanks.
Regards,
Prakhar Mishra
I mean XX and YY. You need to initialize them with the same values in FET and in your program then, as time goes by, check that they have the same values.
They change value more than once a second. They change value in subroutines randomKnuth1MM1() and randomKnuth(int k).
hey Shoyeb,
I was just going through the posts.can u help me get the web version of fet through WT,if u can.
I am waiting...