Final lab

This commit is contained in:
2016-12-05 03:39:36 -08:00
parent 001a46260a
commit 4336cb30e9
161 changed files with 4086 additions and 0 deletions

BIN
lab5/Codes/FSS-Modified/.DS_Store vendored Normal file

Binary file not shown.

Binary file not shown.

35
lab5/Codes/FSS-Modified/.idea/FSS.iml generated Normal file
View File

@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="CPP_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/FSS.h" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/CMakeLists.txt" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/FSSB.cpp" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/FSSNW.cpp" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/FSSB.h" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/makefile" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/main.cpp" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/fss.txt" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/bin/FSS" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/FSS.cpp" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/FSSNW.h" isTestSource="false" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library">
<library name="Header Search Paths">
<CLASSES>
<root url="file:///usr/lib/gcc/x86_64-linux-gnu/5/include-fixed" />
<root url="file:///usr/lib/gcc/x86_64-linux-gnu/5/include" />
<root url="file:///usr/include" />
<root url="file:///usr/local/include" />
</CLASSES>
<SOURCES>
<root url="file:///usr/lib/gcc/x86_64-linux-gnu/5/include-fixed" />
<root url="file:///usr/lib/gcc/x86_64-linux-gnu/5/include" />
<root url="file:///usr/include" />
<root url="file:///usr/local/include" />
</SOURCES>
</library>
</orderEntry>
</component>
</module>

14
lab5/Codes/FSS-Modified/.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
</project>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/FSS.iml" filepath="$PROJECT_DIR$/.idea/FSS.iml" />
</modules>
</component>
</project>

View File

@@ -0,0 +1,534 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeRunConfigurationManager" shouldGenerate="true" assignedExecutableTargets="true" buildAllGenerated="true">
<generated>
<config projectName="FSS" targetName="FSS" />
</generated>
</component>
<component name="CMakeSettings" AUTO_RELOAD="false" GENERATION_PASS_SYSTEM_ENVIRONMENT="true">
<ADDITIONAL_GENERATION_ENVIRONMENT>
<envs />
</ADDITIONAL_GENERATION_ENVIRONMENT>
</component>
<component name="ChangeListManager">
<list default="true" id="90b7fc41-7701-47ca-bbfc-b94b0a2a061c" name="Default" comment="" />
<ignored path="FSS.iws" />
<ignored path=".idea/workspace.xml" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="CreatePatchCommitExecutor">
<option name="PATCH_PATH" value="" />
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
<component name="FavoritesManager">
<favorites_list name="FSS" />
</component>
<component name="FileEditorManager">
<leaf>
<file leaf-file-name="CMakeLists.txt" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="180">
<caret line="12" column="9" selection-start-line="12" selection-start-column="9" selection-end-line="12" selection-end-column="9" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="main.cpp" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/main.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="180">
<caret line="80" column="0" selection-start-line="80" selection-start-column="0" selection-end-line="80" selection-end-column="0" />
<folding>
<element signature="e#194#213#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="writeup.tex" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/../../Results/writeup.tex">
<provider selected="true" editor-type-id="LaTeXFileEditor">
<state />
</provider>
</entry>
</file>
<file leaf-file-name="FSS.cpp" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/FSS.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="75">
<caret line="5" column="67" selection-start-line="5" selection-start-column="67" selection-end-line="5" selection-end-column="67" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="FSSNW.cpp" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/FSSNW.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1315">
<caret line="113" column="4" selection-start-line="113" selection-start-column="4" selection-end-line="113" selection-end-column="4" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="FSSB.cpp" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/FSSB.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-965">
<caret line="27" column="14" selection-start-line="27" selection-start-column="14" selection-end-line="27" selection-end-column="14" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="FSS.h" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/FSS.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-60">
<caret line="11" column="17" selection-start-line="11" selection-start-column="17" selection-end-line="11" selection-end-column="17" />
<folding>
<marker date="1480924694519" expanded="true" signature="260:1244" ph="{...}" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="FSSB.h" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/FSSB.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="60">
<caret line="11" column="0" selection-start-line="11" selection-start-column="0" selection-end-line="11" selection-end-column="0" />
<folding>
<marker date="1480924694523" expanded="true" signature="268:1219" ph="{...}" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="FSSNW.h" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/FSSNW.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="135">
<caret line="21" column="37" selection-start-line="21" selection-start-column="37" selection-end-line="21" selection-end-column="37" />
<folding>
<marker date="1480924694511" expanded="true" signature="280:1241" ph="{...}" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="fss.txt" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/fss.txt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/FSS.h" />
<option value="$PROJECT_DIR$/FSS.cpp" />
<option value="$PROJECT_DIR$/FSSB.h" />
<option value="$PROJECT_DIR$/FSSNW.h" />
<option value="$PROJECT_DIR$/FSSNW.cpp" />
<option value="$PROJECT_DIR$/CMakeLists.txt" />
<option value="$PROJECT_DIR$/FSSB.cpp" />
<option value="$PROJECT_DIR$/main.cpp" />
<option value="$PROJECT_DIR$/../../Results/writeup.tex" />
</list>
</option>
</component>
<component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
<component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
<component name="JsGulpfileManager">
<detection-done>true</detection-done>
<sorting>DEFINITION_ORDER</sorting>
</component>
<component name="ProjectFrameBounds">
<option name="x" value="59" />
<option name="y" value="52" />
<option name="width" value="1521" />
<option name="height" value="848" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1">
<flattenPackages />
<showMembers />
<showModules />
<showLibraryContents />
<hideEmptyPackages />
<abbreviatePackageNames />
<autoscrollToSource />
<autoscrollFromSource />
<sortByType />
<manualOrder />
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="ProjectPane">
<subPane>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="FSS" />
<option name="myItemType" value="com.jetbrains.cidr.projectView.CidrFilesViewHelper$MyProjectTreeStructure$1" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="FSS" />
<option name="myItemType" value="com.jetbrains.cidr.projectView.CidrFilesViewHelper$MyProjectTreeStructure$1" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="FSS" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
</subPane>
</pane>
</panes>
</component>
<component name="PropertiesComponent">
<property name="settings.editor.selected.configurable" value="preferences.lookFeel" />
<property name="settings.editor.splitter.proportion" value="0.2" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/../../Results/writeup.tex" />
</component>
<component name="RunManager" selected="Application.Build All">
<configuration default="true" type="CMakeGoogleTestRunConfigurationType" factoryName="Google Test" PASS_PARENT_ENVS_2="true" PROJECT_NAME="FSS" TARGET_NAME="FSS" CONFIG_NAME="Debug" TEST_MODE="SUITE_TEST">
<envs />
<method />
</configuration>
<configuration default="true" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS_2="true" PROJECT_NAME="FSS" TARGET_NAME="FSS" CONFIG_NAME="Debug">
<envs />
<method />
</configuration>
<configuration default="true" type="JavascriptDebugType" factoryName="JavaScript Debug">
<method />
</configuration>
<configuration default="true" type="PythonConfigurationType" factoryName="Python">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="FSS" />
<option name="SCRIPT_NAME" value="" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<method />
</configuration>
<configuration default="true" type="Tox" factoryName="Tox">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="FSS" />
<method />
</configuration>
<configuration default="true" type="js.build_tools.gulp" factoryName="Gulp.js">
<method />
</configuration>
<configuration default="true" type="js.build_tools.npm" factoryName="npm">
<command value="run-script" />
<scripts />
<node-interpreter value="project" />
<envs />
<method />
</configuration>
<configuration default="true" type="tests" factoryName="Attests">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="FSS" />
<option name="SCRIPT_NAME" value="" />
<option name="CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="FOLDER_NAME" value="" />
<option name="TEST_TYPE" value="TEST_SCRIPT" />
<option name="PATTERN" value="" />
<option name="USE_PATTERN" value="false" />
<method />
</configuration>
<configuration default="true" type="tests" factoryName="Doctests">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="FSS" />
<option name="SCRIPT_NAME" value="" />
<option name="CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="FOLDER_NAME" value="" />
<option name="TEST_TYPE" value="TEST_SCRIPT" />
<option name="PATTERN" value="" />
<option name="USE_PATTERN" value="false" />
<method />
</configuration>
<configuration default="true" type="tests" factoryName="Nosetests">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="FSS" />
<option name="SCRIPT_NAME" value="" />
<option name="CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="FOLDER_NAME" value="" />
<option name="TEST_TYPE" value="TEST_SCRIPT" />
<option name="PATTERN" value="" />
<option name="USE_PATTERN" value="false" />
<option name="PARAMS" value="" />
<option name="USE_PARAM" value="false" />
<method />
</configuration>
<configuration default="true" type="tests" factoryName="Unittests">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="FSS" />
<option name="SCRIPT_NAME" value="" />
<option name="CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="FOLDER_NAME" value="" />
<option name="TEST_TYPE" value="TEST_SCRIPT" />
<option name="PATTERN" value="" />
<option name="USE_PATTERN" value="false" />
<option name="PUREUNITTEST" value="true" />
<option name="PARAMS" value="" />
<option name="USE_PARAM" value="false" />
<method />
</configuration>
<configuration default="true" type="tests" factoryName="py.test">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="FSS" />
<option name="SCRIPT_NAME" value="" />
<option name="CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="FOLDER_NAME" value="" />
<option name="TEST_TYPE" value="TEST_SCRIPT" />
<option name="PATTERN" value="" />
<option name="USE_PATTERN" value="false" />
<option name="testToRun" value="" />
<option name="keywords" value="" />
<option name="params" value="" />
<option name="USE_PARAM" value="false" />
<option name="USE_KEYWORD" value="false" />
<method />
</configuration>
<configuration default="false" name="FSS" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS_2="true" PROJECT_NAME="FSS" TARGET_NAME="FSS" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="FSS" RUN_TARGET_NAME="FSS">
<envs />
<method />
</configuration>
<configuration default="false" name="Build All" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="file://$PROJECT_DIR$" PASS_PARENT_ENVS_2="true" PROJECT_NAME="FSS" TARGET_NAME="FSS" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="FSS" RUN_TARGET_NAME="FSS">
<envs />
<method />
</configuration>
<list size="2">
<item index="0" class="java.lang.String" itemvalue="Application.FSS" />
<item index="1" class="java.lang.String" itemvalue="Application.Build All" />
</list>
</component>
<component name="ShelveChangesManager" show_recycled="false">
<option name="remove_strategy" value="false" />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="90b7fc41-7701-47ca-bbfc-b94b0a2a061c" name="Default" comment="" />
<created>1480907549006</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1480907549006</updated>
<workItem from="1480907550208" duration="17856000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="17856000" />
</component>
<component name="ToolWindowManager">
<frame x="59" y="52" width="1521" height="848" extended-state="4" />
<editor active="false" />
<layout>
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.24983564" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32903227" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="CMake" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32903227" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
</layout>
</component>
<component name="Vcs.Log.UiProperties">
<option name="RECENTLY_FILTERED_USER_GROUPS">
<collection />
</option>
<option name="RECENTLY_FILTERED_BRANCH_GROUPS">
<collection />
</option>
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<option name="time" value="16" />
</breakpoint-manager>
<watches-manager />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/fss.txt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/FSSNW.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="135">
<caret line="21" column="37" selection-start-line="21" selection-start-column="37" selection-end-line="21" selection-end-column="37" />
<folding>
<marker date="1480924694511" expanded="true" signature="280:1241" ph="{...}" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/FSSB.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="60">
<caret line="11" column="0" selection-start-line="11" selection-start-column="0" selection-end-line="11" selection-end-column="0" />
<folding>
<marker date="1480924694523" expanded="true" signature="268:1219" ph="{...}" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/FSS.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-60">
<caret line="11" column="17" selection-start-line="11" selection-start-column="17" selection-end-line="11" selection-end-column="17" />
<folding>
<marker date="1480924694519" expanded="true" signature="260:1244" ph="{...}" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="180">
<caret line="12" column="9" selection-start-line="12" selection-start-column="9" selection-end-line="12" selection-end-column="9" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/FSSNW.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1315">
<caret line="113" column="4" selection-start-line="113" selection-start-column="4" selection-end-line="113" selection-end-column="4" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/FSSB.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-965">
<caret line="27" column="14" selection-start-line="27" selection-start-column="14" selection-end-line="27" selection-end-column="14" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/FSS.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="75">
<caret line="5" column="67" selection-start-line="5" selection-start-column="67" selection-end-line="5" selection-end-column="67" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/main.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="180">
<caret line="80" column="0" selection-start-line="80" selection-start-column="0" selection-end-line="80" selection-end-column="0" />
<folding>
<element signature="e#194#213#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/../../Results/writeup.tex">
<provider selected="true" editor-type-id="LaTeXFileEditor">
<state />
</provider>
</entry>
</component>
</project>

View File

@@ -0,0 +1,18 @@
cmake_minimum_required(VERSION 3.6)
project(FSS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(SOURCE_FILES
bin/FSS
FSS.cpp
FSS.h
FSSB.cpp
FSSB.h
FSSNW.cpp
FSSNW.h
fss.txt
main.cpp
makefile)
add_executable(FSS ${SOURCE_FILES})

View File

@@ -0,0 +1,125 @@
/**
* @brief Flow shop scheduling
* @author doc. MSc. Donald Davendra Ph.D.
* @date 3.10.2013
*
* This is a simple class to calculate the makespan of the flowshop scheduling schedule.
*/
/*! \file FSS.h
\brief A FSS header file.
*/
#include "FSS.h"
#include <iostream>
#include <fstream>
#include <cmath>
#include <stdlib.h>
using namespace std;
cFSS::cFSS(){
}
void cFSS::Init(std::string file_path){
ifstream infile;
infile.open(file_path);
if(!infile.is_open()) {
cout << "Error Opening File.\n";
exit(1);
}
else {
infile >> m_Machines;
infile >> m_Jobs;
m_ProcessTime = new float*[m_Machines];
for (int i = 0; i < m_Machines; i++) {
m_ProcessTime[i] = new float[m_Jobs];
}
for (int i = 0; i < (m_Machines); i++) {
for (int j = 0; j < m_Jobs; j++) {
infile >> m_ProcessTime[i][j];
}
}
m_CompletionTime = new float*[m_Machines];
for (int i = 0; i < m_Machines; i++) {
m_CompletionTime[i] = new float[m_Jobs];
}
}
infile.close();
}
cFSS::~cFSS(){
for (int i = 0; i < m_Machines; i++) {
delete [] m_ProcessTime[i];
}
delete [] m_ProcessTime;
for (int i = 0; i < m_Machines; i++) {
delete [] m_CompletionTime[i];
}
delete [] m_CompletionTime;
}
int cFSS::GetMachines(){
return m_Machines;
}
int cFSS::GetJobs(){
return m_Jobs;
}
float cFSS::Makespan(int *Schedule){
double max;
Initialize();
// Calculate processing time for all jobs on first machine
m_CompletionTime[0][0] = m_ProcessTime[0][Schedule[0]-1];
for (int i = 1; i < m_Jobs; i++) {
m_CompletionTime[0][i] = (m_CompletionTime[0][i-1] + m_ProcessTime[0][Schedule[i]-1]);
}
// Calculate the processing time for first job on all machines
for (int i = 1; i < m_Machines; i++) {
m_CompletionTime[i][0] = (m_CompletionTime[i-1][0] + m_ProcessTime[i][Schedule[0]-1]);
}
// Calculate the rest of the processing time
for (int i = 1; i < m_Machines; i++) {
for (int j = 1; j < m_Jobs; j++) {
max = Max(m_CompletionTime[i][j-1], m_CompletionTime[i-1][j]);
m_CompletionTime[i][j] = m_ProcessTime[i][Schedule[j]-1] + max;
}
}
// Return the makespan.
return m_CompletionTime[m_Machines-1][m_Jobs-1];
}
void cFSS::Initialize(){
for (int i = 0; i < m_Machines; i++) {
for (int j = 0; j < m_Jobs; j++) {
m_CompletionTime[i][j] = 0;
}
}
}
float cFSS::Max(float A,float B){
if(A>=B)
return A;
else
return B;
}

View File

@@ -0,0 +1,65 @@
/**
* @brief Flow shop scheduling
* @author doc. MSc. Donald Davendra Ph.D.
* @date 3.10.2013
*
* This is a simple class to calculate the makespan of the flowshop scheduling schedule.
*/
#ifndef __FSS_H__
#define __FSS_H__
#include <string>
class cFSS{
public:
//! A constructor.
/*!
Constructs the FSS class, and assigns the values.
*/
cFSS();
void Init(std::string file_path);
//! A destructor.
/*!
Clears the memory.
*/
~cFSS();
//! A normal member taking in the schedule and returning the makespan.
/*!
\param the schedule
\return The cost of the tours
*/
float Makespan(int *Schedule);
//! Returns the number of jobs.
/*!
\param no parameters
\return The number of jobs
*/
int GetJobs();
//! Returns the number of machines.
/*!
\param no parameters
\return The number of machines
*/
int GetMachines();
float Max(float, float);
void Initialize();
private:
//! The processing time matrix.
float** m_ProcessTime;
//! The completion time matrix.
float** m_CompletionTime;
//! The number of jobs.
int m_Jobs;
//! The number of machines.
int m_Machines;
};
#endif

View File

@@ -0,0 +1,118 @@
/**
* @brief Flow shop with blocking
* @author doc. MSc. Donald Davendra Ph.D.
* @date 3.10.2013
*
* This is a simple class to calculate the makespan of the flowshop with blocking schedule.
*/
/*! \file FSSB.h
\brief A FSSB header file.
*/
#include "FSSB.h"
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <cmath>
using namespace std;
cFSSB::cFSSB(){
}
void cFSSB::Init(std::string file_path){
ifstream infile;
infile.open(file_path);
if(!infile.is_open()) {
cout << "Error Opening File.\n";
exit(1);
}
else {
infile >> m_Machines;
infile >> m_Jobs;
m_ProcessTime = new float*[m_Machines];
for (int i = 0; i < m_Machines; i++) {
m_ProcessTime[i] = new float[m_Jobs];
}
for (int i = 0; i < (m_Machines); i++) {
for (int j = 0; j < m_Jobs; j++) {
infile >> m_ProcessTime[i][j];
}
}
m_CompletionTime = new float*[m_Machines];
for (int i = 0; i < m_Machines; i++) {
m_CompletionTime[i] = new float[m_Jobs];
}
}
infile.close();
}
cFSSB::~cFSSB(){
for (int i = 0; i < m_Machines; i++) {
delete [] m_ProcessTime[i];
}
delete [] m_ProcessTime;
for (int i = 0; i < m_Machines; i++) {
delete [] m_CompletionTime[i];
}
delete [] m_CompletionTime;
}
int cFSSB::GetMachines(){
return m_Machines;
}
int cFSSB::GetJobs(){
return m_Jobs;
}
float cFSSB::Makespan(int *Schedule){
Initialize();
// Calculate processing time for all jobs on first machine
m_CompletionTime[0][0] = m_ProcessTime[0][Schedule[0]-1];
for (int i = 1; i < m_Machines; i++) {
m_CompletionTime[i][0] = (m_CompletionTime[i-1][0] + m_ProcessTime[i][Schedule[0]-1]);
}
// Calculate for each subsequent job
for (int i = 1; i < m_Jobs; i++) {
for (int j = 0; j < m_Machines; j++) {
if(j == 0){
m_CompletionTime[j][i] = m_CompletionTime[j][i-1] + m_ProcessTime[j][Schedule[i]-1];
}
else{
if(m_CompletionTime[j-1][i] < m_CompletionTime[j][i-1]){
m_CompletionTime[j-1][i] = m_CompletionTime[j][i-1];
}
m_CompletionTime[j][i] = m_CompletionTime[j-1][i] + m_ProcessTime[j][Schedule[i]-1];
}
}
}
// Return the makespan.
return m_CompletionTime[m_Machines-1][m_Jobs-1];
}
void cFSSB::Initialize(){
for (int i = 0; i < m_Machines; i++) {
for (int j = 0; j < m_Jobs; j++) {
m_CompletionTime[i][j] = 0;
}
}
}

View File

@@ -0,0 +1,63 @@
/**
* @brief Flow shop with blocking
* @author doc. MSc. Donald Davendra Ph.D.
* @date 3.10.2013
*
* This is a simple class to calculate the makespan of the flowshop with blocking schedule.
*/
#ifndef __FSSB_H__
#define __FSSB_H__
#include <string>
class cFSSB{
public:
//! A constructor.
/*!
Constructs the FSSB class, and assigns the values.
*/
cFSSB();
void Init(std::string file_path);
//! A destructor.
/*!
Clears the memory.
*/
~cFSSB();
//! A normal member taking in the schedule and returning the cost.
/*!
\param A flowshop schedule
\return The makespan value
*/
float Makespan(int *Schedule);
//! Returns the number of jobs.
/*!
\param no parameters
\return The number of jobs
*/
int GetJobs();
//! Returns the number of machines.
/*!
\param no parameters
\return The number of machines
*/
int GetMachines();
void Initialize();
private:
//! The processing time matrix.
float** m_ProcessTime;
//! The completion time matrix.
float** m_CompletionTime;
//! The number of jobs.
int m_Jobs;
//! The number of machines.
int m_Machines;
};
#endif

View File

@@ -0,0 +1,127 @@
/**
* @brief Flow shop scheduling with no wait
* @author doc. MSc. Donald Davendra Ph.D.
* @date 3.10.2013
*
* This is a simple class to calculate the makespan of the flowshop with no wait schedule.
*/
/*! \file FSSNW header
\brief A FSSNW header file.
*/
#include "FSSNW.h"
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <cmath>
using namespace std;
cFSSNW::cFSSNW(){
}
void cFSSNW::Init(std::string file_path) {
ifstream infile;
infile.open(file_path);
if(!infile.is_open()) {
cout << "Error Opening File.\n";
exit(1);
}
else {
infile >> m_Machines;
infile >> m_Jobs;
m_ProcessTime = new float*[m_Machines];
for (int i = 0; i < m_Machines; i++) {
m_ProcessTime[i] = new float[m_Jobs];
}
for (int i = 0; i < (m_Machines); i++) {
for (int j = 0; j < m_Jobs; j++) {
infile >> m_ProcessTime[i][j];
}
}
m_CompletionTime = new float*[m_Machines];
for (int i = 0; i < m_Machines; i++) {
m_CompletionTime[i] = new float[m_Jobs];
}
}
infile.close();
}
cFSSNW::~cFSSNW(){
for (int i = 0; i < m_Machines; i++) {
delete [] m_ProcessTime[i];
}
delete [] m_ProcessTime;
for (int i = 0; i < m_Machines; i++) {
delete [] m_CompletionTime[i];
}
delete [] m_CompletionTime;
}
int cFSSNW::GetMachines(){
return m_Machines;
}
int cFSSNW::GetJobs(){
return m_Jobs;
}
float cFSSNW::Makespan(int *Schedule){
int offset;
double sum = 0;
Initialize();
// Calculate processing time for all jobs on first machine
m_CompletionTime[0][0] = m_ProcessTime[0][Schedule[0]-1];
for (int i = 1; i < m_Machines; i++) {
m_CompletionTime[i][0] = (m_CompletionTime[i-1][0] + m_ProcessTime[i][Schedule[0]-1]);
}
// Calculate for each subsequent job
for (int i = 1; i < m_Jobs; i++) {
for (int j = 0; j < m_Machines; j++) {
if(j == 0){
m_CompletionTime[j][i] = m_CompletionTime[j][i-1] + m_ProcessTime[j][Schedule[i]-1];
}
else{
if(m_CompletionTime[j-1][i] < m_CompletionTime[j][i-1]){
offset = m_CompletionTime[j][i-1] - m_CompletionTime[j-1][i];
for (int k = j - 1; k >= 0; k --) {
m_CompletionTime[k][i] = m_CompletionTime[k][i] + offset;
}
}
m_CompletionTime[j][i] = m_CompletionTime[j-1][i] + m_ProcessTime[j][Schedule[i]-1];
}
}
}
// Calculate the flowtime.
for (int i = 0 ; i < m_Jobs; i++) {
sum += m_CompletionTime[m_Machines - 1][i];
}
return sum;
}
void cFSSNW::Initialize(){
for (int i = 0; i < m_Machines; i++) {
for (int j = 0; j < m_Jobs; j++) {
m_CompletionTime[i][j] = 0;
}
}
}

View File

@@ -0,0 +1,63 @@
/**
* @brief Flow shop scheduling with no wait
* @author doc. MSc. Donald Davendra Ph.D.
* @date 3.10.2013
*
* This is a simple class to calculate the makespan of the flowshop with no wait schedule.
*/
#ifndef __FSSNW_H__
#define __FSSNW_H__
#include <string>
class cFSSNW{
public:
//! A constructor.
/*!
Constructs the FSSNW class, and assigns the values.
*/
cFSSNW();
void Init(std::string file_path);
//! A destructor.
/*!
Clears the memory.
*/
~cFSSNW();
//! A normal member taking in the schedule and returning the cost.
/*!
\param A flowshop schedule
\return The makespan value
*/
float Makespan(int *Schedule);
//! Returns the number of jobs.
/*!
\param no parameters
\return The number of jobs
*/
int GetJobs();
//! Returns the number of machines.
/*!
\param no parameters
\return The number of machines
*/
int GetMachines();
void Initialize();
private:
//! The processing time matrix.
float** m_ProcessTime;
//! The completion time matrix.
float** m_CompletionTime;
//! The number of jobs.
int m_Jobs;
//! The number of machines.
int m_Machines;
};
#endif

BIN
lab5/Codes/FSS-Modified/bin/FSS Executable file

Binary file not shown.

View File

@@ -0,0 +1,5 @@
4 5
5 5 3 6 3
4 4 2 4 4
4 4 3 4 1
3 6 3 2 5

View File

@@ -0,0 +1,6 @@
5 10
16 14 18 4 4 3 2 5 6 7
4 3 5 2 2 1 2 3 4 2
4 4 5 2 2 2 2 4 3 4
14 14 15 12 12 12 11 12 12 14
12 10 13 3 2 1 2 4 3 4

View File

@@ -0,0 +1,328 @@
/**
* @brief Flow shop scheduling
* @author doc. MSc. Donald Davendra Ph.D.
* @date 3.10.2013
*
* This is a simple class to calculate the makespan of the flowshop scheduling schedule.
*/
#include <iostream>
#include "FSS.h"
#include "FSSB.h"
#include "FSSNW.h"
#include <vector>
#include <chrono>
#include <thread>
#include <iostream>
using Clock = std::chrono::steady_clock;
using std::chrono::time_point;
using std::chrono::duration_cast;
using std::chrono::milliseconds;
using namespace std;
void JobMakespan(cFSS *FSS);
void JobMakespan(cFSSB *FSSB);
void JobMakespan(cFSSNW *FSSNW);
//! the main function.
/*!
\return 0 for successful completion
*/
int main ()
{
//! Initialization of the FSS* classes
cFSS* FSS = new cFSS();
cFSSB* FSSB = new cFSSB();
cFSSNW* FSSNW = new cFSSNW();
std::vector<int> times;
std::cout << "FSS: Tests 1 through 120" << std::endl;
for (int i = 1; i < 121; i++){
FSS->Init("../TaillardDataSets/" + to_string(i) + ".txt");
//! Calculate the schedule and print out results
//std::cout << i << " : ";
auto start = std::chrono::system_clock::now();
JobMakespan(FSS);
times.push_back(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - start).count());
std::cout << std::endl;
}
for (auto t: times){
std::cout << t << std::endl;
}
times.clear();
std::cout << "FSSB: Tests 1 through 120" << std::endl;
for (int i = 1; i < 121; i++){
FSSB->Init("../TaillardDataSets/" + to_string(i) + ".txt");
//! Calculate the schedule and print out results
//std::cout << i << " : ";
auto start = std::chrono::system_clock::now();
JobMakespan(FSSB);
times.push_back(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - start).count());
std::cout << std::endl;
}
for (auto t: times){
std::cout << t << std::endl;
}
times.clear();
std::cout << "FSSNW: Tests 1 through 120" << std::endl;
for (int i = 1; i < 121; i++){
FSSNW->Init("../TaillardDataSets/" + to_string(i) + ".txt");
//! Calculate the schedule and print out results
//std::cout << i << " : ";
auto start = std::chrono::system_clock::now();
JobMakespan(FSSNW);
times.push_back(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - start).count());
std::cout << std::endl;
}
for (auto t: times){
std::cout << t << std::endl;
}
times.clear();
return 0;
}
//! Function to calculate a simple schedule.
/*!
\return no return value
*/
void JobMakespan(cFSS *FSS){
//! Initilaize a schedule
int *Schedule = new int[FSS->GetJobs()];
//! Fill the schedule with it empty
for (int i = 0; i < FSS->GetJobs(); i++) {
Schedule[i] = 0;
}
// Determine if 1 or 2 should come first
Schedule[0] = 1;
Schedule[1] = 2;
int first = FSS->Makespan(Schedule);
Schedule[0] = 2;
Schedule[1] = 1;
int second = FSS->Makespan(Schedule);
if (first > second){
Schedule[0] = 1;
Schedule[1] = 2;
}
// for (int p = 0; p < FSS->GetJobs(); p++){
// std::cout << Schedule[p] << " ";
// }
// std::cout << " " << FSS->Makespan(Schedule) << std::endl;
// Now walk through the remaining K's and determine their makespans
for (int k = 3; k < FSS->GetJobs()+1; k++){
// The initial value
int best_val = INT32_MAX;
int best_ind = -1;
Schedule[k-1] = k;
if (FSS->Makespan(Schedule) <= best_val){
best_val = FSS->Makespan(Schedule);
best_ind = k;
}
// Walk down to index 0
for (int i = k-1; i > 0; i--){
int f = Schedule[i-1];
Schedule[i-1] = k;
Schedule[i] = f;
if (FSS->Makespan(Schedule) <= best_val){
best_val = FSS->Makespan(Schedule);
best_ind = i;
}
}
// And then walk back up to the best index we found
for (int i = 0; i < best_ind-1; i++) {
int f = Schedule[i + 1];
Schedule[i + 1] = k;
Schedule[i] = f;
}
}
//! Calculate the makespan of the simple schedule and display it in standard output
cout << FSS->Makespan(Schedule);
//! Delete the schdule.
delete [] Schedule;
}
//! Function to calculate a simple schedule.
/*!
\return no return value
*/
void JobMakespan(cFSSNW *FSSNW){
//! Initilaize a schedule
int *Schedule = new int[FSSNW->GetJobs()];
//! Fill the schedule with it empty
for (int i = 0; i < FSSNW->GetJobs(); i++) {
Schedule[i] = 0;
}
// Determine if 1 or 2 should come first
Schedule[0] = 1;
Schedule[1] = 2;
int first = FSSNW->Makespan(Schedule);
Schedule[0] = 2;
Schedule[1] = 1;
int second = FSSNW->Makespan(Schedule);
if (first > second){
Schedule[0] = 1;
Schedule[1] = 2;
}
// for (int p = 0; p < FSS->GetJobs(); p++){
// std::cout << Schedule[p] << " ";
// }
// std::cout << " " << FSS->Makespan(Schedule) << std::endl;
// Now walk through the remaining K's and determine their makespans
for (int k = 3; k < FSSNW->GetJobs()+1; k++){
// The initial value
int best_val = INT32_MAX;
int best_ind = -1;
Schedule[k-1] = k;
if (FSSNW->Makespan(Schedule) <= best_val){
best_val = FSSNW->Makespan(Schedule);
best_ind = k;
}
// Walk down to index 0
for (int i = k-1; i > 0; i--){
int f = Schedule[i-1];
Schedule[i-1] = k;
Schedule[i] = f;
if (FSSNW->Makespan(Schedule) <= best_val){
best_val = FSSNW->Makespan(Schedule);
best_ind = i;
}
}
// And then walk back up to the best index we found
for (int i = 0; i < best_ind-1; i++) {
int f = Schedule[i + 1];
Schedule[i + 1] = k;
Schedule[i] = f;
}
}
//! Calculate the makespan of the simple schedule and display it in standard output
cout << FSSNW->Makespan(Schedule);
//! Delete the schdule.
delete [] Schedule;
}
//! Function to calculate a simple schedule.
/*!
\return no return value
*/
void JobMakespan(cFSSB *FSSB){
//! Initilaize a schedule
int *Schedule = new int[FSSB->GetJobs()];
//! Fill the schedule with it empty
for (int i = 0; i < FSSB->GetJobs(); i++) {
Schedule[i] = 0;
}
// Determine if 1 or 2 should come first
Schedule[0] = 1;
Schedule[1] = 2;
int first = FSSB->Makespan(Schedule);
Schedule[0] = 2;
Schedule[1] = 1;
int second = FSSB->Makespan(Schedule);
if (first > second){
Schedule[0] = 1;
Schedule[1] = 2;
}
// for (int p = 0; p < FSS->GetJobs(); p++){
// std::cout << Schedule[p] << " ";
// }
// std::cout << " " << FSS->Makespan(Schedule) << std::endl;
// Now walk through the remaining K's and determine their makespans
for (int k = 3; k < FSSB->GetJobs()+1; k++){
// The initial value
int best_val = INT32_MAX;
int best_ind = -1;
Schedule[k-1] = k;
if (FSSB->Makespan(Schedule) <= best_val){
best_val = FSSB->Makespan(Schedule);
best_ind = k;
}
// Walk down to index 0
for (int i = k-1; i > 0; i--){
int f = Schedule[i-1];
Schedule[i-1] = k;
Schedule[i] = f;
if (FSSB->Makespan(Schedule) <= best_val){
best_val = FSSB->Makespan(Schedule);
best_ind = i;
}
}
// And then walk back up to the best index we found
for (int i = 0; i < best_ind-1; i++) {
int f = Schedule[i + 1];
Schedule[i + 1] = k;
Schedule[i] = f;
}
}
//! Calculate the makespan of the simple schedule and display it in standard output
cout << FSSB->Makespan(Schedule);
//! Delete the schdule.
delete [] Schedule;
}

View File

@@ -0,0 +1,27 @@
CC = g++
CFLAGS = -c -Wall -std=c99
LDFLAGS =
SOURCES := main.cpp FSS.cpp
OBJECTS = $(SOURCES:.cpp=.o)
BINDIR = bin
EXECUTABLE = $(BINDIR)/FSS
#-------------------------------------------------------------------------------
ifdef DEBUG
CFLAGS += -DDEBUG=1
endif
#-------------------------------------------------------------------------------
all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
-mkdir -p $(BINDIR)
$(CC) $(LDFLAGS) $(OBJECTS) -o $@
#-------------------------------------------------------------------------------
.c.o:
$(CC) $(CFLAGS) $< -o $@
clean:
rm -f *.o
rm -r $(BINDIR)