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.

Liviu Lalescu

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.

ibrahim ragab

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

Liviu Lalescu

To have all constraints, use the file fet-v.v.v/translations/test-all-constraints.fet (this file is not solvable).

ibrahim ragab


prakhar

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

Liviu Lalescu

#20
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).

prakhar

@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

Liviu Lalescu

#22
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).

prakhar

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

Liviu Lalescu

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

anisanjum

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