Port FET to Java or C#

Started by prakhar, September 18, 2012, 10:28:22 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

prakhar

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?

Liviu Lalescu

#1
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.

prakhar

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

Liviu Lalescu

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.

Soyeb

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

prakhar

@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

Soyeb

In case you change your mind, I know a very good C++ currently looking for work.

Soyeb

prakhar

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

Liviu Lalescu

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.

prakhar

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

Liviu Lalescu

See timetable.h, Timetable contains the Rules for a single timetable data file.

prakhar

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

Liviu Lalescu

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.

prakhar

Thank you for your reply @Liviu.
It saved my time.

I guess I have to do similar thing in case of TimeConstraint.

Thanks

ibrahim ragab

#14
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